From 8bd2c81cd58f3346de7d4e216ffb854835ac741e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 17 Jul 2019 01:23:44 -0700 Subject: Updated gfortran options. * Removed conclude_fc.am, which was causing verbose builds. Need to investigate more, though. * Added gfortran 9 warnings and flags. This will need to be separated into other version blocks based on when the options first appeared. * The standard is now explicitly set at 2008. --- MANIFEST | 1 - config/conclude_fc.am | 31 ------------ config/gnu-fflags | 101 +++++++++++++++++++++++++++------------- fortran/examples/Makefile.am | 2 +- fortran/src/Makefile.am | 2 +- fortran/test/Makefile.am | 2 +- fortran/testpar/Makefile.am | 2 +- hl/fortran/examples/Makefile.am | 2 +- hl/fortran/src/Makefile.am | 3 +- hl/fortran/test/Makefile.am | 2 +- 10 files changed, 77 insertions(+), 71 deletions(-) delete mode 100644 config/conclude_fc.am diff --git a/MANIFEST b/MANIFEST index b4ee3b0..9af97ff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -119,7 +119,6 @@ ./config/cce-flags ./config/commence.am ./config/conclude.am -./config/conclude_fc.am ./config/examples.am ./config/freebsd ./config/gnu-cxxflags diff --git a/config/conclude_fc.am b/config/conclude_fc.am deleted file mode 100644 index 15d04a7..0000000 --- a/config/conclude_fc.am +++ /dev/null @@ -1,31 +0,0 @@ -## config/conclude_fc.am -## (Use double hashes for copyright notice so that automake treats it as -## comments and does not pass it to Makefile.in) -## Copyright by The HDF Group. -## Copyright by the Board of Trustees of the University of Illinois. -## All rights reserved. -## -## This file is part of HDF5. The full HDF5 copyright notice, including -## terms governing use, modification, and redistribution, is contained in -## the COPYING file, which can be found at the root of the source code -## distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. -## If you do not have access to either file, you may request a copy from -## help@hdfgroup.org. - - -## Textually included at the end of the Fortran HDF5 Makefiles.am. - -# Makefile.am include fragment with Fortran helper rules and macros. - -# AM_FCCPPFLAGS, FCCPPFLAGS are currently not used. - -PPFCCOMPILE = $(FC) $(FCDEFS) $(DEFAULT_INCLUDES) $(FCINCLUDES) $(AM_FCCPPFLAGS) $(FCCPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -LTPPFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(PPFCCOMPILE) - -# Treat all .f90 and .F90 files as preprocessed Fortran. -.f90.o: - $(PPFCCOMPILE) -c -o $@ $< -.F90.o: - $(PPFCCOMPILE) -c -o $@ $< - -include $(top_srcdir)/config/conclude.am diff --git a/config/gnu-fflags b/config/gnu-fflags index 6b5e6a1..3a47787 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -1,4 +1,4 @@ -# -*- shell-script -*- +# -*- shell-script -*- # # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. @@ -25,9 +25,8 @@ # if test X = "X$f9x_flags_set"; then f9x_version="`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 |grep 'gcc version' |\ - sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" if test X != "X$f9x_version"; then -# is_mpi="`$FC $FCFLAGS $H5_FCFLAGS -help 2>&1 |grep 'link MPI'`" f9x_vendor=`echo $f9x_version |sed 's/\([a-z]*\).*/\1/'` f9x_version=`echo $f9x_version |sed 's/[-a-z]//g'` if test X = "X$f9x_vendor" -a X != "X$f9x_version"; then @@ -37,24 +36,29 @@ if test X = "X$f9x_flags_set"; then echo "compiler '$FC' is GNU $f9x_vendor-$f9x_version" fi - # Some version numbers + # Get the compiler version numbers f9x_vers_major=`echo $f9x_version | cut -f1 -d.` f9x_vers_minor=`echo $f9x_version | cut -f2 -d.` f9x_vers_patch=`echo $f9x_version | cut -f3 -d.` test -n "$f9x_vers_major" || f9x_vers_major=0 test -n "$f9x_vers_minor" || f9x_vers_minor=0 test -n "$f9x_vers_patch" || f9x_vers_patch=0 - f9x_vers_all=`expr $f9x_vers_major '*' 1000000 + $f9x_vers_minor '*' 1000 + $f9x_vers_patch` fi fi -# Common GNU flags for various situations if test "X-gfortran" = "X-$f9x_vendor"; then - # Insert section about version specific problems from gnu-flags here, if - # necessary. + + FC_BASENAME=gfortran + F9XSUFFIXFLAG="" + FSEARCH_DIRS="" + + H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + + ############################### + # Architecture-specific flags # + ############################### arch= - # Architecture-specific flags # Nothing currently. (Uncomment code below and modify to add any) #case "$host_os-$host_cpu" in # *-i686) @@ -62,43 +66,76 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # ;; #esac - # Host-specific flags - # Nothing currently. (Uncomment code below and modify to add any) - #case "`hostname`" in - # sleipnir.ncsa.uiuc.edu) - # arch="$arch -pipe" - # ;; - #esac - - # General - FC_BASENAME=gfortran - F9XSUFFIXFLAG="" - FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" + H5_FCFLAGS="$H5_FCFLAGS $arch" - # Turn off warnings for passing non-ANSI types to BIND(). - # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. - H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + ############## + # Production # + ############## - # Production PROD_FCFLAGS= - # Debug - DEBUG_FCFLAGS="-fbounds-check" + ######### + # Debug # + ######### + + # Need to figure out an appropriate version for the switch. + if test $f9x_vers_major -ge 9; then + DEBUG_FCFLAGS="-fcheck=all" + else + DEBUG_FCFLAGS="-fbounds-check" + fi + + ########### + # Symbols # + ########### - # Symbols SYMBOLS_FCFLAGS="-g" NO_SYMBOLS_FCFLAGS="-s" - # Profiling + ############# + # Profiling # + ############# + PROFILE_FCFLAGS="-pg" - # Optimization + ################ + # Optimization # + ################ + HIGH_OPT_FCFLAGS="-O2" DEBUG_OPT_FCFLAGS="-O0" NO_OPT_FCFLAGS="-O0" - # Flags are set + ############ + # Warnings # + ############ + + ########### + # General # + ########### + + H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" + + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + + ############################# + # Version-specific warnings # + ############################# + + # gcc 9 + # Move to other versions (9 is just the current version) + if test $f9x_vers_major -ge 9; then + H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Warray-temporaries -Wcharacter-truncation" + H5_FCFLAGS="$H5_FCFLAGS -Wconversion-extra -Wfrontend-loop-interchange -Wimplicit-procedure" + H5_FCFLAGS="$H5_FCFLAGS -Winteger-division -Wintrinsics-std -Wreal-q-constant" + H5_FCFLAGS="$H5_FCFLAGS -Wuse-without-only -Wrealloc-lhs -Wrealloc-lhs-all" + fi + + ################# + # Flags are set # + ################# f9x_flags_set=yes fi diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 6bf2edb..00afb3a 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -105,4 +105,4 @@ compound_fortran2003: compound_fortran2003.f90 compound_complex_fortran2003: compound_complex_fortran2003.f90 include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 4009439..3489566 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -165,4 +165,4 @@ HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ H5Off.lo H5Pff.lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Zff.lo H5_gen.lo -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index f0d7f03..e5fe7d6 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -100,4 +100,4 @@ H5_test_buildiface_LDADD = fflush2.chkexe_: fflush1.chkexe_ -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am index e597a84..00bc3db 100644 --- a/fortran/testpar/Makefile.am +++ b/fortran/testpar/Makefile.am @@ -48,4 +48,4 @@ LDADD=$(LIBH5FTEST) $(LIBH5TEST) $(LIBH5F) $(LIBHDF5) # Mark this directory as part of the Fortran API FORTRAN_API=yes -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am index d383f9a..71c2866 100644 --- a/hl/fortran/examples/Makefile.am +++ b/hl/fortran/examples/Makefile.am @@ -62,4 +62,4 @@ EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl # and fortran libraries above. include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index 37e074c..f51d595 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -114,4 +114,5 @@ H5IMff.lo: $(srcdir)/H5IMff.F90 H5TBff.lo: $(srcdir)/H5TBff.F90 H5LTff_gen.lo: H5LTff.lo H5LTff_gen.F90 H5TBff_gen.lo: H5TBff.lo H5LTff_gen.F90 H5TBff_gen.F90 -include $(top_srcdir)/config/conclude_fc.am + +include $(top_srcdir)/config/conclude.am diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index 0552aaa..ef7cd4b 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -62,4 +62,4 @@ clean-local: # from tests in conclude.am) FORTRAN_API=yes -include $(top_srcdir)/config/conclude_fc.am +include $(top_srcdir)/config/conclude.am -- cgit v0.12 From 7bb020fcec5c6ede4b24d23670921c1a9f00d63f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 10:37:52 -0500 Subject: HDFFV-10845 add support for mingw toolchain --- MANIFEST | 1 + config/toolchain/mingw64.cmake | 10 ++++++++++ src/CMakeLists.txt | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 config/toolchain/mingw64.cmake diff --git a/MANIFEST b/MANIFEST index b4ee3b0..8403d60 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3240,6 +3240,7 @@ ./config/toolchain/crayle.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake +./config/toolchain/mingw64.cmake ./config/toolchain/PGI.cmake ./config/cmake/cacheinit.cmake diff --git a/config/toolchain/mingw64.cmake b/config/toolchain/mingw64.cmake new file mode 100644 index 0000000..ad0fb85 --- /dev/null +++ b/config/toolchain/mingw64.cmake @@ -0,0 +1,10 @@ +set (CMAKE_SYSTEM_NAME Windows) +set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) +set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) +set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) +set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) +set (CMAKE_FIND_ROOT_PATH ) +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_CROSSCOMPILING_EMULATOR wine64) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a0a10a5..6c5b2aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1014,7 +1014,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND $ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 @@ -1070,7 +1070,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c ${HDF5_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$ + COMMAND $ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 -- cgit v0.12 From 9c04e508898da677fd98fcb2f3291b9152e69320 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 10:47:48 -0500 Subject: HDFFV-10845 add release note. --- release_docs/RELEASE.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 6be1d7f..707adce 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -57,6 +57,15 @@ New Features (ADB - 2019/07/17, HDFFV-100424) + - Add mingw support with toolchain file + + There has been a number of mingw issues that has been linked under + HDFFV-10845. It has been decided to implement the CMake cross-compiling + technique of toolchain files. We will use a linux platform with the mingw + compiler stack for testing. + + (ADB - 2019/07/12, HDFFV-10845, HDFFV-10595) + - Windows PDB files are installed incorrectly For static builds, the PDB files for windows should be installed next -- cgit v0.12 From 7174b5c135f39b448925551c433cb60fc618d7af Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 13:04:44 -0500 Subject: HDFFV-8631 mingw is different platform --- config/cmake_ext_mod/ConfigureChecks.cmake | 13 +++++++------ src/CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 63d9ee9..35ec3e9 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -61,14 +61,15 @@ endmacro () # ---------------------------------------------------------------------- # WINDOWS Hard code Values # ---------------------------------------------------------------------- - set (WINDOWS) + +if (MINGW) + 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 () + if (WIN32) - if (MINGW) - 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 () set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") if (NOT UNIX AND NOT MINGW) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c5b2aa..b6c3351 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -973,7 +973,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> PRIVATE $<$:"-O0"> ) @@ -1063,7 +1063,7 @@ target_include_directories (H5make_libsettings PRIVATE "${HDF5_SRC_DIR};${HDF5_B target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings - PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$:ws2_32.lib> + PRIVATE "$<$:${MPI_C_LIBRARIES}>" $<$,$>:ws2_32.lib> PRIVATE $<$:"-O0"> ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9173531..8333c78 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,7 +35,7 @@ if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$,$>:ws2_32.lib> ) if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") @@ -56,7 +56,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$,$>:ws2_32.lib> ) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") -- cgit v0.12 From 7a9c852c2c1be7fd0b7c3a97b3e7f81227b35b43 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 14:25:33 -0500 Subject: HDFFV-8631, HDFFV-10595, HDFFV-10845 --- config/cmake_ext_mod/ConfigureChecks.cmake | 13 +++++-------- config/cmake_ext_mod/HDFMacros.cmake | 7 ++++++- src/H5win32defs.h | 6 +++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 35ec3e9..a951429 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -66,15 +66,12 @@ set (WINDOWS) if (MINGW) 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") + set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) endif () if (WIN32) - set (${HDF_PREFIX}_HAVE_WIN32_API 1) - set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") - if (NOT UNIX AND NOT MINGW) + if (NOT UNIX) set (WINDOWS 1) - set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) endif () @@ -82,6 +79,9 @@ if (WIN32) endif () if (WINDOWS) + set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") + set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") + set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) set (${HDF_PREFIX}_HAVE_SYS_STAT_H 1) set (${HDF_PREFIX}_HAVE_SYS_TYPES_H 1) @@ -99,9 +99,6 @@ if (WINDOWS) 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 () set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 0a4598d..d145607 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -179,7 +179,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) endif () else () - if (CYGWIN) + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + elseif (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}" diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 2ae2575..d439379 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -52,7 +52,11 @@ typedef __int64 h5_stat_size_t; /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. */ +#ifndef H5_HAVE_MINGW #define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__) +#else +#define HDopen(S,F,...) Wopen_utf8(S,F,##__VA_ARGS__) +#endif #define HDread(F,M,Z) _read(F,M,Z) #define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) @@ -128,7 +132,7 @@ extern "C" { H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); H5_DLL const wchar_t *H5_get_utf16_str(const char *s); - H5_DLL int Wopen_utf8(const char *path, int oflag, ...); + H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); /* Round functions only needed for VS2012 and earlier. -- cgit v0.12 From d586a457b2c3d0377b8752a6ce9b621a5994f56e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 15:04:59 -0500 Subject: HDFFV-10845 C_FLAGS need set correctly for win32 vs mingw --- config/cmake_ext_mod/ConfigureChecks.cmake | 10 +++++++--- testpar/t_mpi.c | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index a951429..8c00f52 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -21,6 +21,9 @@ include (CheckTypeSize) include (CheckVariableExists) include (TestBigEndian) +set (HDF_EXTRA_C_FLAGS) +set (HDF_EXTRA_FLAGS) + #----------------------------------------------------------------------------- # APPLE/Darwin setup #----------------------------------------------------------------------------- @@ -66,12 +69,16 @@ set (WINDOWS) if (MINGW) 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") + set (HDF_EXTRA_C_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) endif () if (WIN32) if (NOT UNIX) set (WINDOWS 1) + set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") + set (HDF_EXTRA_C_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) endif () @@ -79,7 +86,6 @@ if (WIN32) endif () if (WINDOWS) - set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib") set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_STDDEF_H 1) @@ -260,8 +266,6 @@ HDF_FUNCTION_TEST (STDC_HEADERS) # The linux-lfs option is deprecated. set (LINUX_LFS 0) -set (HDF_EXTRA_C_FLAGS) -set (HDF_EXTRA_FLAGS) if (NOT WINDOWS) # Might want to check explicitly for Linux and possibly Cygwin # instead of checking for not Solaris or Darwin. diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 41acf7a..94ecbfa 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -460,11 +460,11 @@ static int test_mpio_1wMr(char *filename, int special_request) { /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF) { #ifdef H5_HAVE_GETHOSTNAME - if(HDgethostname(hostname, sizeof(hostname)) < 0) { - printf("gethostname failed\n"); - hostname[0] = '\0'; - } - #else + if(HDgethostname(hostname, sizeof(hostname)) < 0) { + printf("gethostname failed\n"); + hostname[0] = '\0'; + } +#else printf("gethostname unavailable\n"); hostname[0] = '\0'; #endif -- cgit v0.12 From 7ba562a82017779829394d5a5e03b62e69d6c926 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 12 Jul 2019 15:42:49 -0500 Subject: HDFFV-10845 fix configure check and PATHs --- CMakeInstallation.cmake | 12 ++++++------ CMakeLists.txt | 4 ++-- c++/src/CMakeLists.txt | 2 +- config/cmake/CTestScript.cmake | 2 +- config/cmake/jrunTest.cmake | 6 +++--- config/cmake/scripts/CTestScript.cmake | 2 +- config/cmake/scripts/HDF5config.cmake | 6 +++--- config/cmake_ext_mod/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/HDFUseFortran.cmake | 2 +- config/cmake_ext_mod/grepTest.cmake | 4 ++-- config/cmake_ext_mod/runTest.cmake | 6 +++--- fortran/src/CMakeLists.txt | 2 +- hl/c++/src/CMakeLists.txt | 2 +- hl/src/CMakeLists.txt | 2 +- java/examples/datasets/CMakeLists.txt | 2 +- java/examples/datatypes/CMakeLists.txt | 2 +- java/examples/groups/CMakeLists.txt | 2 +- java/examples/intro/CMakeLists.txt | 2 +- java/test/CMakeLists.txt | 2 +- test/CMakeTests.cmake | 4 ++-- test/flushrefreshTest.cmake | 2 +- tools/src/misc/CMakeLists.txt | 7 ------- tools/test/h5dump/CMakeTests.cmake | 4 ++-- 23 files changed, 37 insertions(+), 44 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index b933c29..dc229d2 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -192,7 +192,7 @@ HDF_README_PROPERTIES(HDF5_BUILD_FORTRAN) #----------------------------------------------------------------------------- # Configure the COPYING.txt file for the windows binary package #----------------------------------------------------------------------------- -if (WIN32) +if (WIN32 OR MINGW) configure_file (${HDF5_SOURCE_DIR}/COPYING ${HDF5_BINARY_DIR}/COPYING.txt @ONLY) endif () @@ -212,7 +212,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${HDF5_SOURCE_DIR}/release_docs/COPYING ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt ) - if (WIN32) + if (WIN32 OR MINGW) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/USING_HDF5_VS.txt @@ -226,7 +226,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL ) - if (WIN32) + if (WIN32 OR MINGW) set (release_files ${release_files} ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt @@ -294,7 +294,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED AND NOT HDF5_NO_PACKAGES) set (CPACK_PACKAGE_ICON "${HDF_RESOURCES_EXT_DIR}/hdf.bmp") set (CPACK_GENERATOR "TGZ") - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_GENERATOR "ZIP") if (NSIS_EXECUTABLE) @@ -459,7 +459,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut if (HDF5_PACKAGE_EXTLIBS) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;ALL;/") else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${ZLIB_INCLUDE_DIR_GEN};ZLIB;libraries;/") @@ -468,7 +468,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut endif () endif () if (SZIP_FOUND AND SZIP_USE_EXTERNAL) - if (WIN32) + if (WIN32 OR MINGW) set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;ALL;/") else () set (CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${SZIP_INCLUDE_DIR_GEN};SZIP;libraries;/") diff --git a/CMakeLists.txt b/CMakeLists.txt index fc656c0..a62561f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,7 +512,7 @@ endif () # and we need to call the executable from inside the CMake configuration #----------------------------------------------------------------------------- set (EXE_EXT "") -if (WIN32) +if (WIN32 OR MINGW) set (EXE_EXT ".exe") add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) add_definitions (-D_CRT_SECURE_NO_WARNINGS) @@ -688,7 +688,7 @@ endif () option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) if (HDF5_ENABLE_THREADSAFE) # check for unsupported options - if (WIN32) + if (WIN32 OR MINGW) message (STATUS " **** thread-safety option not supported with static library **** ") message (STATUS " **** thread-safety option will not be used building static library **** ") endif () diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index b141a5e..38c46be 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -188,7 +188,7 @@ install ( COMPONENT cpplibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake index 0269ba8..a5527c3 100644 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/CTestScript.cmake @@ -72,7 +72,7 @@ set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar or zip file provided ## -------------------------- - if (WIN32) + if (WIN32 AND NOT MINGW) message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) else () diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 44ac15b..341c382 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -49,7 +49,7 @@ endif () message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") -if (WIN32 AND NOT MINGW) +if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -124,7 +124,7 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () @@ -186,7 +186,7 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake index e1fe85a..dc3939e 100644 --- a/config/cmake/scripts/CTestScript.cmake +++ b/config/cmake/scripts/CTestScript.cmake @@ -69,7 +69,7 @@ set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") if (CTEST_USE_TAR_SOURCE) ## Uncompress source if tar file provided ## -------------------------- - if (WIN32) + if (WIN32 AND NOT MINGW) message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]") execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) else () diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 44ed531..e6c9619 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -90,7 +90,7 @@ endif () set (CTEST_BINARY_NAME "build") set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}") -if (WIN32) +if (WIN32 AND NOT MINGW) set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") else () @@ -104,7 +104,7 @@ if (NOT DEFINED HPC) if (NOT DEFINED BUILD_GENERATOR) message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364") endif () - if (WIN32) + if (WIN32 AND NOT MINGW) set (SITE_OS_NAME "Windows") set (SITE_OS_VERSION "WIN7") if (BUILD_GENERATOR STREQUAL "VS201764") @@ -212,7 +212,7 @@ set (REPOSITORY_BRANCH "develop") ################################################################### -if (WIN32) +if (WIN32 AND NOT MINGW) set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}") include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake) include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 8c00f52..c19c5dc 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -74,7 +74,7 @@ if (MINGW) set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) endif () -if (WIN32) +if (WIN32 AND NOT MINGW) if (NOT UNIX) set (WINDOWS 1) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index bed1fc1..bfb45fa 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -191,7 +191,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding # Add debug information (intel Fortran : JB) #----------------------------------------------------------------------------- if (CMAKE_Fortran_COMPILER MATCHES ifort) - if (WIN32) + if (WIN32 AND NOT MINGW) set (CMAKE_Fortran_FLAGS_DEBUG "/debug:full /dbglibs " CACHE "flags" STRING FORCE) set (CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG" CACHE "flags" STRING FORCE) endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 4b58639..dffbd8c 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -46,7 +46,7 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -98,7 +98,7 @@ if (TEST_ERRREF) #always compare output file to reference unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index c9508f3..184ec27 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -38,7 +38,7 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") @@ -186,7 +186,7 @@ endif () # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () @@ -248,7 +248,7 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 315dc85..4077180 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -494,7 +494,7 @@ install ( COMPONENT fortlibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_Fortran_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 1911d62..9964160 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -108,7 +108,7 @@ install ( COMPONENT hlcpplibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_CXX_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 3cce7e4..9bce694 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -132,7 +132,7 @@ install ( COMPONENT hllibraries ) -if (NOT WIN32) +if (NOT WIN32 AND NOT MINGW) set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) configure_file ( ${HDF_RESOURCES_DIR}/libh5cc.in diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 9e5c45c..328c4b1 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -39,7 +39,7 @@ set (HDF_JAVA_SZIP_EXAMPLES set (${HDF_JAVA_EXAMPLES} ${HDF_JAVA_EXAMPLES} ${HDF_JAVA_SZIP_EXAMPLES}) endif (H5_HAVE_FILTER_SZIP) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index c939985..18a99b8 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -24,7 +24,7 @@ set (HDF_JAVA_EXAMPLES H5Ex_T_VLString ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 489dab3..8b16ffd 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -13,7 +13,7 @@ set (HDF_JAVA_EXAMPLES H5Ex_G_Visit ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 1801749..86b6296 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -13,7 +13,7 @@ set (HDF_JAVA_EXAMPLES H5_ReadWrite ) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 05bfd8d..a210ca9 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -82,7 +82,7 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_ add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list}) -if (WIN32) +if (WIN32 OR MINGW) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 3d986d2..b138f14 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -885,7 +885,7 @@ endif () ### F I L T E R P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) - if (WIN32) + if (WIN32 OR MINGW) set (CMAKE_SEP "\;") set (BIN_REL_PATH "../../") else () @@ -982,7 +982,7 @@ endif () ### V O L P L U G I N T E S T S ############################################################################## if (BUILD_SHARED_LIBS) - if (WIN32) + if (WIN32 OR MINGW) set (CMAKE_SEP "\;") set (BIN_REL_PATH "../../") else () diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index 73210ef..926efba 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -41,7 +41,7 @@ endif () message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) - if (WIN32 AND NOT MINGW) + if (WIN32 OR MINGW) set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") else () set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 7c3d7f0..6b41d7f 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -78,13 +78,6 @@ if (BUILD_SHARED_LIBS) ) endif () -#----------------------------------------------------------------------------- -# Generate the h5cc file containing settings needed to compile programs -#----------------------------------------------------------------------------- -#if (NOT WIN32) -# configure_file (${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) -#endif () - ############################################################################## ############################################################################## ### I N S T A L L A T I O N ### diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 070e98e..db47111 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -362,7 +362,7 @@ endforeach () foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) - if (WIN32) + if (WIN32 OR MINGW) file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") else () @@ -388,7 +388,7 @@ # -------------------------------------------------------------------- HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files") - if (WIN32) + if (WIN32 OR MINGW) file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") else () -- cgit v0.12 From 6b775a9d45b827427d09bf9a26c1b384c45f1f95 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 13 Jul 2019 09:58:26 -0500 Subject: HDFFV-10845 defines already set --- config/cmake_ext_mod/ConfigureChecks.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index c19c5dc..7369350 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -70,7 +70,6 @@ if (MINGW) 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") - set (HDF_EXTRA_C_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) endif () @@ -78,7 +77,6 @@ if (WIN32 AND NOT MINGW) if (NOT UNIX) set (WINDOWS 1) set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") - set (HDF_EXTRA_C_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") if (MSVC) set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) endif () -- cgit v0.12 From 0efee3ddbada2d08803bfba5a4622d60238cdc35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 13 Jul 2019 10:11:49 -0500 Subject: Must include from system --- config/cmake_ext_mod/FindSZIP.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/FindSZIP.cmake b/config/cmake_ext_mod/FindSZIP.cmake index b84d768..2303d6d 100644 --- a/config/cmake_ext_mod/FindSZIP.cmake +++ b/config/cmake_ext_mod/FindSZIP.cmake @@ -73,7 +73,7 @@ if(SZIP_INCLUDE_DIR AND EXISTS "${SZIP_INCLUDE_DIR}/SZconfig.h") unset(szip_version_str) endif() -include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SZIP REQUIRED_VARS SZIP_LIBRARY SZIP_INCLUDE_DIR VERSION_VAR SZIP_VERSION) -- cgit v0.12 From 5b258e186b84d36a465740413573fbac8c00a360 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 13 Jul 2019 18:29:52 -0500 Subject: Correct install syntax --- fortran/src/CMakeLists.txt | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 4077180..1dc0896 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -356,18 +356,32 @@ install ( ${HDF5_F90_SRC_SOURCE_DIR}/H5f90.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90i.h ${HDF5_F90_SRC_SOURCE_DIR}/H5f90proto.h - if (NOT ONLY_SHARED_LIBS) - ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - else () - ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h - ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - endif () DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT fortheaders ) +if (NOT ONLY_SHARED_LIBS) + install ( + FILES + ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) +else () + install ( + FILES + ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h + ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + fortheaders + ) +endif () if (NOT ONLY_SHARED_LIBS) set (mod_files -- cgit v0.12 From ac5680ce8db5452d3705e6530a087ff927cc8687 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 14 Jul 2019 17:25:26 -0500 Subject: HDFFV-10845 add_custom_command requires emulator --- config/cmake_ext_mod/ConfigureChecks.cmake | 4 ++-- fortran/src/CMakeLists.txt | 8 ++++---- fortran/test/CMakeLists.txt | 4 ++-- hl/fortran/src/CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 7369350..b05fbc8 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -96,7 +96,7 @@ if (WINDOWS) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) endif () - if (NOT UNIX AND NOT CYGWIN AND NOT MINGW) + if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) endif () set (${HDF_PREFIX}_HAVE_FUNCTION 1) @@ -474,7 +474,7 @@ if (NOT WINDOWS) CHECK_FUNCTION_EXISTS (_getvideoconfig ${HDF_PREFIX}_HAVE__GETVIDEOCONFIG) CHECK_FUNCTION_EXISTS (gettextinfo ${HDF_PREFIX}_HAVE_GETTEXTINFO) CHECK_FUNCTION_EXISTS (_scrsize ${HDF_PREFIX}_HAVE__SCRSIZE) - if (NOT CYGWIN AND NOT MINGW) + if (NOT CYGWIN) CHECK_FUNCTION_EXISTS (GetConsoleScreenBufferInfo ${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO) endif () CHECK_SYMBOL_EXISTS (TIOCGWINSZ "sys/ioctl.h" ${HDF_PREFIX}_HAVE_TIOCGWINSZ) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 1dc0896..0ec14ab 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -84,7 +84,7 @@ if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS H5match_types ) @@ -95,7 +95,7 @@ if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h ${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS H5match_types ) @@ -183,7 +183,7 @@ set (f90_F_GEN_SOURCES if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 file" @@ -197,7 +197,7 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared DEPENDS ${f90_F_GEN_SOURCES} COMMENT "Generating the H5_gen.F90 shared file" diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 9c68860..4efd8a8 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -83,7 +83,7 @@ endif () if (NOT BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 file" @@ -95,7 +95,7 @@ if (NOT BUILD_SHARED_LIBS) else () add_custom_command ( OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared DEPENDS H5_test_buildiface COMMENT "Generating the tf_gen.F90 shared file" diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index b63b5c6..e532fff 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -105,7 +105,7 @@ set (HDF5_HL_F90_F_BASE_SOURCES if (NOT ONLY_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" @@ -122,7 +122,7 @@ endif () if (BUILD_SHARED_LIBS) add_custom_command ( OUTPUT ${HDF5_HL_F90_BINARY_DIR}/shared/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/shared/H5TBff_gen.F90 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/shared DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 shared files" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b6c3351..4106515 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1014,7 +1014,7 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_custom_command ( OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 @@ -1070,7 +1070,7 @@ target_link_libraries (H5make_libsettings add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c ${HDF5_BINARY_DIR}/gen_SRCS.stamp2 - COMMAND $ + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c COMMAND ${CMAKE_COMMAND} ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2 -- cgit v0.12 From f724e867272b5316dc95c2ff90f32a10975dc850 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Jul 2019 09:44:14 -0500 Subject: HDFFV-10845 use of TARGETFILE disables auto emulator --- c++/examples/CMakeTests.cmake | 6 ++-- c++/test/CMakeTests.cmake | 3 +- c++/test/CMakeVFDTests.cmake | 1 + config/cmake/userblockTest.cmake | 8 ++--- config/cmake/vfdTest.cmake | 4 +-- config/cmake/volTest.cmake | 4 +-- config/cmake_ext_mod/grepTest.cmake | 4 +-- config/cmake_ext_mod/runTest.cmake | 6 ++-- examples/CMakeTests.cmake | 3 +- fortran/examples/CMakeTests.cmake | 6 ++-- fortran/test/CMakeTests.cmake | 16 +++++---- hl/c++/examples/CMakeTests.cmake | 3 +- hl/c++/test/CMakeTests.cmake | 3 +- hl/examples/CMakeTests.cmake | 3 +- hl/fortran/examples/CMakeTests.cmake | 3 +- hl/fortran/test/CMakeTests.cmake | 3 +- hl/test/CMakeTests.cmake | 3 +- hl/tools/gif2h5/CMakeLists.txt | 2 +- hl/tools/gif2h5/CMakeTests.cmake | 10 +++--- hl/tools/h5watch/CMakeTests.cmake | 5 ++- test/CMakePassthroughVOLTests.cmake | 5 +++ test/CMakeTests.cmake | 52 +++++++++++++++++----------- test/CMakeVFDTests.cmake | 5 +++ test/flushrefreshTest.cmake | 4 +-- testpar/CMakeVFDTests.cmake | 1 + tools/test/h5copy/CMakeLists.txt | 2 +- tools/test/h5copy/CMakeTests.cmake | 29 ++++++++++------ tools/test/h5diff/CMakeLists.txt | 2 +- tools/test/h5diff/CMakeTests.cmake | 5 ++- tools/test/h5dump/CMakeLists.txt | 2 +- tools/test/h5dump/CMakeTests.cmake | 27 ++++++++++----- tools/test/h5dump/CMakeTestsPBITS.cmake | 3 +- tools/test/h5dump/CMakeTestsVDS.cmake | 9 +++-- tools/test/h5dump/CMakeTestsXML.cmake | 3 +- tools/test/h5format_convert/CMakeLists.txt | 2 +- tools/test/h5format_convert/CMakeTests.cmake | 12 +++++-- tools/test/h5import/CMakeTests.cmake | 15 ++++++-- tools/test/h5jam/CMakeLists.txt | 2 +- tools/test/h5jam/CMakeTests.cmake | 21 +++++++---- tools/test/h5ls/CMakeTests.cmake | 7 ++-- tools/test/h5ls/CMakeTestsVDS.cmake | 6 ++-- tools/test/h5repack/CMakeTests.cmake | 47 +++++++++++++++---------- tools/test/h5repack/CMakeVFDTests.cmake | 1 + tools/test/h5stat/CMakeLists.txt | 2 +- tools/test/h5stat/CMakeTests.cmake | 6 ++-- tools/test/misc/CMakeLists.txt | 4 +-- tools/test/misc/CMakeTestsClear.cmake | 18 ++++++---- tools/test/misc/CMakeTestsMkgrp.cmake | 6 ++-- tools/test/misc/CMakeTestsRepart.cmake | 10 +++--- tools/test/perform/CMakeTests.cmake | 23 +++++++----- 50 files changed, 277 insertions(+), 150 deletions(-) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 58bdb68..6a2190c 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -33,9 +33,10 @@ foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND $) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -73,9 +74,10 @@ foreach (example ${tutr_examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND $) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 02bff3e..a25dc6b 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -32,9 +32,10 @@ add_test ( ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_testhdf5 COMMAND $) + add_test (NAME CPP_testhdf5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME CPP_testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 6a8ce2c..c979ff1 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -46,6 +46,7 @@ add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" diff --git a/config/cmake/userblockTest.cmake b/config/cmake/userblockTest.cmake index 0e9d01b..c9fc36f 100644 --- a/config/cmake/userblockTest.cmake +++ b/config/cmake/userblockTest.cmake @@ -55,7 +55,7 @@ if (TEST_CHECKUB STREQUAL "YES") # of the user block #s2=`$JAM_BIN/tellub $origfile` EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_OFILE} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_OFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}.len.txt @@ -73,7 +73,7 @@ if (TEST_CHECKUB STREQUAL "YES") if (TEST_O_STRING_LEN) #$JAM_BIN/getub -c $s2 $origfile > $cmpfile EXECUTE_PROCESS ( - COMMAND ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} + COMMAND ${TEST_EMULATOR} ${TEST_GET_PROGRAM} -c ${TEST_O_STRING_LEN} ${TEST_OFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}-ub.cmp @@ -91,7 +91,7 @@ if (TEST_CHECKUB STREQUAL "YES") #$JAM_BIN/getub -c $size $hfile > $tfile EXECUTE_PROCESS ( - COMMAND ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE} + COMMAND ${TEST_EMULATOR} ${TEST_GET_PROGRAM} -c ${TEST_STRING_SIZE} ${TEST_HFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_HFILE}.cmp @@ -115,7 +115,7 @@ else () # call 'ubsize' to get the size of the user block #ubsize=`$JAM_BIN/tellub $hfile` EXECUTE_PROCESS ( - COMMAND ${TEST_PROGRAM} ${TEST_HFILE} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_HFILE} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_H_STRING_LEN OUTPUT_VARIABLE TEST_OUT diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 8e186e9..3556d07 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -36,13 +36,13 @@ endif () # set (ERROR_APPEND 1) #endif () -message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") set (ENV{HDF5_DRIVER} "${TEST_VFD}") # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT}_${TEST_VFD}.out diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake index a9dd756..6554f00 100644 --- a/config/cmake/volTest.cmake +++ b/config/cmake/volTest.cmake @@ -36,13 +36,13 @@ endif () # set (ERROR_APPEND 1) #endif () -message (STATUS "USING ${TEST_VOL} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "USING ${TEST_VOL} ON COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") set (ENV{HDF5_VOL_CONNECTOR} "${TEST_VOL}") # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT}.out diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index dffbd8c..2a30336 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -43,7 +43,7 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) if (WIN32 OR MINGW) @@ -60,7 +60,7 @@ endif () # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 184ec27..3953c27 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -35,7 +35,7 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () -message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +message (STATUS "COMMAND: ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS}") if (TEST_LIBRARY_DIRECTORY) if (WIN32 OR MINGW) @@ -53,7 +53,7 @@ endif () if (NOT TEST_INPUT) # run the test program, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} @@ -64,7 +64,7 @@ if (NOT TEST_INPUT) else () # run the test program with stdin, capture the stdout/stderr and the result var execute_process ( - COMMAND ${TEST_PROGRAM} ${TEST_ARGS} + COMMAND ${TEST_EMULATOR} ${TEST_PROGRAM} ${TEST_ARGS} WORKING_DIRECTORY ${TEST_FOLDER} RESULT_VARIABLE TEST_RESULT INPUT_FILE ${TEST_INPUT} diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 6cab7dd..69ace97 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -77,9 +77,10 @@ foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND $) + add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 1ad606c..221e5cc 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -47,9 +47,10 @@ foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f90_ex_${example} COMMAND $) + add_test (NAME f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -68,9 +69,10 @@ endforeach () foreach (example ${F2003_examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME f03_ex_${example} COMMAND $) + add_test (NAME f03_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index 20fb7e3..c93b4a2 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -65,9 +65,10 @@ endif () set (last_test "FORTRAN_testhdf5-clear-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran COMMAND $) + add_test (NAME FORTRAN_testhdf5_fortran COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -85,9 +86,10 @@ set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES DEPENDS FORTRAN_testhd #-- Adding test for testhdf5_fortran_1_8 if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND $) + add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_testhdf5_fortran_1_8 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -105,9 +107,10 @@ set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_te #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $) + add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -125,9 +128,10 @@ endif () #-- Adding test for vol_connector if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME FORTRAN_vol_connector COMMAND $) + add_test (NAME FORTRAN_vol_connector COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME FORTRAN_vol_connector COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -142,9 +146,9 @@ else () endif () #-- Adding test for fflush1 -add_test (NAME FORTRAN_fflush1 COMMAND $) +add_test (NAME FORTRAN_fflush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) #-- Adding test for fflush2 -add_test (NAME FORTRAN_fflush2 COMMAND $) +add_test (NAME FORTRAN_fflush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index 103ec2b..a7acc63 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -24,9 +24,10 @@ add_test ( ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_CPP_ex_ptExampleFL COMMAND $) + add_test (NAME HL_CPP_ex_ptExampleFL COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ex_ptExampleFL COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index 785abca..f85ef85 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -17,9 +17,10 @@ ############################################################################## if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_CPP_ptableTest COMMAND $) + add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_CPP_ptableTest COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index c1fd6c2..407c61c 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -58,9 +58,10 @@ add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_ex_${example} COMMAND $) + add_test (NAME HL_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 91cb56b..d3a9d0c 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -28,9 +28,10 @@ add_test ( foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND $) + add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 2137d1a..0b81573 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -30,9 +30,10 @@ set (test_CLEANFILES macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_${file} COMMAND $) + add_test (NAME HL_FORTRAN_f90_${file} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index 477a165..be90206 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -48,9 +48,10 @@ add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tes # -------------------------------------------------------------------- macro (HL_ADD_TEST hl_name) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_${hl_name} COMMAND $) + add_test (NAME HL_${hl_name} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME HL_${hl_name} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 14a5f5f..3cd913f 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -80,7 +80,7 @@ if (BUILD_TESTING) target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) -# add_test (NAME hl_h52gifgentest COMMAND $) +# add_test (NAME hl_h52gifgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 1cc989c..ab14864 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -44,19 +44,19 @@ add_test ( image24.gif ) -add_test (NAME HL_TOOLS_gif2h5 COMMAND $ testfiles/image1.gif image1.h5) +add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/image1.gif image1.h5) set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif COMMAND $ testfiles/h52giftst.h5 image1.gif -i image) +add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image1.gif -i image) set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) -add_test (NAME HL_TOOLS_h52gif_none COMMAND $ testfiles/h52giftst.h5 image.gif -i nosuch_image) +add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) -#add_test (NAME HL_TOOLS_h52gifpal COMMAND $ testfiles/h52giftst.h5 image.gif -i palette) +#add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") -add_test (NAME HL_TOOLS_h52gif24bits COMMAND $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) +add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index fba8484..e563be4 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -79,6 +79,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -97,6 +98,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH_ARGS-h5watch-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -122,6 +124,7 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes add_test ( NAME H5WATCH-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -177,7 +180,7 @@ if (NOT SWMR_INCOMPAT) # # ################################################################################################# # create the output files to be used. - add_test (NAME H5WATCH-h5watchgentest COMMAND $) + add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5WATCH-h5watchgentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5WATCH-h5watchgentest PROPERTIES DEPENDS "H5WATCH-clearall-objects") set (last_test "H5WATCH-h5watchgentest") diff --git a/test/CMakePassthroughVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake index 24a0201..9863147 100644 --- a/test/CMakePassthroughVOLTests.cmake +++ b/test/CMakePassthroughVOLTests.cmake @@ -99,6 +99,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VOL:STRING=${volinfo}" @@ -127,6 +128,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VOL:STRING=${volinfo}" @@ -151,6 +153,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VOL:STRING=${volinfo}" @@ -178,6 +181,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VOL:STRING=${volinfo}" @@ -221,6 +225,7 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VOL-${volname}-fheap COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VOL:STRING=${volinfo}" diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index b138f14..8537c46 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -206,25 +206,25 @@ add_test (NAME H5TEST-clear-testhdf5-objects ) set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) -add_test (NAME H5TEST-testhdf5-base COMMAND $ -x heap -x file -x select) +add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -x heap -x file -x select) set_tests_properties (H5TEST-testhdf5-base PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-heap COMMAND $ -o heap) +add_test (NAME H5TEST-testhdf5-heap COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o heap) set_tests_properties (H5TEST-testhdf5-heap PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-file COMMAND $ -o file) +add_test (NAME H5TEST-testhdf5-file COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o file) set_tests_properties (H5TEST-testhdf5-file PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -add_test (NAME H5TEST-testhdf5-select COMMAND $ -o select) +add_test (NAME H5TEST-testhdf5-select COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -o select) set_tests_properties (H5TEST-testhdf5-select PROPERTIES FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -472,7 +472,7 @@ set (H5TEST_SEPARATE_TESTS foreach (h5_test ${H5_TESTS}) if (NOT h5_test IN_LIST H5TEST_SEPARATE_TESTS) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-${h5_test} COMMAND $) + add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-${h5_test} PROPERTIES FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -485,6 +485,7 @@ foreach (h5_test ${H5_TESTS}) ) else () add_test (NAME H5TEST-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -521,9 +522,10 @@ if (NOT CYGWIN) ) set_tests_properties (H5TEST-clear-cache-objects PROPERTIES FIXTURES_SETUP cache_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-cache COMMAND $) + add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-cache COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -553,7 +555,7 @@ if (TEST_CACHE_IMAGE) ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) - add_test (NAME H5TEST-cache_image COMMAND $) + add_test (NAME H5TEST-cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-cache_image PROPERTIES FIXTURES_REQUIRED cache_image_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" @@ -581,9 +583,10 @@ add_test ( ) set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-external_env COMMAND $) + add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-external_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_ENV_VAR:STRING=HDF5_EXTFILE_PREFIX" @@ -617,9 +620,10 @@ add_test ( ) set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-vds_env COMMAND $) + add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-vds_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" @@ -654,9 +658,10 @@ add_test (NAME H5TEST-clear-flush-objects ${HDF5_TEST_BINARY_DIR}/H5TEST ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-flush1 COMMAND $) + add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -672,9 +677,10 @@ set_tests_properties (H5TEST-flush1 PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-flush2 COMMAND $) + add_test (NAME H5TEST-flush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-flush2 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -687,17 +693,17 @@ endif () set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) #-- Adding test for tcheck_version -add_test (NAME H5TEST-tcheck_version-major COMMAND $ "-tM") +add_test (NAME H5TEST-tcheck_version-major COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tM") set_tests_properties (H5TEST-tcheck_version-major PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" ) -add_test (NAME H5TEST-tcheck_version-minor COMMAND $ "-tm") +add_test (NAME H5TEST-tcheck_version-minor COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tm") set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" ) -add_test (NAME H5TEST-tcheck_version-release COMMAND $ "-tr") +add_test (NAME H5TEST-tcheck_version-release COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tr") set_tests_properties (H5TEST-tcheck_version-release PROPERTIES WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST WILL_FAIL "true" @@ -745,7 +751,7 @@ add_test ( ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-filenotclosed-objects PROPERTIES FIXTURES_SETUP filenotclosed_clear_objects) -add_test (NAME H5TEST-filenotclosed COMMAND $) +add_test (NAME H5TEST-filenotclosed COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-filenotclosed PROPERTIES FIXTURES_REQUIRED filenotclosed_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -762,7 +768,7 @@ add_test ( ${HDF5_TEST_BINARY_DIR}/H5TEST ) set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects) -add_test (NAME H5TEST-del_many_dense_attrs COMMAND $) +add_test (NAME H5TEST-del_many_dense_attrs COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES FIXTURES_REQUIRED del_many_dense_attrs_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" @@ -781,6 +787,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) ) set_tests_properties (H5TEST-clear-err_compat-objects PROPERTIES FIXTURES_SETUP err_compat_clear_objects) add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -816,6 +823,7 @@ if (HDF5_USE_16_API_DEFAULT) set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -847,9 +855,10 @@ add_test (NAME H5TEST-clear-links_env-objects ) set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5TEST-links_env COMMAND $) + add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" @@ -893,7 +902,7 @@ if (BUILD_SHARED_LIBS) set (BIN_REL_PATH "../") endif () - add_test (NAME H5PLUGIN-filter_plugin COMMAND $) + add_test (NAME H5PLUGIN-filter_plugin COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} @@ -902,7 +911,7 @@ if (BUILD_SHARED_LIBS) ############################################################################## # HDFFV-9655 relative plugin test disabled # -# add_test (NAME H5PLUGIN-pluginRelative COMMAND $) +# add_test (NAME H5PLUGIN-pluginRelative COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) # set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES # ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}" # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} @@ -923,7 +932,7 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $) +# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") @@ -940,6 +949,7 @@ if (ENABLE_EXTENDED_TESTS) ) set_tests_properties (H5TEST-clear-testflushrefresh-objects PROPERTIES FIXTURES_SETUP testflushrefresh_clear_objects) add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS1:STRING=flushrefresh_VERIFICATION_START" -D "TEST_ARGS2:STRING=flushrefresh_VERIFICATION_DONE" @@ -990,7 +1000,7 @@ if (BUILD_SHARED_LIBS) set (BIN_REL_PATH "../") endif () - add_test (NAME H5PLUGIN-vol_plugin COMMAND $) + add_test (NAME H5PLUGIN-vol_plugin COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5PLUGIN-vol_plugin PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/null_vol_plugin_dir;srcdir=${HDF5_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR} diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 0ddce92..2767bdc 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -102,6 +102,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -130,6 +131,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -154,6 +156,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -180,6 +183,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" @@ -222,6 +226,7 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index 926efba..01faad5 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -90,7 +90,7 @@ while (verification_done LESS "1") else () message (STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") execute_process ( - COMMAND ${TEST_PROGRAM} ${param1} ${param2} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${TEST_PROGRAM} ${param1} ${param2} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err @@ -133,7 +133,7 @@ while (verification_done LESS "2") else () message (STATUS "execute: ${TEST_PROGRAM} ${param1}") execute_process ( - COMMAND ${TEST_PROGRAM} ${param1} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${TEST_PROGRAM} ${param1} RESULT_VARIABLE TEST_RESULT OUTPUT_FILE ${TEST_OUTPUT} ERROR_FILE ${TEST_OUTPUT}.err diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 7333c6d..6f974af 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -50,6 +50,7 @@ endforeach () add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index ecf371f..1130ea7 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5copygentest COMMAND $) + #add_test (NAME h5copygentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () #----------------------------------------------------------------------------- diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index df56f1a..3fabdf6 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -73,7 +73,7 @@ add_test ( NAME H5COPY_F-${testname} - COMMAND $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -87,7 +87,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) if (${resultcode} EQUAL 1) @@ -109,7 +109,7 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -123,7 +123,7 @@ if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -155,7 +155,7 @@ add_test ( NAME H5COPY-${testname}-prefill - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -167,14 +167,14 @@ add_test ( NAME H5COPY-${testname} - COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF - COMMAND $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) if (${resultcode} EQUAL 1) @@ -196,7 +196,7 @@ add_test ( NAME H5COPY_SAME-${testname}-prefill - COMMAND $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) if (last_test) @@ -208,14 +208,14 @@ add_test ( NAME H5COPY_SAME-${testname} - COMMAND $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${testname}.out.h5 -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF - COMMAND $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) if (${resultcode} EQUAL 1) @@ -231,7 +231,7 @@ macro (ADD_H5_CMP_TEST testname resultcode infile vparam sparam srcname dparam dstname) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5COPY-CMP-${testname} COMMAND $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) + add_test (NAME H5COPY-CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () @@ -251,6 +251,7 @@ add_test ( NAME H5COPY-CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${vparam};${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -282,6 +283,7 @@ add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -298,6 +300,7 @@ add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-i;./testfiles/${infile};-o;./testfiles/${testname}.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -315,6 +318,7 @@ add_test ( NAME H5COPY_UD-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -348,6 +352,7 @@ add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -365,6 +370,7 @@ add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;--enable-error-stack;-i;./testfiles/${infile};-o;./testfiles/${testname}_ERR.out.h5;${sparam};${srcname};${dparam};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -383,6 +389,7 @@ add_test ( NAME H5COPY_UD_ERR-${testname}-DIFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;./testfiles/${cmpfile};./testfiles/${testname}_ERR.out.h5;${srcname};${dstname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index 0a874ec..cb4397f 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5diffgentest COMMAND $) + #add_test (NAME h5diffgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () #----------------------------------------------------------------------------- diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 604c8a5..c7734a6 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -358,7 +358,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") @@ -381,6 +381,7 @@ add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -454,6 +455,7 @@ add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -470,6 +472,7 @@ add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index 1672774..38f4118 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -40,7 +40,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5dumpgentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5dumpgentest COMMAND $) + #add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index db47111..c151c9a 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -411,7 +411,7 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -432,6 +432,7 @@ add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -461,7 +462,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -482,6 +483,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -497,7 +499,7 @@ macro (ADD_H5_TEST_N resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-N-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-N-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") @@ -518,6 +520,7 @@ add_test ( NAME H5DUMP-N-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -533,7 +536,7 @@ macro (ADD_H5_TEST_EXPORT resultfile targetfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -554,6 +557,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -576,7 +580,7 @@ macro (ADD_H5_TEST_EXPORT_DDL resultfile targetfile resultcode ddlfile) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -598,6 +602,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--ddl=${ddlfile}.txt;${ARGN};${resultfile}.txt;${targetfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -634,7 +639,7 @@ set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-output-${resultfile} - COMMAND $ ${ARGN} ${resultfile}.txt ${targetfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${resultfile}.txt ${targetfile} ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) @@ -662,6 +667,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -689,6 +695,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -715,6 +722,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -742,6 +750,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -772,6 +781,7 @@ add_test ( NAME H5DUMP-IMPORT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};-o;${resultfile}.bin;${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" @@ -781,10 +791,10 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects") - add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) + add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5) set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile}) - add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $ ${testfile} ${resultfile}.h5 /integer /integer) + add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${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 () @@ -804,6 +814,7 @@ add_test ( NAME H5DUMP_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index feb5c68..57c1ad7 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -128,7 +128,7 @@ macro (ADD_H5_PBITS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -149,6 +149,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits" diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index c557ba4..454d9ef 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -124,7 +124,7 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -145,6 +145,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" @@ -160,7 +161,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5DUMP_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -184,6 +185,7 @@ add_test ( NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds/prefix" @@ -201,7 +203,7 @@ macro (ADD_H5_VDS_LAYOUT resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) + add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") @@ -222,6 +224,7 @@ add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index a883b86..c4e3f7b 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -182,7 +182,7 @@ macro (ADD_XML_H5_TEST resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DUMP_XML-${resultfile} COMMAND $ --xml ${ARGN}) + add_test (NAME H5DUMP_XML-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") @@ -203,6 +203,7 @@ add_test ( NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--xml;${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/xml" diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 019252f..55d5623 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -22,7 +22,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5fc_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5fc_gentest COMMAND $) + #add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index e1abc48..6e13664 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -127,6 +127,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -142,6 +143,7 @@ add_test ( NAME H5FC-${testname}-NA COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -179,6 +181,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -215,6 +218,7 @@ add_test ( NAME H5FC-${testname}-${testfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};outtmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -252,6 +256,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/tmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -270,7 +275,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC_CHECK_IDX-${testname} - COMMAND "$" "./testfiles/tmp.h5" "${ARGN}" + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ./testfiles/tmp.h5 ${ARGN} ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${dependtest}") endif () @@ -299,6 +304,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=-d;${ARGN};./testfiles/chktmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -310,7 +316,7 @@ set_tests_properties (H5FC-${testname} PROPERTIES DEPENDS "H5FC-${testname}-tmpfile") add_test ( NAME H5FC_CHECK_IDX-${testname} - COMMAND "$" "./testfiles/chktmp.h5" "${ARGN}" + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ./testfiles/chktmp.h5 ${ARGN} ) set_tests_properties (H5FC_CHECK_IDX-${testname} PROPERTIES DEPENDS "H5FC-${testname}") set (last_test "H5FC_CHECK_IDX-${testname}") @@ -342,6 +348,7 @@ add_test ( NAME H5FC-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN};./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -354,6 +361,7 @@ add_test ( NAME H5FC_CHECK_DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-BH;./testfiles/dmptmp.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 9d36276..4aaee68 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -105,7 +105,7 @@ macro (ADD_H5_TEST testname importfile conffile testfile) # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) if (last_test) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () @@ -123,12 +123,13 @@ ) set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) - add_test (NAME H5IMPORT-${testname} COMMAND $ ${importfile} -c ${conffile} -o ${testfile}) + add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) add_test ( NAME H5IMPORT-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -142,6 +143,7 @@ add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -177,6 +179,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -189,6 +192,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};-o;d${testfile}.bin;-y;--width=1;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -203,6 +207,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=d${testfile}.bin;-c;d${testfile}.dmp;-o;d${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -216,6 +221,7 @@ add_test ( NAME H5IMPORT-DUMP-${testname}-H5DFF COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-r;d${testfile};testfiles/${testfile};${datasetname};${datasetname}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -250,6 +256,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;-d;${datasetname};${ARGN};-o;${testname}.bin;-b;NATIVE;testfiles/${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -263,6 +270,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${testname}.bin;-c;${testname}.dmp;-o;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -275,6 +283,7 @@ add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-p;d-${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -511,7 +520,7 @@ endif () set (last_test "H5IMPORT-clear-objects") - add_test (NAME H5IMPORT-h5importtest COMMAND $) + add_test (NAME H5IMPORT-h5importtest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5IMPORT-h5importtest PROPERTIES DEPENDS H5IMPORT-h5importtest-clear-objects) # ----- TESTING "ASCII I32 rank 3 - Output BE " ; diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 585a8a1..6fdf7b0 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5jamgentest COMMAND $) + #add_test (NAME h5jamgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 84af48b..d930a1e 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -60,7 +60,7 @@ macro (TEST_H5JAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -75,6 +75,7 @@ add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -96,7 +97,7 @@ macro (TEST_H5UNJAM_OUTPUT expectfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $ ${ARGN}) + add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () @@ -111,6 +112,7 @@ add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -139,6 +141,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=testfiles/${expected}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -152,6 +155,7 @@ add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${actual}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -187,7 +191,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${ufile} ) set_tests_properties (H5JAM-${testname}-UNJAM_D-clear-objects PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -u ${ufile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -u ${ufile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM_D-clear-objects) set (compare_test ${ufile}) else () @@ -195,6 +199,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-i;${infile};-o;${outfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -206,7 +211,7 @@ set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "${outfile}.ufile.txt") else () - add_test (NAME H5JAM-${testname}-UNJAM COMMAND $ -i ${infile} -o ${outfile}) + add_test (NAME H5JAM-${testname}-UNJAM COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -i ${infile} -o ${outfile}) set_tests_properties (H5JAM-${testname}-UNJAM PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-clear-objects) set (compare_test "") endif () @@ -224,6 +229,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" @@ -240,6 +246,7 @@ add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_NOUB COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=NO" @@ -267,7 +274,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${outfile} ${infile}.cpy.h5 ) endif () - add_test (NAME H5JAM-${testname} COMMAND $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) + add_test (NAME H5JAM-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i testfiles/${infile} -o ${outfile} ${ARGN}) if (NOT HDF5_ENABLE_USING_MEMCHECKER) set_tests_properties (H5JAM-${testname} PROPERTIES DEPENDS H5JAM-${testname}-clear-objects) set (compare_test ${outfile}) @@ -288,6 +295,7 @@ add_test ( NAME H5JAM-${testname}-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" @@ -322,7 +330,7 @@ ) set_tests_properties (H5JAM-${testname}_NONE_COPY PROPERTIES DEPENDS H5JAM-${testname}_NONE-SETUP) - add_test (NAME H5JAM-${testname}_NONE COMMAND $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) + add_test (NAME H5JAM-${testname}_NONE COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -u testfiles/${jamfile} -i ${chkfile} ${ARGN}) set_tests_properties (H5JAM-${testname}_NONE PROPERTIES DEPENDS H5JAM-${testname}_NONE_COPY) set (compare_test ${chkfile}) @@ -343,6 +351,7 @@ add_test ( NAME H5JAM-${testname}_NONE-CHECK_UB_1 COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_GET_PROGRAM=$" -D "TEST_CHECKUB=YES" diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index cd62297..9110f01 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -143,7 +143,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -163,6 +163,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -178,7 +179,7 @@ macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -198,6 +199,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -224,6 +226,7 @@ add_test ( NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 04fb306..b975d4a 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -89,7 +89,7 @@ macro (ADD_H5_VDS_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") @@ -109,6 +109,7 @@ add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/vds" @@ -124,7 +125,7 @@ macro (ADD_H5_VDS_PREFIX_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5LS_PREFIX-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LS_PREFIX-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" @@ -147,6 +148,7 @@ add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 50be28a..d1e9c7a 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -166,7 +166,7 @@ macro (ADD_HELP_TEST testname resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5REPACK-h5repack-${testname} COMMAND $ ${ARGN}) + add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) @@ -186,6 +186,7 @@ add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -219,12 +220,12 @@ endif () add_test ( NAME H5REPACK_OLD-${testname} - COMMAND $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) add_test ( NAME H5REPACK_OLD-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () @@ -251,12 +252,12 @@ endif () add_test ( NAME H5REPACK-${testname} - COMMAND $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) add_test ( NAME H5REPACK-${testname}_DFF - COMMAND $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) endif () @@ -276,7 +277,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_CMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) @@ -296,6 +297,7 @@ add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -324,7 +326,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) if (last_test) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) @@ -344,6 +346,7 @@ add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -382,13 +385,14 @@ endif () add_test ( NAME H5REPACK_DMP-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-q;creation_order;-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -425,13 +429,14 @@ endif () add_test ( NAME H5REPACK_STAT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} ) set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-S;-s;out-${statarg}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -469,18 +474,19 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -504,6 +510,7 @@ add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -544,13 +551,14 @@ endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -581,12 +589,13 @@ endif () add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-H;-B;out-${testname}.${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -612,7 +621,7 @@ endif () add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} - COMMAND $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties ( ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES @@ -635,12 +644,12 @@ endif () add_test ( NAME H5REPACK_META-${testname}_N - COMMAND $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) add_test ( NAME H5REPACK_META-${testname}_M - COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) @@ -668,6 +677,7 @@ add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${resultfile};out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -684,6 +694,7 @@ add_test ( NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-pH;out-${testname}.${resultfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -916,7 +927,7 @@ ADD_HELP_TEST(help 0 -h) - add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND $) + add_test (NAME H5REPACK-testh5repack_detect_szip COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) if (HDF5_ENABLE_SZIP_SUPPORT) if (HDF5_ENABLE_SZIP_ENCODING) set (passRegex "yes") @@ -931,7 +942,7 @@ endif () set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) - add_test (NAME H5REPACK-h5repacktest COMMAND $) + add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) set (last_test "H5REPACK-h5repacktest") diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index e100e3c..7761c17 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -39,6 +39,7 @@ add_test ( NAME H5REPACK-VFD-${vfdname}-h5repacktest COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index f3bd20b..5c17fd5 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -11,7 +11,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5stat_gentest COMMAND $) + #add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () include (CMakeTests.cmake) diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 63886d0..7d0e3f9 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -102,7 +102,7 @@ macro (ADD_H5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -123,6 +123,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" @@ -138,7 +139,7 @@ macro (ADD_H5_ERR_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5STAT-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () @@ -159,6 +160,7 @@ add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index f5e3ea3..a250222 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -15,7 +15,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) - #add_test (NAME h5repart_gentest COMMAND $) + #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") @@ -27,7 +27,7 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) - #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $) + #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_subdirectory (vds) diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index c7b2fe9..99650e6 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -106,6 +106,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -134,6 +135,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -171,6 +173,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -207,6 +210,7 @@ add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN};${testfile}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -225,7 +229,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_RET-${testname} - COMMAND $ ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") @@ -261,6 +265,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -273,12 +278,12 @@ if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment=${incr_size} ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment=${incr_size} ${testname}.h5 ) else () add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} - COMMAND $ --increment ${testname}.h5 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment ${testname}.h5 ) endif () set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") @@ -287,6 +292,7 @@ add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -315,7 +321,7 @@ # Initial file open fails OR # File open succeeds because the library does not check status_flags for file with < v3 superblock - add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND $ ${testfile}.h5) + add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5) set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}") set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) @@ -323,10 +329,10 @@ endif () # After "h5clear" the file, the subsequent file open succeeds - add_test (NAME H5CLEAR-h5clr-${testname} COMMAND $ -s ${testfile}.h5) + add_test (NAME H5CLEAR-h5clr-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode}) set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND $ ${testfile}.h5) + add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5) set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES DEPENDS H5CLEAR-h5clr-${testname}) set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set (last_test "H5CLEAR-clr_open_chk-${testname}") diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index db1f805..37d87ca 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -75,7 +75,7 @@ add_test ( NAME H5MKGRP-${resultfile} - COMMAND $ ${resultoption} ${resultfile}.h5 ${ARGN} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (HDF5_ENABLE_USING_MEMCHECKER) @@ -87,6 +87,7 @@ add_test ( NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=-v;-r;${resultfile}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" @@ -102,7 +103,7 @@ macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects @@ -116,6 +117,7 @@ add_test ( NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=${ARGN}" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 53949a2..24b6004 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -80,31 +80,31 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + add_test (NAME H5REPART-h5repart_20K COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND $ -m 5k family_file%05d.h5 scd_family%05d.h5) + add_test (NAME H5REPART-h5repart_5K COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_single COMMAND $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + add_test (NAME H5REPART-h5repart_single COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes (old argument) - add_test (NAME H5REPART-h5repart_sec2 COMMAND $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + add_test (NAME H5REPART-h5repart_sec2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # test the output files repartitioned above. - add_test (NAME H5REPART-h5repart_test COMMAND $) + add_test (NAME H5REPART-h5repart_test COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" ) diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 20e7f59..f0eb65f 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -53,9 +53,10 @@ add_test ( ) if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_h5perf_serial COMMAND $) + add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -70,13 +71,14 @@ set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME PERFORM_h5perf_serial_alone COMMAND $) + add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) endif () if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_chunk COMMAND $) + add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -90,9 +92,10 @@ endif () set_tests_properties (PERFORM_chunk PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_iopipe COMMAND $) + add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -106,9 +109,10 @@ endif () set_tests_properties (PERFORM_iopipe PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_overhead COMMAND $) + add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -122,9 +126,10 @@ endif () set_tests_properties (PERFORM_overhead PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_perf_meta COMMAND $) + add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -138,9 +143,10 @@ endif () set_tests_properties (PERFORM_perf_meta PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf_help COMMAND $ "-h") + add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-h") else () add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" @@ -154,9 +160,10 @@ endif () set_tests_properties (PERFORM_zip_perf_help PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PERFORM_zip_perf COMMAND $ tfilters.h5) + add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ tfilters.h5) else () add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_EXPECT=0" -- cgit v0.12 From 0eb050d481d611e8dc634f9a80582402a734aed4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Jul 2019 15:00:57 -0500 Subject: HDFFV-10845 mingw needs special windows reference files --- tools/test/h5diff/CMakeTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index c7734a6..3feac0a 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -324,7 +324,7 @@ # # Overwrite system dependent files (Windows) and not VS2015 # - if (WIN32 AND MSVC_VERSION LESS 1900) + if (MINGW OR WIN32 AND MSVC_VERSION LESS 1900) foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") -- cgit v0.12 From 95d3b41af07dd1e7532d0a6b453315ee2e3e5968 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Jul 2019 16:17:41 -0500 Subject: HDFFV-10845 separate test used by copy windows files --- tools/test/h5diff/CMakeTests.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 3feac0a..4e5b2ef 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -324,7 +324,14 @@ # # Overwrite system dependent files (Windows) and not VS2015 # - if (MINGW OR WIN32 AND MSVC_VERSION LESS 1900) + set (COPY_WINDOWS_FILES false) + if (MINGW) + set (COPY_WINDOWS_FILES true) + endif () + if (WIN32 AND MSVC_VERSION LESS 1900) + set (COPY_WINDOWS_FILES true) + endif () + if (COPY_WINDOWS_FILES) foreach (h5_tstfiles ${LIST_WIN_TEST_FILES}) get_filename_component(fname "${h5_tstfiles}" NAME) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/${h5_tstfiles}w.txt" "${PROJECT_BINARY_DIR}/testfiles/${fname}.txt" "h5diff_files") -- cgit v0.12 From 3ea746014a7e905b6a6d668bcc4c6305e76b5ec2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Jul 2019 16:36:44 -0500 Subject: HDFFV-10845 copy files with windows EOL --- config/cmake/jrunTest.cmake | 12 ++++++++---- config/cmake_ext_mod/grepTest.cmake | 6 ++++-- config/cmake_ext_mod/runTest.cmake | 12 ++++++++---- tools/test/h5dump/CMakeTests.cmake | 10 ++++++---- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 341c382..fa687f5 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -125,8 +125,10 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) if (WIN32 OR MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) @@ -187,8 +189,10 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 OR MINGW) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () # now compare the error output with the error reference diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index 2a30336..ab00e70 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -99,8 +99,10 @@ if (TEST_ERRREF) if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) if (WIN32 OR MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) # now compare the output with the reference diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 3953c27..a904855 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -187,8 +187,10 @@ endif () if (NOT TEST_SKIP_COMPARE) if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) if (WIN32 OR MINGW) - file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) + #file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") endif () if (NOT TEST_SORT_COMPARE) @@ -249,8 +251,10 @@ if (NOT TEST_SKIP_COMPARE) # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 OR MINGW) - file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) - file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + configure_file(${TEST_FOLDER}/${TEST_ERRREF} ${TEST_FOLDER}/${TEST_ERRREF}.tmp NEWLINE_STYLE CRLF) + file(RENAME ${TEST_FOLDER}/${TEST_ERRREF}.tmp ${TEST_FOLDER}/${TEST_ERRREF}) + #file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + #file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") endif () # now compare the error output with the error reference diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index c151c9a..458c6b0 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -363,8 +363,9 @@ foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) if (WIN32 OR MINGW) - file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM) - file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") + configure_file(${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} NEWLINE_STYLE CRLF) + #file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM) + #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") endif () @@ -389,8 +390,9 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbin1.ddl" "${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl" "h5dump_std_files") if (WIN32 OR MINGW) - file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) - file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") + configure_file(${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp NEWLINE_STYLE CRLF) + #file (READ ${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp TEST_STREAM) + #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") else () HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tbinregR.exp" "${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp" "h5dump_std_files") endif () -- cgit v0.12 From 741ef0aaefb64ead937d86c5e30c9fbc97f69597 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Jul 2019 11:38:10 -0500 Subject: HDFFV-10845 skip test if CMake command doesn't support ignore EOL --- CMakeLists.txt | 6 ++++++ tools/test/h5dump/CMakeTests.cmake | 24 ++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a62561f..95d24bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,12 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) ) endif () +# CMake version 3.14 added option --ignore-eol to compare files +# cmake -E compare_files --ignore-eol file1 file2 +#if(CMAKE_VERSION VERSION_LESS "3.14.0" AND WIN32) +# MESSAGE(FATAL_ERROR "Windows builds requires a minimum of CMake 3.14") +#endif() + #----------------------------------------------------------------------------- # Instructions for use : Sub-Project Build # diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 458c6b0..e8e9d07 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -362,13 +362,7 @@ endforeach () foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) - if (WIN32 OR MINGW) - configure_file(${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} NEWLINE_STYLE CRLF) - #file (READ ${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file} TEST_STREAM) - #file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file} "${TEST_STREAM}") - else () - HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") - endif () + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${tst_exp_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_exp_file}" "h5dump_std_files") endforeach () foreach (tst_other_file ${HDF5_REFERENCE_FILES}) @@ -569,13 +563,15 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - add_test ( - NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - 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}) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-${resultfile}-output-cmp + COMMAND ${CMAKE_COMMAND} + -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + 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 () endif () endmacro () -- cgit v0.12 From ac8a1f02ab5cb260f23acbe865090033a0183303 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 16 Jul 2019 16:12:15 -0500 Subject: Add missing target root path, check other export macro --- config/cmake/CTestScript.cmake | 5 +++++ config/toolchain/mingw64.cmake | 2 +- tools/test/h5dump/CMakeTests.cmake | 46 +++++++++++++++++++++----------------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/config/cmake/CTestScript.cmake b/config/cmake/CTestScript.cmake index a5527c3..e819e58 100644 --- a/config/cmake/CTestScript.cmake +++ b/config/cmake/CTestScript.cmake @@ -101,6 +101,11 @@ endif () include (ProcessorCount) ProcessorCount (N) if (NOT N EQUAL 0) + if (MAX_PROC_COUNT) + if (N GREATER MAX_PROC_COUNT) + set (N ${MAX_PROC_COUNT}) + endif () + endif () if (NOT WIN32) set (CTEST_BUILD_FLAGS -j${N}) endif () diff --git a/config/toolchain/mingw64.cmake b/config/toolchain/mingw64.cmake index ad0fb85..721c39a 100644 --- a/config/toolchain/mingw64.cmake +++ b/config/toolchain/mingw64.cmake @@ -3,7 +3,7 @@ set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc) set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++) set (CMAKE_RC_COMPILER x86_64-w64-mingw32-windres) set (CMAKE_Fortran_COMPILER x86_64-w64-mingw32-gfortran) -set (CMAKE_FIND_ROOT_PATH ) +set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index e8e9d07..7a3fdd6 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -610,20 +610,22 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") - add_test ( - NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - 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}) - add_test ( - NAME H5DUMP-${resultfile}-output-cmp-ddl - COMMAND ${CMAKE_COMMAND} - -E compare_files ${ddlfile}.txt ${ddlfile}.exp - ) - 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) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-${resultfile}-output-cmp + COMMAND ${CMAKE_COMMAND} + -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + 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}) + add_test ( + NAME H5DUMP-${resultfile}-output-cmp-ddl + COMMAND ${CMAKE_COMMAND} + -E compare_files --ignore-eol ${ddlfile}.txt ${ddlfile}.exp + ) + 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 () endif () endmacro () @@ -641,13 +643,15 @@ ) set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") set_tests_properties (H5DUMP-output-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}-clear-objects) - add_test ( - NAME H5DUMP-output-cmp-${resultfile} - COMMAND ${CMAKE_COMMAND} - -E compare_files ${resultfile}.txt ${resultfile}.exp - ) - 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}) + if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") + add_test ( + NAME H5DUMP-output-cmp-${resultfile} + COMMAND ${CMAKE_COMMAND} + -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + ) + 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 () endif () endmacro () -- cgit v0.12 From 0a9180c0746618d08396d57f3fa5c94aa45e5b65 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 17 Jul 2019 16:08:43 -0500 Subject: HDFFV-10845 update mingw cmake changes --- c++/src/CMakeLists.txt | 5 ++++- config/cmake_ext_mod/ConfigureChecks.cmake | 5 ++--- config/cmake_ext_mod/HDFMacros.cmake | 10 ++++++++-- release_docs/README_HDF5_CMake | 6 +++--- release_docs/RELEASE.txt | 8 ++++---- src/H5win32defs.h | 12 +++++------- testpar/CMakeVFDTests.cmake | 2 +- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 38c46be..4e668d6 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -112,7 +112,10 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) - target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) + target_link_libraries (${HDF5_CPP_LIBSH_TARGET} + PUBLIC ${HDF5_LIBSH_TARGET} + PRIVATE $<$:-static -static-libgcc -static-libstdc++ -dynamic> + ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX") set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index b05fbc8..8b68a9f 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -21,9 +21,6 @@ include (CheckTypeSize) include (CheckVariableExists) include (TestBigEndian) -set (HDF_EXTRA_C_FLAGS) -set (HDF_EXTRA_FLAGS) - #----------------------------------------------------------------------------- # APPLE/Darwin setup #----------------------------------------------------------------------------- @@ -264,6 +261,8 @@ HDF_FUNCTION_TEST (STDC_HEADERS) # The linux-lfs option is deprecated. set (LINUX_LFS 0) +set (HDF_EXTRA_C_FLAGS) +set (HDF_EXTRA_FLAGS) if (NOT WINDOWS) # Might want to check explicitly for Linux and possibly Cygwin # instead of checking for not Solaris or Darwin. diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index d145607..e1b79d8 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -86,7 +86,7 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) ${targetfilename} DESTINATION ${targetdestination} - CONFIGURATIONS $ + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} OPTIONAL ) @@ -101,7 +101,7 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) $ DESTINATION ${targetdestination} - CONFIGURATIONS $ + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} OPTIONAL ) @@ -128,6 +128,12 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) endif () endif () + set_target_properties (${libtarget} + PROPERTIES + OUTPUT_NAME + ${LIB_RELEASE_NAME} + ) + if (${libtype} MATCHES "STATIC") if (WIN32) set_target_properties (${libtarget} diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake index a2e7dce..1b02f0c 100644 --- a/release_docs/README_HDF5_CMake +++ b/release_docs/README_HDF5_CMake @@ -6,16 +6,16 @@ This tar file contains CTestScript.cmake HDF5config.cmake CMake scripts for building HDF5 HDF5options.cmake - hdf5-1.11.4 HDF5 1.11.4 source + hdf5-1.11.6 HDF5 1.11.6 source SZip.tar.gz source for building SZIP ZLib.tar.gz source for building ZLIB For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in -hdf5-1.11.4/release_docs, or +hdf5-1.11.6/release_docs, or https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake. For more information about building HDF5 with CMake on HPC machines, including -cross compiling on Cray XC40, see README_HPC in hdf5-1.11.4/release_docs. +cross compiling on Cray XC40, see README_HPC in hdf5-1.11.6/release_docs. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 707adce..a64abc8 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -50,10 +50,10 @@ New Features ------------- - Windows PDB files are always installed - There are configuration settings for Windows, that may not generate - PDB files. As such the install utility will break because those files - are not found. Add an optional variable that can be set to not install - PDB files. + There are build configuration or flag settings for Windows that may not + generate PDB files. If those files are not generated then the install + utility will fail because those PDB files are not found. An optional + variable, DISABLE_PDB_FILES, was added to not install PDB files. (ADB - 2019/07/17, HDFFV-100424) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index d439379..29533dd 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -69,13 +69,6 @@ typedef __int64 h5_stat_size_t; #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) #define HDwrite(F,M,Z) _write(F,M,Z) -#if (_MSC_VER < 1800) -/* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are - * just pointers into the stack in those CRTs, the usual work-around - * is to just define the operation as a pointer copy. - */ -#define HDva_copy(D,S) ((D) = (S)) -#endif /* MSC_VER < 1800 */ #ifdef H5_HAVE_VISUAL_STUDIO @@ -86,6 +79,11 @@ typedef __int64 h5_stat_size_t; #ifndef H5_HAVE_STRTOULL #define HDstrtoull(S,R,N) _strtoui64(S,R,N) #endif /* H5_HAVE_STRTOULL */ + /* va_copy() does not exist on pre-2013 Visual Studio. Since va_lists are + * just pointers into the stack in those CRTs, the usual work-around + * is to just define the operation as a pointer copy. + */ + #define HDva_copy(D,S) ((D) = (S)) #endif /* MSC_VER < 1800 */ /* diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 6f974af..1c0f2e8 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -50,7 +50,7 @@ endforeach () add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -- cgit v0.12 From 0f2c1b8126075b2a1652644e5f529f83b771a52c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 18 Jul 2019 01:48:16 -0500 Subject: Moved the -std=f2008 option to gfortran 9 for now. --- config/gnu-fflags | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index 3a47787..d054980 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -52,7 +52,10 @@ if test "X-gfortran" = "X-$f9x_vendor"; then F9XSUFFIXFLAG="" FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + if test $f9x_vers_major -ge 9; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + fi + ############################### # Architecture-specific flags # -- cgit v0.12 From 17474a232fa0bd2a7fb8da8e9e97d9050cbc0443 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 09:21:00 -0500 Subject: HDFFV-10845 quote multiple strings in cmake link command --- c++/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 4e668d6..0871123 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -114,7 +114,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET} - PRIVATE $<$:-static -static-libgcc -static-libstdc++ -dynamic> + PRIVATE "$<$:-static -static-libgcc -static-libstdc++ -dynamic>" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX") -- cgit v0.12 From bdfb553c4c5783f757524f436ae8043e061dd765 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 10:45:42 -0500 Subject: HDFFV-1045 gcc static must be link flags --- c++/src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 0871123..f3db4f2 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -114,8 +114,12 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET} - PRIVATE "$<$:-static -static-libgcc -static-libstdc++ -dynamic>" ) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PUBLIC "-static -static-libgcc -static-libstdc++ -dynamic>" + ) + endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX") set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp) -- cgit v0.12 From 5b97d67d432d110e1c9ff5821e4ceec9e8ab4bf0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 11:37:34 -0500 Subject: CMake generator expr cannot be used in get_property cmd --- config/cmake_ext_mod/HDFMacros.cmake | 25 ++++++++++++++++--------- java/test/CMakeLists.txt | 5 +++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index e1b79d8..972896d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -110,21 +110,16 @@ endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) - if (WIN32) - set (LIB_DEBUG_SUFFIX "_D") - else () - set (LIB_DEBUG_SUFFIX "_debug") - endif () if (${libtype} MATCHES "SHARED") set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") else () - if (WIN32) + if (WIN32 AND NOT MINGW) set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "lib${libname}${CMAKE_DEBUG_POSTFIX}") else () set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") endif () endif () @@ -132,7 +127,19 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) PROPERTIES OUTPUT_NAME ${LIB_RELEASE_NAME} + OUTPUT_NAME_DEBUG + ${LIB_DEBUG_NAME} + OUTPUT_NAME_RELEASE + ${LIB_RELEASE_NAME} + OUTPUT_NAME_MINSIZEREL + ${LIB_RELEASE_NAME} + OUTPUT_NAME_RELWITHDEBINFO + ${LIB_RELEASE_NAME} ) + #get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME) + #get_property (target_name_debug TARGET ${libtarget} PROPERTY OUTPUT_NAME_DEBUG) + #get_property (target_name_rwdi TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + #message (STATUS "${target_name} : ${target_name_debug} : ${target_name_rwdi}") if (${libtype} MATCHES "STATIC") if (WIN32) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index a210ca9..7910ea2 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -88,8 +88,9 @@ else () set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") endif () -get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") +get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) +get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -- cgit v0.12 From 179d0b5af07c565faf694a06a2b4d699dd42e2e5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 12:00:19 -0500 Subject: Correct OUTPUT_NAME usage --- c++/examples/CMakeTests.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index 6a2190c..b7d7497 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -26,6 +26,7 @@ SDSextendible.h5 Select.h5 ) + set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex) if (last_test) set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test}) endif () -- cgit v0.12 From 5984530f3f25fc236dd263fd134340a0a88abb64 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 12:07:32 -0500 Subject: Fix typo --- c++/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index f3db4f2..e93d089 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -117,7 +117,7 @@ if (BUILD_SHARED_LIBS) ) if (MINGW) target_link_options (${HDF5_CPP_LIBSH_TARGET} - PUBLIC "-static -static-libgcc -static-libstdc++ -dynamic>" + PUBLIC "-static -static-libgcc -static-libstdc++ -dynamic" ) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") -- cgit v0.12 From 5654ba57f131d14eaf76d09e8ca1299e03ee1358 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 12:55:02 -0500 Subject: Correct syntax --- c++/src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index e93d089..bb244e8 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -117,7 +117,7 @@ if (BUILD_SHARED_LIBS) ) if (MINGW) target_link_options (${HDF5_CPP_LIBSH_TARGET} - PUBLIC "-static -static-libgcc -static-libstdc++ -dynamic" + PUBLIC -static-libgcc -static-libstdc++ ) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") -- cgit v0.12 From 4d3f52ac97ea922cefda857c971fbd3608d8994c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 13:03:07 -0500 Subject: Correct java load library name access --- java/examples/datasets/CMakeLists.txt | 5 +++-- java/examples/datatypes/CMakeLists.txt | 5 +++-- java/examples/groups/CMakeLists.txt | 5 +++-- java/examples/intro/CMakeLists.txt | 5 +++-- java/test/CMakeLists.txt | 2 -- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 328c4b1..83343fc 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -72,8 +72,9 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () macro (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") add_test ( NAME JAVA_datasets-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 18a99b8..701fe2a 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -57,8 +57,9 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") add_test ( NAME JAVA_datatypes-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 8b16ffd..f0693ba 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -56,8 +56,9 @@ endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) macro (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") add_test ( NAME JAVA_groups-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 86b6296..a4f0cdd 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -58,8 +58,9 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) endforeach () MACRO (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY $,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name};") + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") add_test ( NAME JAVA_intro-${resultfile} COMMAND "${CMAKE_COMMAND}" diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 7910ea2..d677b5f 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -93,7 +93,6 @@ get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTP set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) - set (CMAKE_JAVA_CLASSPATH ".") foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") @@ -125,7 +124,6 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) -D "TEST_REFERENCE=JUnit-${test_file}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JUnit-${test_file} PROPERTIES ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/testdir2" DEPENDS "JUnit-${test_file}-clearall-objects" -- cgit v0.12 From 367f7ed0e338ccf1a698ab0af4bb7ea702fd2d60 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 18 Jul 2019 16:27:06 -0500 Subject: HDFFV-10845 make flags private --- c++/examples/CMakeLists.txt | 10 ++++++++++ c++/src/CMakeLists.txt | 2 +- c++/test/CMakeLists.txt | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index 2088019..58d85c1 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -41,6 +41,11 @@ foreach (example ${examples}) else () TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () @@ -54,6 +59,11 @@ foreach (example ${tutr_examples}) else () TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index bb244e8..2a92ed2 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -117,7 +117,7 @@ if (BUILD_SHARED_LIBS) ) if (MINGW) target_link_options (${HDF5_CPP_LIBSH_TARGET} - PUBLIC -static-libgcc -static-libstdc++ + PRIVATE -static-libgcc -static-libstdc++ ) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 95ca9b1..75efc3b 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -48,6 +48,11 @@ if (NOT BUILD_SHARED_LIBS) else () TARGET_C_PROPERTIES (cpp_testhdf5 SHARED) target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + if (MINGW) + target_link_options (${HDF5_CPP_LIBSH_TARGET} + PRIVATE -static-libgcc -static-libstdc++ + ) + endif () endif () set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) -- cgit v0.12 From 5a3147b660c4e37f6a5cb71f4884e7f7e43a8782 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 18 Jul 2019 23:40:52 -0700 Subject: First stab at gfortran versions. Tested on gfortran 7-9 so far. --- config/gnu-fflags | 75 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index d054980..90a3656 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -52,8 +52,14 @@ if test "X-gfortran" = "X-$f9x_vendor"; then F9XSUFFIXFLAG="" FSEARCH_DIRS="" - if test $f9x_vers_major -ge 9; then + # Need Fortran 2008 support for storage_size() in gcc 4.6 on + # (2008ts in some versions) + if test $f9x_vers_major -ge 8; then H5_FCFLAGS="$H5_FCFLAGS -std=f2008" + elif test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS -std=f2008ts" + else + H5_FCFLAGS="$H5_FCFLAGS -std=f2003" fi @@ -81,8 +87,7 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # Debug # ######### - # Need to figure out an appropriate version for the switch. - if test $f9x_vers_major -ge 9; then + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then DEBUG_FCFLAGS="-fcheck=all" else DEBUG_FCFLAGS="-fbounds-check" @@ -105,8 +110,13 @@ if test "X-gfortran" = "X-$f9x_vendor"; then # Optimization # ################ - HIGH_OPT_FCFLAGS="-O2" - DEBUG_OPT_FCFLAGS="-O0" + if test $f9x_vers_major -le 4; then + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + else + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + fi NO_OPT_FCFLAGS="-O0" ############ @@ -118,24 +128,57 @@ if test "X-gfortran" = "X-$f9x_vendor"; then ########### H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" - - # Turn off warnings for passing non-ANSI types to BIND(). - # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. - H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Wcharacter-truncation -Wimplicit-procedure" ############################# # Version-specific warnings # ############################# - # gcc 9 - # Move to other versions (9 is just the current version) - if test $f9x_vers_major -ge 9; then - H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Warray-temporaries -Wcharacter-truncation" - H5_FCFLAGS="$H5_FCFLAGS -Wconversion-extra -Wfrontend-loop-interchange -Wimplicit-procedure" - H5_FCFLAGS="$H5_FCFLAGS -Winteger-division -Wintrinsics-std -Wreal-q-constant" - H5_FCFLAGS="$H5_FCFLAGS -Wuse-without-only -Wrealloc-lhs -Wrealloc-lhs-all" + # gfortran 4.3 (nothing new) + + # gfortran 4.4 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 4; then + H5_FCFLAGS="$H5_FCFLAGS -Warray-temporaries -Wintrinsics-std" + fi + + # gfortran 4.5 (nothing new) + + # gfortran 4.6 (nothing new) + + # gfortran 4.7 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 7; then + H5_FCFLAGS="$H5_FCFLAGS -Wreal-q-constant -Wfunction-elimination" + fi + + # gfortran 4.8 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -Wrealloc-lhs -Wrealloc-lhs-all" + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + fi + + # gfortran 4.9 (nothing new) + + # gfortran 5 + if test $f9x_vers_major -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS -Wuse-without-only" + fi + + # gfortran 6 + if test $f9x_vers_major -ge 6; then + H5_FCFLAGS="$H5_FCFLAGS -Winteger-division" fi + # gfortran 7 (nothing new) + + # gfortran 8 + if test $f9x_vers_major -ge 8; then + H5_FCFLAGS="$H5_FCFLAGS -Wfrontend-loop-interchange" + fi + + # gfortran 9 (nothing new) + ################# # Flags are set # ################# -- cgit v0.12 From 7d291d059da6287f769951c4854c566da0b93ce8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 19 Jul 2019 02:48:00 -0500 Subject: Parallel Fortran tests now use the MPI module instead of including mpif.h. --- fortran/testpar/hyper.f90 | 3 ++- fortran/testpar/mdset.f90 | 3 ++- fortran/testpar/ptest.f90 | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 index 22f641d..c07636f 100644 --- a/fortran/testpar/hyper.f90 +++ b/fortran/testpar/hyper.f90 @@ -18,9 +18,10 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) USE HDF5 + USE MPI USE TH5_MISC + IMPLICIT NONE - INCLUDE 'mpif.h' INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O diff --git a/fortran/testpar/mdset.f90 b/fortran/testpar/mdset.f90 index 70d2939..3de61c3 100644 --- a/fortran/testpar/mdset.f90 +++ b/fortran/testpar/mdset.f90 @@ -18,9 +18,10 @@ SUBROUTINE multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) USE HDF5 + USE MPI USE TH5_MISC + IMPLICIT NONE - INCLUDE 'mpif.h' INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O diff --git a/fortran/testpar/ptest.f90 b/fortran/testpar/ptest.f90 index 14ac3b2..3b07f21 100644 --- a/fortran/testpar/ptest.f90 +++ b/fortran/testpar/ptest.f90 @@ -16,7 +16,7 @@ ! PROGRAM parallel_test - USE hdf5 + USE HDF5 USE MPI USE TH5_MISC -- cgit v0.12 From 19327521770a5a61ecb7cf62415b37ce1f82328c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 21 Jul 2019 14:19:23 -0500 Subject: HDFFV-10845 Windows drive can only goto Z --- test/links.c | 1896 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 950 insertions(+), 946 deletions(-) diff --git a/test/links.c b/test/links.c index 2658101..69ec665 100644 --- a/test/links.c +++ b/test/links.c @@ -15,28 +15,28 @@ * Programmer: Robb Matzke * Friday, April 10, 1998 * - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ /* * This file needs to access private information from the H5FD package. * This file also needs to access the file driver testing code. */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ #define H5FD_TESTING /* * This file needs to access private information from the H5G package. * This file also needs to access the group testing code. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" #include "H5srcdir.h" #include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ @@ -62,55 +62,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ TMPDIR "extlinks10",/* 30: */ TMPDIR "extlinks11",/* 31: */ TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ + "extlinks13", /* 33: */ TMPDIR "extlinks13",/* 34: */ TMPDIR "extlinks14",/* 35: */ TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ TMPDIR2 "extlinks21B",/* 46: */ TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ TMPDIR "extlinks21D",/* 49: */ TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -318,7 +318,7 @@ typedef struct { static hid_t dcpl_g; /* for [un]minimized dataset object headers */ - + /*------------------------------------------------------------------------- * Function: fix_ext_filename * @@ -340,17 +340,17 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) HDstrcat(path_name, file_name); } - + /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * - * Purpose: Build a file with assorted links. + * Purpose: Build a file with assorted links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -360,9 +360,9 @@ fix_ext_filename(char *path_name, char *cwd, const char *file_name) static int mklinks(hid_t fapl, hbool_t new_format) { - hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hid_t file, scalar, grp, d1; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -405,7 +405,7 @@ mklinks(hid_t fapl, hbool_t new_format) return -1; } - + /*------------------------------------------------------------------------- * Function: new_links * @@ -425,11 +425,11 @@ mklinks(hid_t fapl, hbool_t new_format) static int new_links(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); - hid_t scalar=(-1); - hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; + hid_t file_a, file_b=(-1); + hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); + hid_t scalar=(-1); + hid_t dset1=(-1), dset2=(-1); + char filename[NAME_BUF_SIZE]; hsize_t size[1] = {1}; if(new_format) @@ -492,31 +492,31 @@ new_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Sclose(scalar); - H5Dclose(dset1); - H5Dclose(dset2); - H5Gclose(grp1_a); - H5Gclose(grp2_a); - H5Gclose(grp1_b); - H5Gclose(grp2_b); - H5Fclose(file_a); - H5Fclose(file_b); + H5Sclose(scalar); + H5Dclose(dset1); + H5Dclose(dset2); + H5Gclose(grp1_a); + H5Gclose(grp2_a); + H5Gclose(grp1_b); + H5Gclose(grp2_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * - * Purpose: Open the file created in the first step and check that the - * links look correct. + * Purpose: Open the file created in the first step and check that the + * links look correct. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * * Modifications: @@ -526,12 +526,12 @@ new_links(hid_t fapl, hbool_t new_format) static int cklinks(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + hid_t file; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +546,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -565,91 +565,91 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ H5E_BEGIN_TRY { status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -665,7 +665,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: ck_new_links * @@ -684,9 +684,9 @@ error: static int ck_new_links(hid_t fapl, hbool_t new_format) { - hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + hid_t file; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -699,23 +699,23 @@ ck_new_links(hid_t fapl, hbool_t new_format) /* Get hard link info */ if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ @@ -728,7 +728,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: long_links * @@ -748,12 +748,12 @@ error: static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ char *objname = NULL; /* Name of object [Long] */ size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -796,15 +796,15 @@ long_links(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; HDfree(objname); return -1; } - + /*------------------------------------------------------------------------- * Function: toomany * @@ -824,10 +824,10 @@ long_links(hid_t fapl, hbool_t new_format) static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +917,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -944,14 +944,14 @@ toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end toomany() */ - + /*------------------------------------------------------------------------- * Function: test_lcpl * @@ -1111,7 +1111,7 @@ error: return 1; } /* end test_lcpl() */ - + /*------------------------------------------------------------------------- * Function: test_move * @@ -1131,9 +1131,9 @@ error: static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1155,9 +1155,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1188,11 +1188,11 @@ test_move(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if( H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1201,38 +1201,38 @@ test_move(hid_t fapl, hbool_t new_format) moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1261,17 +1261,17 @@ test_move(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_copy * @@ -1291,9 +1291,9 @@ test_move(hid_t fapl, hbool_t new_format) static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; if(new_format) TESTING("H5Lcopy (w/new group format)") @@ -1315,9 +1315,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create hard, soft and external links. */ if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -1348,75 +1348,75 @@ test_copy(hid_t fapl, hbool_t new_format) /* Move a group across groups in the same file while renaming it. */ if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group. */ if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group . */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Gclose(moved_grp) < 0) TEST_ERROR @@ -1432,17 +1432,17 @@ test_copy(hid_t fapl, hbool_t new_format) error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_move_preserves * @@ -1608,16 +1608,16 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_move_preserves() */ - + /*------------------------------------------------------------------------- * Function: test_deprec * @@ -1640,7 +1640,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1768,7 +1768,7 @@ error: } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: external_link_root * @@ -1788,14 +1788,14 @@ error: static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t linfo; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - const char *file; /* File from external link */ - const char *path; /* Path from external link */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + const char *file; /* File from external link */ + const char *path; /* Path from external link */ if(new_format) TESTING("external link to root (w/new group format)") @@ -1824,21 +1824,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,21 +1848,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ @@ -1945,14 +1945,14 @@ external_link_root(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_root() */ - + /*------------------------------------------------------------------------- * Function: external_link_path * @@ -1973,11 +1973,11 @@ external_link_root(hid_t fapl, hbool_t new_format) static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2053,14 +2053,14 @@ external_link_path(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_path() */ - + /*------------------------------------------------------------------------- * Function: external_link_mult * @@ -2081,13 +2081,13 @@ external_link_path(hid_t fapl, hbool_t new_format) static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1), fid2 = (-1); /* File IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2217,14 +2217,14 @@ external_link_mult(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_mult() */ - + /*------------------------------------------------------------------------- * Function: external_link_self * @@ -2244,13 +2244,13 @@ external_link_mult(hid_t fapl, hbool_t new_format) static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t lcpl_id = (-1); /* Link Creation Property List ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2365,15 +2365,15 @@ external_link_self(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(lcpl_id); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(lcpl_id); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_self() */ - + /*------------------------------------------------------------------------- * Function: external_link_pingpong * @@ -2401,11 +2401,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2488,14 +2488,14 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_pingpong() */ - + /*------------------------------------------------------------------------- * Function: external_link_toomany * @@ -2536,11 +2536,11 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2603,9 +2603,9 @@ external_link_toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2632,14 +2632,14 @@ external_link_toomany(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid2); - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid2); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_toomany() */ - + /*------------------------------------------------------------------------- * Function: external_link_dangling * @@ -2660,12 +2660,12 @@ external_link_toomany(hid_t fapl, hbool_t new_format) static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t rid = (-1); /* Root Group ID */ hid_t status = (-1); /* Status */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("dangling external links (w/new group format)") @@ -2704,9 +2704,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2714,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2740,22 +2740,22 @@ external_link_dangling(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_dangling() */ - + /*------------------------------------------------------------------------- * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 @@ -2771,12 +2771,12 @@ external_link_dangling(hid_t fapl, hbool_t new_format) static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + hid_t gapl_id = (-1); + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2790,7 +2790,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* create tmp directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR /* set up name for target file: "tmp/extlinks2" */ h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); @@ -2821,9 +2821,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2835,20 +2835,20 @@ external_link_prefix(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_prefix() */ - + /*------------------------------------------------------------------------- * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 @@ -2863,13 +2863,13 @@ external_link_prefix(hid_t fapl, hbool_t new_format) static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's absolute path (w/new group format)") @@ -2887,7 +2887,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Window: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -2915,9 +2915,9 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2929,20 +2929,20 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abs_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_rel_mainpath: test 4 * - * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * Purpose: 1. target link: "extlinks4" + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 @@ -2957,11 +2957,11 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + relative path(w/new group format)") @@ -3001,9 +3001,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3015,19 +3015,19 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_rel_mainpath() */ - + /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * * Return: Success: 0 @@ -3043,11 +3043,11 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; @@ -3065,7 +3065,7 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3093,9 +3093,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3107,21 +3107,21 @@ external_link_cwd(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_cwd() */ - + /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 @@ -3136,12 +3136,12 @@ external_link_cwd(hid_t fapl, hbool_t new_format) static int external_link_abstar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -3159,7 +3159,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" + * Windows: ":/CWD/tmp/extlinks6" */ fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3189,9 +3189,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3203,8 +3203,8 @@ external_link_abstar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar() */ @@ -3213,9 +3213,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 @@ -3230,13 +3230,13 @@ external_link_abstar(hid_t fapl, hbool_t new_format) static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD (w/new group format)") @@ -3256,7 +3256,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3283,9 +3283,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3297,20 +3297,20 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_abstar_cur() */ - + /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 @@ -3325,10 +3325,10 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's CWD + target's relative path(w/new group format)") @@ -3363,9 +3363,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3377,22 +3377,22 @@ external_link_reltar(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_reltar() */ - + /*------------------------------------------------------------------------- * Function: external_link_chdir: test 9 * * Purpose: - * 1. target link: "extlinks9" - * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" - * Should be able to access the target file in current working directory + * 1. target link: "extlinks9" + * 2. main file: "extlinks0" + * 3. target file" "tmp/extlinks9" + * 3. chdir "tmp" + * Should be able to access the target file in current working directory * * Return: Success: 0 * Failure: -1 @@ -3407,11 +3407,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format) static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via chdir and found in current working directory (w/new group format)") @@ -3460,9 +3460,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3474,28 +3474,28 @@ external_link_chdir(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_chdir() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. - * - * 1. target link: "extlinks16" - * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file A to be a "family" file: extlinks16A - * 4. Create target file B to be a "multi" file: extlinks16B - * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A - * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B - * 6. Should succeed in opening the target object: ext_extA - * 6. Should succeed in opening the target object: ext_extB + * different from the parent can be successfully opened. + * + * 1. target link: "extlinks16" + * 2. target file: "extlinks16" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file A to be a "family" file: extlinks16A + * 4. Create target file B to be a "multi" file: extlinks16B + * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A + * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B + * 6. Should succeed in opening the target object: ext_extA + * 6. Should succeed in opening the target object: ext_extB * * Return: Success: 0 * Failure: -1 @@ -3510,22 +3510,22 @@ external_link_chdir(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl1(hid_t fapl, hbool_t new_format) { - hid_t fid=(-1); - hid_t fidA=(-1), fidB=(-1); - hid_t gidA=(-1), gidB=(-1); - hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid=(-1); + hid_t fidA=(-1), fidB=(-1); + hid_t gidA=(-1), gidB=(-1); + hid_t oidA=(-1), oidB=(-1); + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; - hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; + hid_t fam_fapl=-1, multi_fapl=-1; + hid_t lapl_idA=-1, lapl_idB=-1; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,11 +3533,11 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3560,8 +3560,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3621,10 +3621,10 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* Create external link to target file A:/A */ if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Create external link to target file B:/B */ if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3635,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3649,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3668,38 +3668,38 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl1() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. - * - * 1. target link: "extlinks17" - * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. + * + * 1. target link: "extlinks17" + * 2. target file: "extlinks17" + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 6. Should succeed in opening the target dataset: ext_link + * 7. Write data to the target dataset + * 8. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 @@ -3714,17 +3714,17 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; hsize_t dims[2]; - int points[NUM40][NUM40]; - h5_stat_size_t filesize, new_filesize; - int i, j, n; + int points[NUM40][NUM40]; + h5_stat_size_t filesize, new_filesize; + int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3736,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3769,7 +3769,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* create "Dataset" in group "A" of target file */ if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3829,39 +3829,39 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_set_elink_fapl2() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl - * 10. Verify that the copied link access's fapl is the core driver - * 11. Get the fapl property value of the copied link access - * 12. H5Premove() the fapl property from the copied link access - * 13. H5Pclose() fapl set in the copied link access should fail since the - * removal in #12 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * 10. Verify that the copied link access's fapl is the core driver + * 11. Get the fapl property value of the copied link access + * 12. H5Premove() the fapl property from the copied link access + * 13. H5Pclose() fapl set in the copied link access should fail since the + * removal in #12 should also close its fapl * * Return: Success: 0 * Failure: -1 @@ -3877,7 +3877,7 @@ static int external_set_elink_fapl3(hbool_t new_format) { hid_t core_fapl = -1, stdio_fapl = -1; - hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; + hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) TESTING("H5Pset/get_fapl() (w/new group format)") @@ -3945,7 +3945,7 @@ external_set_elink_fapl3(hbool_t new_format) return -1; } /* end external_set_elink_fapl3() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_acc_flags * @@ -4166,7 +4166,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo return -1; } /* end external_set_elink_acc_flags() */ - + /*------------------------------------------------------------------------- * Function: external_set_elink_cb * @@ -4242,7 +4242,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) op_data.target_file = filename2; /* Core file driver has issues when used as the member file driver for a family file */ /* Family file driver cannot be used with family or multi drivers for member files */ - /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) + /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI) would report FALSE, causing problems */ base_driver = H5Pget_driver(fapl); op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI @@ -4333,7 +4333,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) return -1; } /* end external_set_elink_cb() */ - + /*------------------------------------------------------------------------- * Function: external_reset_register * @@ -4394,17 +4394,17 @@ external_reset_register(void) return -1; } /* end external_reset_register() */ - + #ifdef H5_HAVE_WINDOW_PATH /*------------------------------------------------------------------------- * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" - * 2. main file: "extlinks0" - * 3. target file: "extlinks10" - * Should be able to find the target file via main file's current drive/rel path + * 1. target link: "/CWD/tmp/extlinks10" + * 2. main file: "extlinks0" + * 3. target file: "extlinks10" + * Should be able to find the target file via main file's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4419,12 +4419,12 @@ external_reset_register(void) static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -4469,9 +4469,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4483,21 +4483,21 @@ external_link_win1(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win1() */ - + /*------------------------------------------------------------------------- * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 1. target link: "/CWD/tmp/extlinks11" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -4512,12 +4512,12 @@ external_link_win1(hid_t fapl, hbool_t new_format) static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -4563,9 +4563,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4577,21 +4577,21 @@ external_link_win2(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win2() */ - + /*------------------------------------------------------------------------- * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 1. target link: ":tmp/extlinks12" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 @@ -4606,13 +4606,13 @@ external_link_win2(hid_t fapl, hbool_t new_format) static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4656,9 +4656,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4670,20 +4670,20 @@ external_link_win3(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win3() */ - + /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * 1. target link: ":extlinks13" + * 2. main file: ":tmp/extlinks0" + * 3. target file: tmp/extlinks13 + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4698,13 +4698,13 @@ external_link_win3(hid_t fapl, hbool_t new_format) static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4745,9 +4745,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4759,21 +4759,21 @@ external_link_win4(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win4() */ - + /*------------------------------------------------------------------------- * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 1. target link: ":tmp/extlinks14" + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 @@ -4788,13 +4788,13 @@ external_link_win4(hid_t fapl, hbool_t new_format) static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], cwdpath[NAME_BUF_SIZE]; if(new_format) @@ -4813,6 +4813,8 @@ external_link_win5(hid_t fapl, hbool_t new_format) h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks14" */ + if (drive >= 26) + drive -= 2; /* account for drive Z HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4841,9 +4843,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,21 +4857,21 @@ external_link_win5(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win5() */ - + /*------------------------------------------------------------------------- * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 1. target link: ":tmp/extlinks15" + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4884,13 +4886,13 @@ external_link_win5(hid_t fapl, hbool_t new_format) static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4901,6 +4903,8 @@ external_link_win6(hid_t fapl, hbool_t new_format) if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR drive = HDgetdrive(); + if (drive >= 26) + drive -= 2; /* account for drive Z /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); @@ -4934,9 +4938,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4948,13 +4952,13 @@ external_link_win6(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_win6() */ - + /*------------------------------------------------------------------------- * Function: external_link_win7 * @@ -5041,7 +5045,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win7() */ - + /*------------------------------------------------------------------------- * Function: external_link_win8 * @@ -5133,7 +5137,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) return -1; } /* end external_link_win8() */ - + /*------------------------------------------------------------------------- * Function: external_link_win9 * @@ -5222,7 +5226,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_WINDOW_PATH */ - + /*------------------------------------------------------------------------- * Function: external_link_recursive * @@ -5241,9 +5245,9 @@ external_link_win9(hid_t fapl, hbool_t new_format) static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5271,9 +5275,9 @@ external_link_recursive(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ @@ -5285,13 +5289,13 @@ external_link_recursive(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_recursive() */ - + /*------------------------------------------------------------------------- * Function: external_link_query * @@ -5311,14 +5315,14 @@ external_link_recursive(hid_t fapl, hbool_t new_format) static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5341,9 +5345,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ @@ -5367,9 +5371,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5385,9 +5389,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5415,13 +5419,13 @@ external_link_query(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_query() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_compact * @@ -5438,10 +5442,10 @@ error: static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("unlinking external link in compact group (w/new group format)") @@ -5500,14 +5504,14 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_compact() */ - + /*------------------------------------------------------------------------- * Function: external_link_unlink_dense * @@ -5524,13 +5528,13 @@ error: static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -5646,14 +5650,14 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_unlink_dense() */ - + /*------------------------------------------------------------------------- * Function: external_link_move * @@ -5670,11 +5674,11 @@ error: static int external_link_move(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5837,14 +5841,14 @@ external_link_move(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_move() */ - + /*------------------------------------------------------------------------- * Function: external_link_ride * @@ -5862,13 +5866,13 @@ error: static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ - unsigned nmsgs; /* Number of messages in group's header */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + unsigned nmsgs; /* Number of messages in group's header */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ unsigned u; /* Local index variable */ @@ -6023,14 +6027,14 @@ external_link_ride(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { H5Pclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end external_link_ride() */ - + /*------------------------------------------------------------------------- * Function: external_link_closing * @@ -6052,11 +6056,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6263,7 +6267,7 @@ error: return -1; } /* external_link_closing() */ - + /*------------------------------------------------------------------------- * Function: ext_link_endian * @@ -6282,8 +6286,8 @@ error: static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t lapl_id = (-1); /* Prop List ID */ const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; @@ -6331,14 +6335,14 @@ external_link_endian(hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } - + /*------------------------------------------------------------------------- * Function: external_link_strong * @@ -6360,7 +6364,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6423,7 +6427,7 @@ error: return -1; } /* end external_link_strong() */ - + /*------------------------------------------------------------------------- * Function: external_symlink * @@ -6444,17 +6448,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6612,8 +6616,8 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ return 0; @@ -6639,7 +6643,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ - + /*------------------------------------------------------------------------- * Function: external_copy_invalid_object * @@ -6712,7 +6716,7 @@ error: return -1; } /* end external_copy_invalid_object */ - + /*------------------------------------------------------------------------- * Function: external_dont_fail_to_source * @@ -6776,7 +6780,7 @@ error: return -1; } /* end external_dont_fail_to_source */ - + /*------------------------------------------------------------------------- * Function: external_file_cache * @@ -7169,7 +7173,7 @@ error: return -1; } /* end external_file_cache */ - + /*------------------------------------------------------------------------- * Function: external_open_twice * @@ -7405,7 +7409,7 @@ error: return -1; } /* end external_open_twice() */ - + /*------------------------------------------------------------------------- * Function: external_link_with_committed_datatype * @@ -7428,24 +7432,24 @@ error: static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { - hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ - char filename1[NAME_BUF_SIZE]; /* File name for main file */ - char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ + char filename1[NAME_BUF_SIZE]; /* File name for main file */ + char filename2[NAME_BUF_SIZE]; /* File name for target file */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7530,8 +7534,8 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ @@ -7677,13 +7681,13 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY return -1; } /* end external_link_with_committed_datatype() */ - + /*------------------------------------------------------------------------- * Function: ud_hard_links * @@ -7873,12 +7877,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7950,9 +7954,9 @@ ud_hard_links(hid_t fapl) /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be @@ -7983,14 +7987,14 @@ ud_hard_links(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_hard_links() */ - + /*------------------------------------------------------------------------- * Function: UD_rereg_traverse * @@ -8040,11 +8044,11 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + H5L_info_t li; /* Link information */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") @@ -8169,14 +8173,14 @@ ud_link_reregister(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end ud_link_reregister() */ - + /*------------------------------------------------------------------------- * Function: ud_callbacks * @@ -8313,12 +8317,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t lcpl = (-1); /* Link Creation PL */ H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8426,14 +8430,14 @@ ud_callbacks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (lcpl); - H5Gclose (gid); - H5Fclose (fid); + H5Pclose (lcpl); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_callbacks() */ - + /*------------------------------------------------------------------------- * Function: lapl_udata * @@ -8485,12 +8489,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8565,15 +8569,15 @@ lapl_udata(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose (plist_id); - H5Gclose (gid); - H5Gclose (gid2); - H5Fclose (fid); + H5Pclose (plist_id); + H5Gclose (gid); + H5Gclose (gid2); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end lapl_udata() */ - + /*------------------------------------------------------------------------- * Function: ud_link_errors * @@ -8783,10 +8787,10 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; H5L_info_t li; /* Link information */ @@ -8900,13 +8904,13 @@ ud_link_errors(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end ud_link_errors() */ - + /*------------------------------------------------------------------------- * Function: lapl_nlinks * @@ -8927,15 +8931,15 @@ error: static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t plist = (-1); /* lapl ID */ hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -9129,21 +9133,21 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Pclose(gapl); - H5Pclose(dapl); - H5Pclose(tapl); - H5Dclose(did); - H5Sclose(sid); - H5Tclose(tid); - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(plist); - H5Fclose(fid); + H5Pclose(gapl); + H5Pclose(dapl); + H5Pclose(tapl); + H5Dclose(did); + H5Sclose(sid); + H5Tclose(tid); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(plist); + H5Fclose(fid); } H5E_END_TRY; return -1; } /* end lapl_nlinks() */ - + /*------------------------------------------------------------------------- * Function: linkinfo * @@ -9160,12 +9164,12 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ hid_t tid = (-1); /* Type ID */ hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9222,15 +9226,15 @@ linkinfo(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Tclose (tid); - H5Dclose (did); - H5Gclose (gid); - H5Fclose (fid); + H5Tclose (tid); + H5Dclose (did); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end linkinfo() */ - + /*------------------------------------------------------------------------- * Function: check_all_closed * @@ -9285,7 +9289,7 @@ error: } /* end check_all_closed() */ - + /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9385,7 +9389,7 @@ error: return -1; } /* end build_visit_file() */ - + /*------------------------------------------------------------------------- * Function: visit_link_cb * @@ -9415,7 +9419,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t return(H5_ITER_CONT); } /* end visit_link_cb() */ - + /*------------------------------------------------------------------------- * Function: link_visit * @@ -9485,7 +9489,7 @@ error: return -1; } /* end link_visit() */ - + /*------------------------------------------------------------------------- * Function: link_visit_by_name * @@ -9563,7 +9567,7 @@ error: return -1; } /* end link_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_cb * @@ -9593,7 +9597,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit * @@ -9663,7 +9667,7 @@ error: return -1; } /* end obj_visit() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_by_name * @@ -9742,7 +9746,7 @@ error: return -1; } /* end obj_visit_by_name() */ - + /*------------------------------------------------------------------------- * Function: visit_obj_stop_cb * @@ -9767,7 +9771,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name return(H5_ITER_STOP); } /* end visit_obj_stop_cb() */ - + /*------------------------------------------------------------------------- * Function: obj_visit_stop * @@ -9826,7 +9830,7 @@ error: return -1; } /* end obj_visit_stop() */ - + /*------------------------------------------------------------------------- * Function: link_filters * @@ -9918,7 +9922,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -10206,7 +10210,7 @@ error: return -1; } /* end link_filters() */ - + /*------------------------------------------------------------------------- * Function: obj_exists * @@ -10494,7 +10498,7 @@ error: return -1; } /* end obj_exists() */ - + /*------------------------------------------------------------------------- * Function: corder_create_empty * @@ -10511,10 +10515,10 @@ error: static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10536,9 +10540,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10601,7 +10605,7 @@ error: return -1; } /* end corder_create_empty() */ - + /*------------------------------------------------------------------------- * Function: corder_create_compact * @@ -10619,12 +10623,12 @@ error: static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10719,7 +10723,7 @@ error: return -1; } /* end corder_create_compact() */ - + /*------------------------------------------------------------------------- * Function: corder_create_dense * @@ -10737,12 +10741,12 @@ error: static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10852,7 +10856,7 @@ error: return -1; } /* end corder_create_dense() */ - + /*------------------------------------------------------------------------- * Function: corder_transition * @@ -10870,12 +10874,12 @@ error: static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ h5_stat_size_t empty_size; /* Size of empty file */ @@ -11081,7 +11085,7 @@ error: return -1; } /* end corder_transition() */ - + /*------------------------------------------------------------------------- * Function: corder_delete * @@ -11100,9 +11104,9 @@ error: static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ @@ -11122,7 +11126,7 @@ corder_delete(hid_t fapl) /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - /* Creating file with latest format will enable paged aggregation with persistent fs */ + /* Creating file with latest format will enable paged aggregation with persistent fs */ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Close file */ @@ -11210,14 +11214,14 @@ error: return -1; } /* end corder_delete() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_check * * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 @@ -11369,7 +11373,7 @@ error: return(-1); } /* end link_info_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx * @@ -11387,9 +11391,9 @@ error: static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11453,7 +11457,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11495,7 +11499,7 @@ link_info_by_idx(hid_t fapl) /* Check for creating hard or soft link */ if(hard_link) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -11554,7 +11558,7 @@ error: return -1; } /* end link_info_by_idx() */ - + /*------------------------------------------------------------------------- * Function: link_info_by_idx_old * @@ -11572,8 +11576,8 @@ error: static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11721,7 +11725,7 @@ error: return -1; } /* end link_info_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx * @@ -11739,9 +11743,9 @@ error: static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -11824,7 +11828,7 @@ delete_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11879,7 +11883,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -11946,7 +11950,7 @@ delete_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12047,7 +12051,7 @@ error: return -1; } /* end delete_by_idx() */ - + /*------------------------------------------------------------------------- * Function: delete_by_idx_old * @@ -12065,8 +12069,8 @@ error: static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12272,7 +12276,7 @@ error: return -1; } /* end delete_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_cb * @@ -12349,7 +12353,7 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_cb * @@ -12371,7 +12375,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_fail_cb * @@ -12393,7 +12397,7 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l return(H5_ITER_ERROR); } /* end link_iterate_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_check * @@ -12554,7 +12558,7 @@ error: return(-1); } /* end link_iterate_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate * @@ -12572,9 +12576,9 @@ error: static int link_iterate(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -12666,7 +12670,7 @@ link_iterate(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12692,7 +12696,7 @@ link_iterate(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -12750,7 +12754,7 @@ error: return -1; } /* end link_iterate() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_cb * @@ -12821,7 +12825,7 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /*------------------------------------------------------------------------- * Function: group_iterate_old_cb * @@ -12843,7 +12847,7 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old_check * @@ -13018,7 +13022,7 @@ error: return(-1); } /* end link_iterate_old_check() */ - + /*------------------------------------------------------------------------- * Function: link_iterate_old * @@ -13035,8 +13039,8 @@ error: static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13079,7 +13083,7 @@ link_iterate_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13139,7 +13143,7 @@ error: return -1; } /* end link_iterate_old() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_check * @@ -13238,7 +13242,7 @@ error: return(-1); } /* end open_by_idx_check() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx * @@ -13256,11 +13260,11 @@ error: static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -13360,7 +13364,7 @@ open_by_idx(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13395,7 +13399,7 @@ open_by_idx(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13468,7 +13472,7 @@ error: return -1; } /* end open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: open_by_idx_old * @@ -13486,10 +13490,10 @@ error: static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t mount_file_id = (-1); /* File ID for file to mount */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13537,7 +13541,7 @@ open_by_idx_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -13603,7 +13607,7 @@ error: return -1; } /* end open_by_idx_old() */ - + /*------------------------------------------------------------------------- * Function: object_info_check * @@ -13674,7 +13678,7 @@ error: return(-1); } /* end object_info_check() */ - + /*------------------------------------------------------------------------- * Function: object_info * @@ -13692,10 +13696,10 @@ error: static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ @@ -13795,7 +13799,7 @@ object_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13843,7 +13847,7 @@ object_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -13925,7 +13929,7 @@ error: return -1; } /* end object_info() */ - + /*------------------------------------------------------------------------- * Function: object_info_old * @@ -13942,9 +13946,9 @@ error: static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ hid_t space_id = (-1); /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ @@ -13992,7 +13996,7 @@ object_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2; /* Group ID */ + hid_t group_id2; /* Group ID */ hid_t attr_id; /* Attribute ID */ /* Make name for link */ @@ -14071,7 +14075,7 @@ error: return -1; } /* end object_info_old() */ - + /*------------------------------------------------------------------------- * Function: group_info * @@ -14089,10 +14093,10 @@ error: static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ @@ -14184,7 +14188,7 @@ group_info(hid_t fapl) /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14325,7 +14329,7 @@ group_info(hid_t fapl) /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14493,7 +14497,7 @@ error: return -1; } /* end group_info() */ - + /*------------------------------------------------------------------------- * Function: group_info_old * @@ -14511,9 +14515,9 @@ error: static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t soft_group_id = (-1); /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -14555,7 +14559,7 @@ group_info_old(hid_t fapl) /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { - hid_t group_id2, group_id3; /* Group IDs */ + hid_t group_id2, group_id3; /* Group IDs */ /* Make name for link */ HDsnprintf(objname, sizeof(objname), "filler %02u", u); @@ -14723,7 +14727,7 @@ error: return -1; } /* end group_info_old() */ - + /*------------------------------------------------------------------------- * Function: timestamps * @@ -14741,11 +14745,11 @@ error: static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = (-1); /* File ID */ + hid_t group_id = (-1); /* Group ID */ + hid_t group_id2 = (-1); /* Group ID */ + hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t gcpl_id2 = (-1); /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14886,17 +14890,17 @@ error: return -1; } /* end timestamps() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test links + * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) + * Return: Success: exit(EXIT_SUCCESS) * - * Failure: exit(EXIT_FAILURE) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 14, 1998 * *------------------------------------------------------------------------- @@ -14904,8 +14908,8 @@ error: int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property lists */ + int nerrors = 0; unsigned new_format; /* Whether to use the new format or not */ unsigned minimize_dset_oh; unsigned efc; /* Whether to use the external file cache */ @@ -15035,7 +15039,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, -- cgit v0.12 From 9877da0a6f8ec843926f11468c39121b81b40402 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 21 Jul 2019 16:46:47 -0500 Subject: HDFFV-10845 fix comment syntax --- test/links.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/links.c b/test/links.c index 69ec665..594e77e 100644 --- a/test/links.c +++ b/test/links.c @@ -4814,7 +4814,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* set up name for target link: ":tmp/extlinks14" */ if (drive >= 26) - drive -= 2; /* account for drive Z + drive -= 2; /* account for drive Z */ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4904,7 +4904,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) TEST_ERROR drive = HDgetdrive(); if (drive >= 26) - drive -= 2; /* account for drive Z + drive -= 2; /* account for drive Z */ /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); -- cgit v0.12 From 64733980e5f595ab6e267405284a4461261644ea Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 22 Jul 2019 14:23:05 -0500 Subject: HDFFV-10845 Allow mingw to find functionality --- config/cmake/ConfigureChecks.cmake | 2 +- config/cmake_ext_mod/ConfigureChecks.cmake | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index c1abeed..3bd0553 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -102,7 +102,7 @@ endif () CHECK_FUNCTION_EXISTS (difftime ${HDF_PREFIX}_HAVE_DIFFTIME) # Find the library containing clock_gettime() -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (clock_gettime CLOCK_GETTIME_IN_LIBC) CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 8b68a9f..abc88ed 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -92,16 +92,16 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) + set (${HDF_PREFIX}_HAVE_FUNCTION 1) endif () if (NOT UNIX AND NOT CYGWIN) set (${HDF_PREFIX}_HAVE_GETCONSOLESCREENBUFFERINFO 1) + set (${HDF_PREFIX}_GETTIMEOFDAY_GIVES_TZ 1) + set (${HDF_PREFIX}_HAVE_TIMEZONE 1) + set (${HDF_PREFIX}_HAVE_GETTIMEOFDAY 1) + set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) + set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) 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) - set (${HDF_PREFIX}_HAVE_LIBWS2_32 1) - set (${HDF_PREFIX}_HAVE_LIBWSOCK32 1) endif () # ---------------------------------------------------------------------- @@ -187,7 +187,7 @@ endif () #----------------------------------------------------------------------------- # Check for the math library "m" #----------------------------------------------------------------------------- -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) CHECK_LIBRARY_EXISTS_CONCAT ("m" ceil ${HDF_PREFIX}_HAVE_LIBM) CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen ${HDF_PREFIX}_HAVE_LIBDL) CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup ${HDF_PREFIX}_HAVE_LIBWS2_32) @@ -263,7 +263,7 @@ set (LINUX_LFS 0) set (HDF_EXTRA_C_FLAGS) set (HDF_EXTRA_FLAGS) -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) # Might want to check explicitly for Linux and possibly Cygwin # instead of checking for not Solaris or Darwin. if (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN) @@ -323,7 +323,7 @@ endif () #----------------------------------------------------------------------------- # Check for HAVE_OFF64_T functionality #----------------------------------------------------------------------------- -if (NOT WINDOWS OR MINGW) +if (MINGW OR NOT WINDOWS) HDF_FUNCTION_TEST (HAVE_OFF64_T) if (${HDF_PREFIX}_HAVE_OFF64_T) CHECK_FUNCTION_EXISTS (lseek64 ${HDF_PREFIX}_HAVE_LSEEK64) @@ -402,7 +402,7 @@ if (NOT APPLE) if (NOT ${HDF_PREFIX}_SIZEOF_SSIZE_T) set (${HDF_PREFIX}_SIZEOF_SSIZE_T 0) endif () - if (NOT WINDOWS) + if (MINGW OR NOT WINDOWS) HDF_CHECK_TYPE_SIZE (ptrdiff_t ${HDF_PREFIX}_SIZEOF_PTRDIFF_T) endif () endif () @@ -426,7 +426,7 @@ else () HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL) endif () -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) #----------------------------------------------------------------------------- # Check if the dev_t type is a scalar type #----------------------------------------------------------------------------- @@ -534,7 +534,7 @@ CHECK_FUNCTION_EXISTS (vasprintf ${HDF_PREFIX}_HAVE_VASPRINTF) CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) CHECK_FUNCTION_EXISTS (vsnprintf ${HDF_PREFIX}_HAVE_VSNPRINTF) -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) if (${HDF_PREFIX}_HAVE_VSNPRINTF) HDF_FUNCTION_TEST (VSNPRINTF_WORKS) endif () @@ -555,7 +555,7 @@ endif () #----------------------------------------------------------------------------- # Check a bunch of other functions #----------------------------------------------------------------------------- -if (NOT WINDOWS) +if (MINGW OR NOT WINDOWS) foreach (other_test HAVE_ATTRIBUTE HAVE_C99_FUNC -- cgit v0.12 From fbc06ff9b8e12f542814d6e5dc08c19680a5429d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 22 Jul 2019 16:23:38 -0500 Subject: Use generator expr to get correct name --- java/examples/datasets/CMakeLists.txt | 56 ++++++++++++------------------- java/examples/datatypes/CMakeLists.txt | 53 +++++++++++------------------ java/examples/groups/CMakeLists.txt | 61 ++++++++++++---------------------- java/examples/intro/CMakeLists.txt | 55 ++++++++++++------------------ java/test/CMakeLists.txt | 6 ++-- 5 files changed, 86 insertions(+), 145 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 83343fc..c64e02e 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -71,61 +71,47 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -macro (ADD_H5_TEST resultfile resultcode) +if (BUILD_TESTING) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") - add_test ( - NAME JAVA_datasets-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_PROGRAM=examples.datasets.${resultfile}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=datasets/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=datasets/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_datasets-${resultfile}") -endmacro () + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") -if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) if (example STREQUAL "H5Ex_D_External") add_test ( NAME JAVA_datasets-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data ) else () add_test ( NAME JAVA_datasets-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (last_test) - set_tests_properties (JAVA_datasets-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_datasets-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt ${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clear-objects) - set (last_test "JAVA_datasets-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + add_test ( + NAME JAVA_datasets-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_PROGRAM=examples.datasets.${example}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datasets/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=datasets/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_datasets-${example} PROPERTIES DEPENDS JAVA_datasets-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 701fe2a..70648e4 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -56,50 +56,37 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -MACRO (ADD_H5_TEST resultfile resultcode) +if (BUILD_TESTING) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") - add_test ( - NAME JAVA_datatypes-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.datatypes.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=datatypes/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=datatypes/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_datatypes-${resultfile}") -ENDMACRO () + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") -if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( NAME JAVA_datatypes-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (last_test) - set_tests_properties (JAVA_datatypes-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_datatypes-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt ${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clear-objects) - set (last_test "JAVA_datatypes-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + add_test ( + NAME JAVA_datatypes-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.datatypes.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datatypes/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=datatypes/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_datatypes-${example} PROPERTIES DEPENDS JAVA_datatypes-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index f0693ba..e1ad108 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -55,65 +55,48 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES}) endforeach () add_custom_target(H5Ex_G_Visit_files ALL COMMENT "Copying files needed by H5Ex_G_Visit tests" DEPENDS ${H5Ex_G_Visit_files_list}) -macro (ADD_H5_TEST resultfile resultcode) +if (BUILD_TESTING) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") - add_test ( - NAME JAVA_groups-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.groups.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=groups/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=groups/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${resultfile}") -endmacro () + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") -if (BUILD_TESTING) foreach (example ${HDF_JAVA_EXAMPLES}) if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") if (example STREQUAL "H5Ex_G_Compact") add_test ( NAME JAVA_groups-${example}-clear-h5s - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 ) else () add_test ( NAME JAVA_groups-${example}-clear-h5s - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () - if (last_test) - set_tests_properties (JAVA_groups-${example}-clear-h5s PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${example}-clear-h5s") endif () + add_test ( NAME JAVA_groups-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt ) - if (last_test) - set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_groups-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-h5s) + add_test ( + NAME JAVA_groups-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.groups.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=groups/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=groups/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_groups-${example} PROPERTIES DEPENDS JAVA_groups-${example}-copy-objects) endforeach () endif () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index a4f0cdd..e60af88 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -57,52 +57,39 @@ foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) endforeach () -MACRO (ADD_H5_TEST resultfile resultcode) - get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) - get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) - set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") - add_test ( - NAME JAVA_intro-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" - -D "TEST_PROGRAM=examples.intro.${resultfile}" - -D "TEST_ARGS:STRING=${CMD_ARGS}${ARGN}" - -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" - -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" - -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" - -D "TEST_OUTPUT=intro/${resultfile}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=intro/${resultfile}.txt" - -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" - ) - if (last_test) - set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "JAVA_intro-${resultfile}") -ENDMACRO () - if (BUILD_TESTING) + get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") foreach (example ${HDF_JAVA_EXAMPLES}) add_test ( NAME JAVA_intro-${example}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) - if (last_test) - set_tests_properties (JAVA_intro-${example}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( NAME JAVA_intro-${example}-copy-objects - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt ${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt ) set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clear-objects) - set (last_test "JAVA_intro-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + + add_test ( + NAME JAVA_intro-${example} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.intro.${example}" + -D "TEST_ARGS:STRING=${CMD_ARGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${example}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=intro/${example}.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=intro/${example}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + set_tests_properties (JAVA_intro-${example} PROPERTIES DEPENDS JAVA_intro-${example}-copy-objects) endforeach () endif () diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index d677b5f..3298a47 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -89,8 +89,7 @@ else () endif () get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) -get_property (target_name_debug TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME_DEBUG) -set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=$,${target_name_debug},${target_name}>;") +set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) set (CMAKE_JAVA_CLASSPATH ".") @@ -101,8 +100,7 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) add_test ( NAME JUnit-${test_file}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove JUnit-${test_file}.out JUnit-${test_file}.out.err ) -- cgit v0.12 From b9332d6a138b6812e0729b450f993bc9bb9b22de Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 22 Jul 2019 17:13:56 -0500 Subject: Correct format of drive check --- test/links.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/links.c b/test/links.c index 594e77e..b7eb6af 100644 --- a/test/links.c +++ b/test/links.c @@ -4805,6 +4805,10 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR drive = HDgetdrive(); + if (drive >= 26) + drive -= 1; /* account for drive Z */ + else + drive += 1; /* set up name for main file: "/CWD/extlinks0" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ @@ -4813,9 +4817,7 @@ external_link_win5(hid_t fapl, hbool_t new_format) h5_fixname(tmpname, fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks14" */ - if (drive >= 26) - drive -= 2; /* account for drive Z */ - HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks14" */ @@ -4904,13 +4906,15 @@ external_link_win6(hid_t fapl, hbool_t new_format) TEST_ERROR drive = HDgetdrive(); if (drive >= 26) - drive -= 2; /* account for drive Z */ + drive -= 1; /* account for drive Z */ + else + drive += 1; /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* set up name for target link: ":tmp/extlinks15" */ - HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[36]); + HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); /* set up name for target file: "tmp/extlinks15" */ -- cgit v0.12 From e19b0302cc38d1850ada7a00431511343cddc8a6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Jul 2019 16:21:07 -0500 Subject: HDFFV-10845 update note --- release_docs/RELEASE.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a64abc8..fe40021 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -57,12 +57,16 @@ New Features (ADB - 2019/07/17, HDFFV-100424) - - Add mingw support with toolchain file + - Add mingw CMake support with a toolchain file There has been a number of mingw issues that has been linked under HDFFV-10845. It has been decided to implement the CMake cross-compiling technique of toolchain files. We will use a linux platform with the mingw - compiler stack for testing. + compiler stack for testing. Only the C language is fully supported, and + the error tests are skipped. The C++ language works for static but shared + builds has a shared library issue with the mingw Standard Exception Handling + library, which is not available on Windows. Fortran has a common cross-compile + problem with the fortran configure tests. (ADB - 2019/07/12, HDFFV-10845, HDFFV-10595) -- cgit v0.12 From 6a932198aa9c3da1d23fe4c4bdee05891bc2e38b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Jul 2019 16:24:56 -0500 Subject: HDFFV-10529 Update CMake tests to use test fixtures --- c++/examples/CMakeTests.cmake | 135 ++++---- c++/test/CMakeVFDTests.cmake | 3 +- config/cmake/CTestCustom.cmake | 180 ++-------- config/cmake/HDF5UseFortran.cmake | 3 +- config/cmake_ext_mod/HDFMacros.cmake | 4 +- examples/CMakeTests.cmake | 189 ++++++----- fortran/examples/CMakeTests.cmake | 52 ++- fortran/test/CMakeTests.cmake | 47 ++- hl/c++/examples/CMakeTests.cmake | 1 + hl/c++/test/CMakeTests.cmake | 6 + hl/examples/CMakeTests.cmake | 60 ++-- hl/fortran/examples/CMakeTests.cmake | 10 +- hl/fortran/test/CMakeTests.cmake | 21 +- hl/test/CMakeTests.cmake | 85 +++-- hl/tools/gif2h5/CMakeTests.cmake | 26 +- hl/tools/h5watch/CMakeTests.cmake | 27 +- test/CMakePassthroughVOLTests.cmake | 40 --- test/CMakeTests.cmake | 166 ++++------ test/CMakeVFDTests.cmake | 40 --- testpar/CMakeTests.cmake | 19 +- testpar/CMakeVFDTests.cmake | 8 - tools/test/h5copy/CMakeTests.cmake | 43 +-- tools/test/h5diff/CMakeTests.cmake | 42 +-- tools/test/h5dump/CMakeTests.cmake | 469 +-------------------------- tools/test/h5dump/CMakeTestsPBITS.cmake | 130 -------- tools/test/h5dump/CMakeTestsVDS.cmake | 78 ----- tools/test/h5dump/CMakeTestsXML.cmake | 158 --------- tools/test/h5format_convert/CMakeTests.cmake | 113 +------ tools/test/h5import/CMakeTests.cmake | 220 +++---------- tools/test/h5jam/CMakeTests.cmake | 37 +-- tools/test/h5ls/CMakeTests.cmake | 154 --------- tools/test/h5ls/CMakeTestsVDS.cmake | 62 ---- tools/test/h5repack/CMakeTests.cmake | 366 +++++++++------------ tools/test/h5repack/CMakeVFDTests.cmake | 4 - tools/test/h5stat/CMakeTests.cmake | 35 +- tools/test/misc/CMakeTestsClear.cmake | 295 ++++++++--------- tools/test/misc/CMakeTestsMkgrp.cmake | 108 ++---- tools/test/misc/CMakeTestsRepart.cmake | 25 +- tools/test/perform/CMakeTests.cmake | 30 +- 39 files changed, 895 insertions(+), 2596 deletions(-) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index b7d7497..bbe3433 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -16,84 +16,79 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run - add_test ( - NAME CPP_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - Group.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - ) - set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex) +add_test ( + NAME CPP_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + Group.h5 + SDS.h5 + SDScompound.h5 + SDSextendible.h5 + Select.h5 +) +set_tests_properties (CPP_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex) + +foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex) if (last_test) - set_tests_properties (CPP_ex-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "CPP_ex-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - else () - add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cpp_ex_${example}.txt" - #-D "TEST_REFERENCE=cpp_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "CPP_ex_${example}") - endforeach () + set (last_test "CPP_ex_${example}") +endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_readdata PROPERTIES DEPENDS CPP_ex_create) # SET_TESTS_PROPERTIES(CPP_ex_chunks PROPERTIES DEPENDS CPP_ex_extend_ds) - add_test ( - NAME CPP_ex_tutr-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5tutr_cmprss.h5 - h5tutr_dset.h5 - h5tutr_extend.h5 - h5tutr_group.h5 - h5tutr_groups.h5 - h5tutr_subset.h5 - ) +add_test ( + NAME CPP_ex_tutr-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + h5tutr_cmprss.h5 + h5tutr_dset.h5 + h5tutr_extend.h5 + h5tutr_group.h5 + h5tutr_groups.h5 + h5tutr_subset.h5 +) +set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES FIXTURES_SETUP clear_cppex_tutr) + +foreach (example ${tutr_examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=cpp_ex_${example}.txt" + #-D "TEST_REFERENCE=cpp_ex_${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (CPP_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_cppex_tutr) if (last_test) - set_tests_properties (CPP_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "CPP_ex_tutr-clear-objects") - - foreach (example ${tutr_examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME CPP_ex_${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - else () - add_test (NAME CPP_ex_${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=cpp_ex_${example}.txt" - #-D "TEST_REFERENCE=cpp_ex_${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (CPP_ex_${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "CPP_ex_${example}") - endforeach () + set (last_test "CPP_ex_${example}") +endforeach () #the following dependencies are handled by the order of the files # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_crtatt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) # SET_TESTS_PROPERTIES(CPP_ex_h5tutr_rdwt PROPERTIES DEPENDS CPP_ex_h5tutr_crtdat) diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index c979ff1..b26165a 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -42,6 +42,7 @@ tattr_scalar.h5 tfattrs.h5 titerate.h5 + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} ) add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 @@ -51,7 +52,7 @@ -D "TEST_ARGS:STRING=" -D "TEST_VFD:STRING=${vfdname}" -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=cpp_testhdf5" + -D "TEST_OUTPUT=${vfdname}-cpp_testhdf5.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 6db0f6f..a05f906 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -42,25 +42,31 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5TEST-testlibinfo #uses grepTest.cmake ######### H5TEST-clear-objects - H5TEST-clear-cache-objects - H5TEST-clear-cache_api-objects - H5TEST-clear-cache_image-objects - H5TEST-clear-cache_tagging-objects - H5TEST-clear-del_many_dense_attrs-objects - H5TEST-clear-err_compat-objects - H5TEST-clear-error_test-objects - H5TEST-clear-filenotclosed-objects - H5TEST-clear-flush-objects - H5TEST-clear-links_env-objects - H5TEST-clear-testflushrefresh-objects - H5TEST-clear-testhdf5-objects - H5TEST-clear-ttsafe-objects + H5TEST-cache-clear-objects + H5TEST-cache_image-clear-objects + H5TEST-del_many_dense_attrs-clear-objects + H5TEST-external_env-clear-objects + H5TEST-filenotclosed-clear-objects + H5TEST-flush-clear-objects + H5TEST-links_env-clear-objects + H5TEST-testflushrefresh-clear-objects + H5TEST-testhdf5-clear-objects + H5TEST-vds_env-clear-objects PERFORM_h5perform-clear-objects - HL_TOOLS-clear-objects HL_test-clear-objects HL_FORTRAN_test-clear-objects FORTRAN_testhdf5-clear-objects + FORTRAN_flush1-clear-objects CPP_testhdf5-clear-objects + ######### examples ######### + EXAMPLES-clear-objects + CPP_ex-clear-objects + CPP_ex_tutr-clear-objects + HL_ex-clear-objects + f90_ex-clear-objects + HL_CPP_ptableTest-clear-objects + HL_CPP_ex_ptExampleFL-clear-objects + HL_FORTRAN_f90_ex-clear-objects ######### tools/h5clear ######### H5CLEAR-clearall-objects H5CLEAR-copy_h5clear_fsm_persist_equal.h5 @@ -89,10 +95,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE ######### tools/h5diff ######### H5DIFF-clearall-objects ######### tools/h5dump ######### - H5DUMP-clearall-objects - H5DUMP_PACKED_BITS-clearall-objects - H5DUMP-XML-clearall-objects - H5DUMP_VDS-clearall-objects H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects @@ -100,136 +102,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5IMPORT-h5importtest-clear-objects H5IMPORT-clear-objects ######### tools/h5jam ######### - H5JAM-SETUP-N_twithub_u10_c-clear-objects - H5JAM-SETUP-N_twithub_u10_c - H5JAM-N_twithub_u10_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u10_c - H5JAM-CHECKFILE-N_twithub_u10_c-clear-objects - H5JAM-SETUP-N_twithub_u511_c-clear-objects - H5JAM-SETUP-N_twithub_u511_c - H5JAM-N_twithub_u511_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u511_c - H5JAM-CHECKFILE-N_twithub_u511_c-clear-objects - H5JAM-SETUP-N_twithub_u512_c-clear-objects - H5JAM-SETUP-N_twithub_u512_c - H5JAM-N_twithub_u512_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u512_c - H5JAM-CHECKFILE-N_twithub_u512_c-clear-objects - H5JAM-SETUP-N_twithub_u513_c-clear-objects - H5JAM-SETUP-N_twithub_u513_c - H5JAM-N_twithub_u513_c-clear-objects - H5JAM-NONE_COPY-N_twithub_u513_c - H5JAM-CHECKFILE-N_twithub_u513_c-clear-objects - H5JAM-SETUP-N_twithub513_u10_c-clear-objects - H5JAM-SETUP-N_twithub513_u10_c - H5JAM-N_twithub513_u10_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u10_c - H5JAM-CHECKFILE-N_twithub513_u10_c-clear-objects - H5JAM-SETUP-N_twithub513_u511_c-clear-objects - H5JAM-SETUP-N_twithub513_u511_c - H5JAM-N_twithub513_u511_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u511_c - H5JAM-CHECKFILE-N_twithub513_u511_c-clear-objects - H5JAM-SETUP-N_twithub513_u512_c-clear-objects - H5JAM-SETUP-N_twithub513_u512_c - H5JAM-N_twithub513_u512_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u512_c - H5JAM-CHECKFILE-N_twithub513_u512_c-clear-objects - H5JAM-SETUP-N_twithub513_u513_c-clear-objects - H5JAM-SETUP-N_twithub513_u513_c - H5JAM-N_twithub513_u513_c-clear-objects - H5JAM-NONE_COPY-N_twithub513_u513_c - H5JAM-CHECKFILE-N_twithub513_u513_c-clear-objects - H5JAM-CHECKFILE-twithub_u10_c-clear-objects - H5JAM-twithub_u511_c-clear-objects - H5JAM-CHECKFILE-twithub_u511_c-clear-objects - H5JAM-twithub_u512_c-clear-objects - H5JAM-CHECKFILE-twithub_u512_c-clear-objects - H5JAM-twithub_u513_c-clear-objects - H5JAM-CHECKFILE-twithub_u513_c-clear-objects - H5JAM-twithub513_u10_c-clear-objects - H5JAM-CHECKFILE-twithub513_u10_c-clear-objects - H5JAM-twithub513_u511_c-clear-objects - H5JAM-CHECKFILE-twithub513_u511_c-clear-objects - H5JAM-twithub513_u512_c-clear-objects - H5JAM-CHECKFILE-twithub513_u512_c-clear-objects - H5JAM-twithub513_u513_c-clear-objects - H5JAM-CHECKFILE-twithub513_u513_c-clear-objects - H5JAM-SETUP-twithub_tall-clear-objects - H5JAM-SETUP-twithub_tall - H5JAM-UNJAM-twithub_tall-clear-objects - H5JAM-UNJAM_D-twithub_tall-clear-objects - H5JAM-CHECKFILE-twithub_tall-clear-objects - H5JAM-SETUP-twithub513_tall-clear-objects - H5JAM-SETUP-twithub513_tall - H5JAM-UNJAM-twithub513_tall-clear-objects - H5JAM-UNJAM_D-twithub513_tall-clear-objects - H5JAM-CHECKFILE-twithub513_tall-clear-objects - H5JAM-SETUP-N_twithub_tall-clear-objects - H5JAM-SETUP-N_twithub_tall - H5JAM-UNJAM-N_twithub_tall-clear-objects - H5JAM-UNJAM_D-N_twithub_tall-clear-objects - H5JAM-CHECKFILE-N_twithub_tall-clear-objects - H5JAM-SETUP-N_twithub513_tall-clear-objects - H5JAM-SETUP-N_twithub513_tall - H5JAM-UNJAM-N_twithub513_tall-clear-objects - H5JAM-UNJAM_D-N_twithub513_tall-clear-objects - H5JAM-CHECKFILE-N_twithub513_tall-clear-objects - H5JAM-SETUP-D_twithub_tall-clear-objects - H5JAM-SETUP-D_twithub_tall - H5JAM-UNJAM-D_twithub_tall-clear-objects - H5JAM-UNJAM_D-D_twithub_tall-clear-objects - H5JAM-CHECKFILE-D_twithub_tall-clear-objects - H5JAM-SETUP-D_twithub513_tall-clear-objects - H5JAM-SETUP-D_twithub513_tall - H5JAM-UNJAM-D_twithub513_tall-clear-objects - H5JAM-UNJAM_D-D_twithub513_tall-clear-objects - H5JAM-CHECKFILE-D_twithub513_tall-clear-objects - H5JAM-CHECKFILE-ta_u513-clear-objects - H5JAM-twithub_u10-clear-objects - H5JAM-CHECKFILE-twithub_u10-clear-objects - H5JAM-twithub_u511-clear-objects - H5JAM-CHECKFILE-twithub_u511-clear-objects - H5JAM-twithub_u512-clear-objects - H5JAM-CHECKFILE-twithub_u512-clear-objects - H5JAM-twithub_u513-clear-objects - H5JAM-CHECKFILE-twithub_u513-clear-objects - H5JAM-twithub513_u10-clear-objects - H5JAM-CHECKFILE-twithub513_u10-clear-objects - H5JAM-twithub513_u511-clear-objects - H5JAM-CHECKFILE-twithub513_u511-clear-objects - H5JAM-twithub513_u512-clear-objects - H5JAM-CHECKFILE-twithub513_u512-clear-objects - H5JAM-twithub513_u513-clear-objects - H5JAM-CHECKFILE-twithub513_u513-clear-objects - H5JAM-twithub_u10_c-clear-objects - H5JAM-tall_u10-clear-objects - H5JAM-CHECKFILE-tall_u10-clear-objects - H5JAM-tall_u511-clear-objects - H5JAM-CHECKFILE-tall_u511-clear-objects - H5JAM-tall_u512-clear-objects - H5JAM-CHECKFILE-tall_u512-clear-objects - H5JAM-tall_u513-clear-objects - H5JAM-CHECKFILE-tall_u513-clear-objects - H5JAM-SETUP-ta_u10-clear-objects - H5JAM-SETUP-ta_u10 - H5JAM-ta_u10-clear-objects - H5JAM-NONE_COPY-ta_u10 - H5JAM-CHECKFILE-ta_u10-clear-objects - H5JAM-SETUP-ta_u511-clear-objects - H5JAM-SETUP-ta_u511 - H5JAM-ta_u511-clear-objects - H5JAM-NONE_COPY-ta_u511 - H5JAM-CHECKFILE-ta_u511-clear-objects - H5JAM-SETUP-ta_u512-clear-objects - H5JAM-SETUP-ta_u512 - H5JAM-ta_u512-clear-objects - H5JAM-NONE_COPY-ta_u512 - H5JAM-CHECKFILE-ta_u512-clear-objects - H5JAM-SETUP-ta_u513-clear-objects - H5JAM-SETUP-ta_u513 - H5JAM-ta_u513-clear-objects - H5JAM-NONE_COPY-ta_u513 ######### tools/h5ls ######### H5LS-clearall-objects H5LS_VDS-clearall-objects @@ -286,7 +158,6 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5REPACK-HDFFV-7840-clear-objects H5REPACK_META-meta_long_N-clear-objects H5REPACK_META-meta_short_N-clear-objects - H5REPACK_OLD-old_style_layout_short_switches-clear-objects H5REPACK_STAT-GS_AGGR-clear-objects H5REPACK_STAT-S_AGGR-clear-objects H5REPACK_STAT-SP_NONE-clear-objects @@ -331,14 +202,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5MKGRP-clearall-objects ######### tools/perform ######### PERFORM_h5perform-clearall-objects - ######### hl/tools/h5watch ######### + ######### hl/tools ######### + HL_TOOLS-clear-objects H5WATCH-clearall-objects - ######### examples ######### - EXAMPLES-clear-objects - CPP_ex-clear-objects - CPP_ex_tutr-clear-objects - HL_ex-clear-objects - f90_ex-clear-objects - HL_CPP_ex_ptExampleFL-clear-objects - HL_FORTRAN_f90_ex-clear-objects ) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 279e077..2d3d371 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -14,7 +14,8 @@ # This file provides functions for HDF5 specific Fortran support. # #------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) +enable_language (Fortran) + set (HDF_PREFIX "H5") include (CheckFortranFunctionExists) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 972896d..e320c07 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -127,8 +127,8 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) PROPERTIES OUTPUT_NAME ${LIB_RELEASE_NAME} - OUTPUT_NAME_DEBUG - ${LIB_DEBUG_NAME} +# OUTPUT_NAME_DEBUG +# ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} OUTPUT_NAME_MINSIZEREL diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake index 69ace97..ea3b2c5 100644 --- a/examples/CMakeTests.cmake +++ b/examples/CMakeTests.cmake @@ -15,106 +15,103 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) +file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/red ${PROJECT_BINARY_DIR}/blue ${PROJECT_BINARY_DIR}/u2w) - set (test_CLEANFILES - Attributes.h5 - btrees_file.h5 - cmprss.h5 - default_file.h5 - dset.h5 - extend.h5 - extlink_prefix_source.h5 - extlink_source.h5 - extlink_target.h5 - group.h5 - groups.h5 - hard_link.h5 - mount1.h5 - mount2.h5 - one_index_file.h5 - only_dspaces_and_attrs_file.h5 - only_huge_mesgs_file.h5 - REF_REG.h5 - refere.h5 - SDS.h5 - SDScompound.h5 - SDSextendible.h5 - Select.h5 - separate_indexes_file.h5 - small_lists_file.h5 - soft_link.h5 - subset.h5 - unix2win.h5 - blue/prefix_target.h5 - red/prefix_target.h5 - u2w/u2w_target.h5 - vds.h5 - vds-exc.h5 - vds-excalibur.h5 - vds-exclim.h5 - vds-percival.h5 - vds-percival-unlim.h5 - vds-percival-unlim-maxmin.h5 - a.h5 - b.h5 - c.h5 - d.h5 - vds-simpleIO.h5 - vds-eiger.h5 - ) +set (test_ex_CLEANFILES + Attributes.h5 + btrees_file.h5 + cmprss.h5 + default_file.h5 + dset.h5 + extend.h5 + extlink_prefix_source.h5 + extlink_source.h5 + extlink_target.h5 + group.h5 + groups.h5 + hard_link.h5 + mount1.h5 + mount2.h5 + one_index_file.h5 + only_dspaces_and_attrs_file.h5 + only_huge_mesgs_file.h5 + REF_REG.h5 + refere.h5 + SDS.h5 + SDScompound.h5 + SDSextendible.h5 + Select.h5 + separate_indexes_file.h5 + small_lists_file.h5 + soft_link.h5 + subset.h5 + unix2win.h5 + blue/prefix_target.h5 + red/prefix_target.h5 + u2w/u2w_target.h5 + vds.h5 + vds-exc.h5 + vds-excalibur.h5 + vds-exclim.h5 + vds-percival.h5 + vds-percival-unlim.h5 + vds-percival-unlim-maxmin.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-simpleIO.h5 + vds-eiger.h5 +) - # Remove any output file left over from previous test run - add_test ( - NAME EXAMPLES-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} - ) +# Remove any output file left over from previous test run +add_test ( + NAME EXAMPLES-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_CLEANFILES} +) +set_tests_properties (EXAMPLES-clear-objects PROPERTIES FIXTURES_SETUP clear_EXAMPLES) + +foreach (example ${examples}) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + else () + add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=${example}.txt" + #-D "TEST_REFERENCE=${example}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (EXAMPLES-${example} PROPERTIES FIXTURES_REQUIRED clear_EXAMPLES) if (last_test) - set_tests_properties (EXAMPLES-clear-objects PROPERTIES DEPENDS ${last_test}) + set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) endif () - set (last_test "EXAMPLES-clear-objects") - - foreach (example ${examples}) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME EXAMPLES-${example} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - else () - add_test (NAME EXAMPLES-${example} COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=${example}.txt" - #-D "TEST_REFERENCE=${example}.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (EXAMPLES-${example} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "EXAMPLES-${example}") - endforeach () + set (last_test "EXAMPLES-${example}") +endforeach () ### Windows pops up a modal permission dialog on this test - if (H5_HAVE_PARALLEL AND NOT WIN32) - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) - else () - add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_OUTPUT=ph5example.out" - -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" - -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" - ) - endif () - if (last_test) - set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "MPI_TEST_EXAMPLES-ph5example") +if (H5_HAVE_PARALLEL AND NOT WIN32) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $ ${MPIEXEC_POSTFLAGS}) + else () + add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$;${MPIEXEC_POSTFLAGS}" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=ph5example.out" + -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors" + -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + endif () + if (last_test) + set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test}) endif () + set (last_test "MPI_TEST_EXAMPLES-ph5example") +endif () diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake index 221e5cc..5e7dfa8 100644 --- a/fortran/examples/CMakeTests.cmake +++ b/fortran/examples/CMakeTests.cmake @@ -16,34 +16,30 @@ ############################################################################## ############################################################################## - set (test_CLEANFILES - compound.h5 - copy1.h5 - copy2.h5 - dsetf.h5 - extend.h5 - FORTRAN.h5 - groupf.h5 - groupsf.h5 - h5_cmprss.h5 - mount1.h5 - mount2.h5 - sdsf.h5 - subset.h5 - SDScompound.h5 - test.h5 - ) +set (test_ex_fortran_CLEANFILES + compound.h5 + copy1.h5 + copy2.h5 + dsetf.h5 + extend.h5 + FORTRAN.h5 + groupf.h5 + groupsf.h5 + h5_cmprss.h5 + mount1.h5 + mount2.h5 + sdsf.h5 + subset.h5 + SDScompound.h5 + test.h5 +) - # Remove any output file left over from previous test run - add_test ( - NAME f90_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} - ) - if (last_test) - set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "f90_ex-clear-objects") +# Remove any output file left over from previous test run +add_test ( + NAME f90_ex-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_ex_fortran_CLEANFILES} +) +set_tests_properties (f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_f90_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -61,6 +57,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () + set_tests_properties (f90_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) if (last_test) set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () @@ -83,6 +80,7 @@ foreach (example ${F2003_examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () + set_tests_properties (f03_ex_${example} PROPERTIES FIXTURES_REQUIRED clear_f90_ex) if (last_test) set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test}) endif () diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake index c93b4a2..df5c76c 100644 --- a/fortran/test/CMakeTests.cmake +++ b/fortran/test/CMakeTests.cmake @@ -16,7 +16,7 @@ ############################################################################## ############################################################################## -set (test_CLEANFILES +set (testhdf5_fortran_CLEANFILES a.h5 b.h5 c.h5 @@ -55,14 +55,9 @@ set (test_CLEANFILES # Remove any output file left over from previous test run add_test ( NAME FORTRAN_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_fortran_CLEANFILES} ) -if (last_test) - set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test}) -endif () -set (last_test "FORTRAN_testhdf5-clear-objects") +set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5_fortran) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME FORTRAN_testhdf5_fortran COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -82,7 +77,9 @@ else () ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) +set_tests_properties (FORTRAN_testhdf5_fortran PROPERTIES + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for testhdf5_fortran_1_8 if (HDF5_ENABLE_USING_MEMCHECKER) @@ -103,7 +100,10 @@ else () ) endif () #set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") -set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran) +set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES + DEPENDS FORTRAN_testhdf5_fortran + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for fortranlib_test_F03 if (HDF5_ENABLE_USING_MEMCHECKER) @@ -124,7 +124,10 @@ else () ) endif () # set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s") - set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8) +set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES + DEPENDS FORTRAN_testhdf5_fortran_1_8 + FIXTURES_REQUIRED clear_testhdf5_fortran +) #-- Adding test for vol_connector if (HDF5_ENABLE_USING_MEMCHECKER) @@ -146,9 +149,23 @@ else () endif () #-- Adding test for fflush1 -add_test (NAME FORTRAN_fflush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects) +add_test ( + NAME FORTRAN_flush1-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flush.h5 +) +add_test ( + NAME FORTRAN_fflush1 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ +) +set_tests_properties (FORTRAN_fflush1 PROPERTIES + DEPENDS FORTRAN_flush1-clear-objects +) #-- Adding test for fflush2 -add_test (NAME FORTRAN_fflush2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1) +add_test ( + NAME FORTRAN_fflush2 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ +) +set_tests_properties (FORTRAN_fflush2 PROPERTIES + DEPENDS FORTRAN_fflush1 +) diff --git a/hl/c++/examples/CMakeTests.cmake b/hl/c++/examples/CMakeTests.cmake index a7acc63..7bc614b 100644 --- a/hl/c++/examples/CMakeTests.cmake +++ b/hl/c++/examples/CMakeTests.cmake @@ -21,6 +21,7 @@ add_test ( COMMAND ${CMAKE_COMMAND} -E remove PTcppexampleFL.h5 + ptExampleFL.txt ) if (HDF5_ENABLE_USING_MEMCHECKER) diff --git a/hl/c++/test/CMakeTests.cmake b/hl/c++/test/CMakeTests.cmake index f85ef85..3d0f93a 100644 --- a/hl/c++/test/CMakeTests.cmake +++ b/hl/c++/test/CMakeTests.cmake @@ -16,6 +16,11 @@ ############################################################################## ############################################################################## +add_test ( + NAME HL_CPP_ptableTest-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${example}.txt +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_CPP_ptableTest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -31,3 +36,4 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () +set_tests_properties (HL_CPP_ptableTest PROPERTIES DEPENDS HL_CPP_ptableTest-clear-objects) diff --git a/hl/examples/CMakeTests.cmake b/hl/examples/CMakeTests.cmake index 407c61c..d0f9018 100644 --- a/hl/examples/CMakeTests.cmake +++ b/hl/examples/CMakeTests.cmake @@ -26,35 +26,32 @@ foreach (h5_file ${HDF5_TEST_FILES}) endforeach () add_custom_target(hl_ex_ex_ds1_files ALL COMMENT "Copying files needed by hl_ex_ex_ds1 tests" DEPENDS ${hl_ex_ex_ds1_files_list}) - # Remove any output file left over from previous test run - add_test ( - NAME HL_ex-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ex_lite1.h5 - ex_lite2.h5 - ex_lite3.h5 - packet_table_FLexample.h5 - ex_image1.h5 - ex_image2.h5 - ex_table_01.h5 - ex_table_02.h5 - ex_table_03.h5 - ex_table_04.h5 - ex_table_05.h5 - ex_table_06.h5 - ex_table_07.h5 - ex_table_08.h5 - ex_table_09.h5 - ex_table_10.h5 - ex_table_11.h5 - ex_table_12.h5 - ex_ds1.h5 - ) - if (last_test) - set_tests_properties (HL_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "HL_ex-clear-objects") +# Remove any output file left over from previous test run +add_test ( + NAME HL_ex-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ex_lite1.h5 + ex_lite2.h5 + ex_lite3.h5 + packet_table_FLexample.h5 + ex_image1.h5 + ex_image2.h5 + ex_table_01.h5 + ex_table_02.h5 + ex_table_03.h5 + ex_table_04.h5 + ex_table_05.h5 + ex_table_06.h5 + ex_table_07.h5 + ex_table_08.h5 + ex_table_09.h5 + ex_table_10.h5 + ex_table_11.h5 + ex_table_12.h5 + ex_ds1.h5 +) +set_tests_properties (HL_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -73,7 +70,10 @@ foreach (example ${examples}) ) endif () if (last_test) - set_tests_properties (HL_ex_${example} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (HL_ex_${example} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED clear_HL_ex + ) endif () set (last_test "HL_ex_${example}") endforeach () diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index d3a9d0c..b8f40d0 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -21,10 +21,10 @@ add_test ( NAME HL_FORTRAN_f90_ex-clear-objects COMMAND ${CMAKE_COMMAND} -E remove - ex_ds1.h5 - exlite.h5 + ex_ds1.h5 + exlite.h5 ) - +set_tests_properties (HL_FORTRAN_f90_ex-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_f90_ex) foreach (example ${examples}) if (HDF5_ENABLE_USING_MEMCHECKER) @@ -42,5 +42,7 @@ foreach (example ${examples}) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES DEPENDS HL_FORTRAN_f90_ex-clear-objects) + set_tests_properties (HL_FORTRAN_f90_ex_${example} PROPERTIES + FIXTURES_REQUIRED clear_HL_FORTRAN_f90_ex + ) endforeach () diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 0b81573..0760b92 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,7 +16,7 @@ ############################################################################## ############################################################################## -set (test_CLEANFILES +set (test_hl_fortran_CLEANFILES dsetf1.h5 dsetf2.h5 dsetf3.h5 @@ -28,6 +28,14 @@ set (test_CLEANFILES tstds.h5 ) +# Remove any output file left over from previous test run +add_test ( + NAME HL_FORTRAN_test-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove ${test_hl_fortran_CLEANFILES} +) +set_tests_properties (HL_FORTRAN_test-clear-objects PROPERTIES FIXTURES_SETUP clear_HL_FORTRAN_test) + macro (ADD_H5_FORTRAN_TEST file) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME HL_FORTRAN_f90_${file} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -44,16 +52,11 @@ macro (ADD_H5_FORTRAN_TEST file) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) + set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES + FIXTURES_REQUIRED clear_HL_FORTRAN_test + ) endmacro () -# Remove any output file left over from previous test run -add_test ( - NAME HL_FORTRAN_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${test_CLEANFILES} -) - foreach (h5_test ${H5_TESTS}) ADD_H5_FORTRAN_TEST(${h5_test}) endforeach () diff --git a/hl/test/CMakeTests.cmake b/hl/test/CMakeTests.cmake index be90206..716a3d7 100644 --- a/hl/test/CMakeTests.cmake +++ b/hl/test/CMakeTests.cmake @@ -43,6 +43,44 @@ foreach (h5_file ${HL_REFERENCE_TEST_FILES}) endforeach () add_custom_target(hl_test_files ALL COMMENT "Copying files needed by hl_test tests" DEPENDS ${hl_test_files_list}) +# Remove any output file left over from previous test run +set (test_hl_CLEANFILES + combine_tables1.h5 + combine_tables2.h5 + file_img1.h5 + file_img2.h5 + test_append.h5 + h5do_compat.h5 + test_detach.h5 + test_ds1.h5 + test_ds2.h5 + test_ds3.h5 + test_ds4.h5 + test_ds5.h5 + test_ds6.h5 + test_ds7.h5 + test_ds8.h5 + test_ds9.h5 + test_ds10.h5 + test_image1.h5 + test_image2.h5 + test_image3.h5 + test_lite1.h5 + test_lite2.h5 + test_lite3.h5 + test_lite4.h5 + test_packet_compress.h5 + test_packet_table.h5 + test_packet_table_vlen.h5 + testfl_packet_table_vlen.h5 + test_table.h5 +) +add_test ( + NAME HL_test-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_hl_CLEANFILES} +) +set_tests_properties (HL_test-clear-objects PROPERTIES FIXTURES_SETUP clear_test_hl) + # -------------------------------------------------------------------- # Macro used to add a unit test # -------------------------------------------------------------------- @@ -62,54 +100,13 @@ macro (HL_ADD_TEST hl_name) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - if (last_test) - set_tests_properties (HL_${hl_name} PROPERTIES DEPENDS ${last_test} + set_tests_properties (HL_${hl_name} PROPERTIES + FIXTURES_REQUIRED clear_test_hl ENVIRONMENT "srcdir=${HDF5_HL_TEST_BINARY_DIR}" WORKING_DIRECTORY ${HDF5_HL_TEST_BINARY_DIR} - ) - endif () + ) endmacro () -# Remove any output file left over from previous test run -add_test ( - NAME HL_test-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - combine_tables1.h5 - combine_tables2.h5 - file_img1.h5 - file_img2.h5 - test_append.h5 - h5do_compat.h5 - test_detach.h5 - test_ds1.h5 - test_ds2.h5 - test_ds3.h5 - test_ds4.h5 - test_ds5.h5 - test_ds6.h5 - test_ds7.h5 - test_ds8.h5 - test_ds9.h5 - test_ds10.h5 - test_image1.h5 - test_image2.h5 - test_image3.h5 - test_lite1.h5 - test_lite2.h5 - test_lite3.h5 - test_lite4.h5 - test_packet_compress.h5 - test_packet_table.h5 - test_packet_table_vlen.h5 - testfl_packet_table_vlen.h5 - test_table.h5 -) -if (last_test) - set_tests_properties (HL_test-clear-objects PROPERTIES DEPENDS ${last_test}) -endif () -set (last_test "HL_test-clear-objects") - HL_add_test (test_lite ) HL_add_test (test_image) HL_add_test (test_file_image) diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index ab14864..8537d7c 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -43,20 +43,32 @@ add_test ( image.gif image24.gif ) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES FIXTURES_SETUP clear_tools_hl) add_test (NAME HL_TOOLS_gif2h5 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/image1.gif image1.h5) -set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_gif2h5 PROPERTIES + FIXTURES_REQUIRED clear_tools_hl +) add_test (NAME HL_TOOLS_h52gif COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image1.gif -i image) -set_tests_properties (HL_TOOLS_h52gif PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_h52gif PROPERTIES + FIXTURES_REQUIRED clear_tools_hl +) add_test (NAME HL_TOOLS_h52gif_none COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i nosuch_image) -set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") -set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES + WILL_FAIL "true" + FIXTURES_REQUIRED clear_tools_hl +) #add_test (NAME HL_TOOLS_h52gifpal COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/h52giftst.h5 image.gif -i palette) -#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") +#set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES +# WILL_FAIL "true" +# FIXTURES_REQUIRED clear_tools_hl +#) add_test (NAME HL_TOOLS_h52gif24bits COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ testfiles/ex_image2.h5 image24.gif -i image24bitpixel) -set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") -set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) +set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES + WILL_FAIL "true" + FIXTURES_REQUIRED clear_tools_hl +) diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index e563be4..0424140 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -88,7 +88,10 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED gen_test_watch + ) set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") endif () endmacro () @@ -108,7 +111,10 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test}) + set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES + DEPENDS ${last_test} + FIXTURES_REQUIRED gen_test_watch + ) set (last_test "H5WATCH_ARGS-h5watch-${resultfile}") endif () endmacro () @@ -133,7 +139,11 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes -D "TEST_REFERENCE=${resultfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5WATCH-${resultfile} PROPERTIES DEPENDS H5WATCH-${resultfile}-clear-objects) + set_tests_properties (H5WATCH-${resultfile} PROPERTIES + DEPENDS H5WATCH-${resultfile}-clear-objects + FIXTURES_REQUIRED gen_test_watch + ) + set (last_test "H5WATCH-${resultfile}") endif () endmacro () @@ -151,9 +161,7 @@ if (NOT SWMR_INCOMPAT) # Remove any output file left over from previous test run add_test ( NAME H5WATCH-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - WATCH.h5 + COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5 ) if (last_test) set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) @@ -181,8 +189,11 @@ if (NOT SWMR_INCOMPAT) ################################################################################################# # create the output files to be used. add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES DEPENDS "H5WATCH-clearall-objects") + set_tests_properties (H5WATCH-h5watchgentest PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS "H5WATCH-clearall-objects" + ) + set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch) set (last_test "H5WATCH-h5watchgentest") # Test on --help options diff --git a/test/CMakePassthroughVOLTests.cmake b/test/CMakePassthroughVOLTests.cmake index 9863147..e1b1f92 100644 --- a/test/CMakePassthroughVOLTests.cmake +++ b/test/CMakePassthroughVOLTests.cmake @@ -90,13 +90,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD if ("${voltest}" STREQUAL "flush1" OR "${voltest}" STREQUAL "flush2") if ("${volname}" STREQUAL "multi" OR "${volname}" STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug") - add_test ( - NAME VOL-${volname}-${voltest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${volname}/${volname}-${voltest}.out - ${volname}/${volname}-${voltest}.out.err - ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -109,7 +102,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-${voltest} PROPERTIES - DEPENDS VOL-${volname}-${voltest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) @@ -119,13 +111,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD ) endif () else () - add_test ( - NAME VOL-${volname}-${voltest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${volname}/${volname}-${voltest}.out - ${volname}/${volname}-${voltest}.out.err - ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -138,19 +123,11 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-${voltest} PROPERTIES - DEPENDS VOL-${volname}-${voltest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) endif () else () - add_test ( - NAME VOL-${volname}-${voltest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${volname}/${volname}-${voltest}.out - ${volname}/${volname}-${voltest}.out.err - ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -163,7 +140,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-${voltest} PROPERTIES - DEPENDS VOL-${volname}-${voltest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) @@ -172,13 +148,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD macro (DO_VOL_TEST voltest volname volinfo resultcode) #message(STATUS "${voltest}-${volname} with ${volinfo}") - add_test ( - NAME VOL-${volname}-${voltest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${volname}/${volname}-${voltest}.out - ${volname}/${volname}-${voltest}.out.err - ) add_test (NAME VOL-${volname}-${voltest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -191,7 +160,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-${voltest} PROPERTIES - DEPENDS VOL-${volname}-${voltest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} ) @@ -216,13 +184,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD set_tests_properties (VOL-${volname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (HDF5_TEST_FHEAP_PASSTHROUGH_VOL) - add_test ( - NAME VOL-${volname}-fheap-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${volname}/${volname}-fheap.out - ${volname}/${volname}-fheap.out.err - ) add_test (NAME VOL-${volname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -235,7 +196,6 @@ add_custom_target(HDF5_VOLTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/volTest.cmake" ) set_tests_properties (VOL-${volname}-fheap PROPERTIES - DEPENDS VOL-${volname}-fheap-clear-objects TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${volname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${volname} diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 8537c46..49fabd8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -198,13 +198,12 @@ set (testhdf5_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME H5TEST-clear-testhdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${testhdf5_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST +add_test ( + NAME H5TEST-testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) +set_tests_properties (H5TEST-testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -x heap -x file -x select) set_tests_properties (H5TEST-testhdf5-base PROPERTIES @@ -451,14 +450,12 @@ set (test_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME H5TEST-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST +add_test ( + NAME H5TEST-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_objects) +set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_H5TEST) set (H5TEST_SEPARATE_TESTS testhdf5 @@ -498,7 +495,7 @@ foreach (h5_test ${H5_TESTS}) ) endif () set_tests_properties (H5TEST-${h5_test} PROPERTIES - FIXTURES_REQUIRED clear_objects + FIXTURES_REQUIRED clear_H5TEST ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -513,14 +510,12 @@ set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOU #-- Adding test for cache if (NOT CYGWIN) - add_test (NAME H5TEST-clear-cache-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + add_test ( + NAME H5TEST-cache-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-clear-cache-objects PROPERTIES FIXTURES_SETUP cache_clear_objects) + set_tests_properties (H5TEST-cache-clear-objects PROPERTIES FIXTURES_SETUP clear_cache) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -537,7 +532,7 @@ if (NOT CYGWIN) ) endif () set_tests_properties (H5TEST-cache PROPERTIES - FIXTURES_REQUIRED cache_clear_objects + FIXTURES_REQUIRED clear_cache ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -547,17 +542,14 @@ endif () if (TEST_CACHE_IMAGE) #-- Adding test for cache_image add_test ( - NAME H5TEST-clear-cache_image-objects - COMMAND ${CMAKE_COMMAND} - -E remove - cache_image_test.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-cache_image-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove cache_image_test.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) - add_test (NAME H5TEST-cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + set_tests_properties (H5TEST-cache_image-clear-objects PROPERTIES FIXTURES_SETUP clear_cache_image) + add_test (NAME H5TEST_cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-cache_image PROPERTIES - FIXTURES_REQUIRED cache_image_clear_objects + FIXTURES_REQUIRED clear_cache_image ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -565,9 +557,8 @@ endif () #-- Adding test for external_env add_test ( - NAME H5TEST-clear-external_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove + NAME H5TEST-external_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove extern_1r.raw extern_2r.raw extern_3r.raw @@ -576,12 +567,10 @@ add_test ( extern_2w.raw extern_3w.raw extern_4w.raw - external_env.txt - external_env.out WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-external_env-objects PROPERTIES FIXTURES_SETUP external_env_clear_objects) +set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -600,25 +589,22 @@ else () ) endif () set_tests_properties (H5TEST-external_env PROPERTIES - FIXTURES_REQUIRED external_env_clear_objects + FIXTURES_REQUIRED clear_external_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for vds_env add_test ( - NAME H5TEST-clear-vds_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove + NAME H5TEST-vds_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove vds_virt_0.h5 vds_virt_3.h5 vds_src_2.h5 - vds_env.txt - vds_env.out WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-vds_env-objects PROPERTIES FIXTURES_SETUP vds_env_clear_objects) +set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -637,15 +623,14 @@ else () ) endif () set_tests_properties (H5TEST-vds_env PROPERTIES - FIXTURES_REQUIRED vds_env_clear_objects + FIXTURES_REQUIRED clear_vds_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for flush1/2 -add_test (NAME H5TEST-clear-flush-objects - COMMAND ${CMAKE_COMMAND} - -E remove +add_test (NAME H5TEST-flush-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flush.h5 flush-swmr.h5 noflush.h5 @@ -657,6 +642,7 @@ add_test (NAME H5TEST-clear-flush-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-flush-clear-objects PROPERTIES FIXTURES_SETUP clear_flush) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -672,7 +658,7 @@ else () ) endif () set_tests_properties (H5TEST-flush1 PROPERTIES - DEPENDS H5TEST-clear-flush-objects + FIXTURES_REQUIRED clear_flush ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -690,7 +676,10 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (H5TEST-flush2 PROPERTIES DEPENDS H5TEST-flush1) +set_tests_properties (H5TEST-flush2 PROPERTIES + FIXTURES_REQUIRED clear_flush + DEPENDS H5TEST-flush1 +) #-- Adding test for tcheck_version add_test (NAME H5TEST-tcheck_version-major COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-tM") @@ -743,49 +732,34 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES #-- Adding test for filenotclosed add_test ( - NAME H5TEST-clear-filenotclosed-objects - COMMAND ${CMAKE_COMMAND} - -E remove - filenotclosed.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-filenotclosed-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove filenotclosed.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-filenotclosed-objects PROPERTIES FIXTURES_SETUP filenotclosed_clear_objects) +set_tests_properties (H5TEST-filenotclosed-clear-objects PROPERTIES FIXTURES_SETUP clear_filenotclosed) add_test (NAME H5TEST-filenotclosed COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-filenotclosed PROPERTIES - FIXTURES_REQUIRED filenotclosed_clear_objects + FIXTURES_REQUIRED clear_filenotclosed ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for del_many_dense_attrs add_test ( - NAME H5TEST-clear-del_many_dense_attrs-objects - COMMAND ${CMAKE_COMMAND} - -E remove - del_many_dense_attrs.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST + NAME H5TEST-del_many_dense_attrs-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove del_many_dense_attrs.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects) +set_tests_properties (H5TEST-del_many_dense_attrs-clear-objects PROPERTIES FIXTURES_SETUP clear_del_many_dense_attrs) add_test (NAME H5TEST-del_many_dense_attrs COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES - FIXTURES_REQUIRED del_many_dense_attrs_clear_objects + FIXTURES_REQUIRED clear_del_many_dense_attrs ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) #-- Adding test for err_compat -if (HDF5_ENABLE_DEPRECATED_SYMBOLS) - add_test (NAME H5TEST-clear-err_compat-objects - COMMAND ${CMAKE_COMMAND} - -E remove - err_compat.txt - err_compat.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST - ) - set_tests_properties (H5TEST-clear-err_compat-objects PROPERTIES FIXTURES_SETUP err_compat_clear_objects) +if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW) add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" @@ -799,23 +773,13 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES - FIXTURES_REQUIRED err_compat_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () #-- Adding test for error_test -add_test (NAME H5TEST-clear-error_test-objects - COMMAND ${CMAKE_COMMAND} - -E remove - error_test.txt - error_test.txt.err - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST -) -set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) -if (HDF5_USE_16_API_DEFAULT) +if (HDF5_USE_16_API_DEFAULT OR MINGW) add_test ( NAME H5TEST-error_test COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" @@ -835,25 +799,21 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES - FIXTURES_REQUIRED error_test_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) endif () #-- Adding test for links_env -add_test (NAME H5TEST-clear-links_env-objects - COMMAND ${CMAKE_COMMAND} - -E remove - links_env.txt - links_env.txt.err +add_test (NAME H5TEST-links_env-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove extlinks_env0.h5 extlinks_env1.h5 tmp/extlinks_env1.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) +set_tests_properties (H5TEST-links_env-clear-objects PROPERTIES FIXTURES_SETUP clear_links_env) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) else () @@ -871,7 +831,7 @@ else () ) endif () set_tests_properties (H5TEST-links_env PROPERTIES - FIXTURES_REQUIRED links_env_clear_objects + FIXTURES_REQUIRED clear_links_env ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -938,16 +898,12 @@ if (ENABLE_EXTENDED_TESTS) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") find_package (Perl) if (PERL_FOUND) - add_test (NAME H5TEST-clear-testflushrefresh-objects - COMMAND ${CMAKE_COMMAND} - -E remove - flushrefresh.txt - flushrefresh.txt.err - flushrefresh.h5 - WORKING_DIRECTORY - ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test + add_test ( + NAME H5TEST-testflushrefresh-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove flushrefresh.h5 + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) - set_tests_properties (H5TEST-clear-testflushrefresh-objects PROPERTIES FIXTURES_SETUP testflushrefresh_clear_objects) + set_tests_properties (H5TEST-testflushrefresh-clear-objects PROPERTIES FIXTURES_SETUP clear_testflushrefresh) add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" @@ -963,7 +919,7 @@ if (ENABLE_EXTENDED_TESTS) -P "${HDF5_TEST_SOURCE_DIR}/flushrefreshTest.cmake" ) set_tests_properties (H5TEST-testflushrefresh PROPERTIES - FIXTURES_REQUIRED testflushrefresh_clear_objects + FIXTURES_REQUIRED clear_testflushrefresh ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test ) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 2767bdc..cf938f5 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -93,13 +93,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2") if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split") if (NOT BUILD_SHARED_LIBS AND NOT HDF_CFG_NAME MATCHES "Debug") - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -112,7 +105,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -122,13 +114,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD ) endif () else () - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -141,19 +126,11 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) endif () else () - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -166,7 +143,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -174,13 +150,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD endmacro () macro (DO_VFD_TEST vfdtest vfdname resultcode) - add_test ( - NAME VFD-${vfdname}-${vfdtest}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${vfdtest}.out - ${vfdname}/${vfdname}-${vfdtest}.out.err - ) add_test (NAME VFD-${vfdname}-${vfdtest} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -193,7 +162,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES - DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} ) @@ -217,13 +185,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) endif () if (HDF5_TEST_FHEAP_VFD) - add_test ( - NAME VFD-${vfdname}-fheap-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-fheap.out - ${vfdname}/${vfdname}-fheap.out.err - ) add_test (NAME VFD-${vfdname}-fheap COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -236,7 +197,6 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (VFD-${vfdname}-fheap PROPERTIES - DEPENDS VFD-${vfdname}-fheap-clear-objects TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname} diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index 0702d13..ad244b5 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -16,11 +16,10 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run -add_test (NAME MPI_TEST-clear-testphdf5-objects - COMMAND ${CMAKE_COMMAND} - -E remove ParaTest.h5 - WORKING_DIRECTORY - ${HDF5_TEST_PAR_BINARY_DIR} +add_test ( + NAME MPI_TEST-clear-testphdf5-objects + COMMAND ${CMAKE_COMMAND} -E remove ParaTest.h5 + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5) @@ -93,12 +92,10 @@ set (test_par_CLEANFILES ) # Remove any output file left over from previous test run -add_test (NAME MPI_TEST-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${test_par_CLEANFILES} - WORKING_DIRECTORY - ${HDF5_TEST_PAR_BINARY_DIR} +add_test ( + NAME MPI_TEST-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${test_par_CLEANFILES} + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR} ) set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects) diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 1c0f2e8..7db99de 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -41,13 +41,6 @@ endforeach () if (NOT HDF5_ENABLE_USING_MEMCHECKER) foreach (h5_test ${H5P_VFD_TESTS}) add_test ( - NAME MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${vfdname}/${vfdname}-${h5_test}.out - ${vfdname}/${vfdname}-${h5_test}.out.err - ) - add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -60,7 +53,6 @@ endforeach () -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES - DEPENDS MPI_TEST_VFD-${vfdname}-${h5_test}-clear-objects ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} ) diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 3fabdf6..b0d1615 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -65,9 +65,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_F-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () @@ -101,9 +99,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () @@ -147,9 +143,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () @@ -188,9 +182,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_SAME-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) endif () @@ -242,11 +234,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/${testname}.out.h5 - ./testfiles/${testname}.out.out - ./testfiles/${testname}.out.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/${testname}.out.h5 ) add_test ( NAME H5COPY-CMP-${testname} @@ -271,13 +259,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out.h5 - testfiles/${infile}.out - testfiles/${infile}.out.err - testfiles/${testname}.out.h5.out - testfiles/${testname}.out.h5.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.out.h5 ) if (${resultcode} EQUAL 2) add_test ( @@ -340,13 +322,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY_UD_ERR-${testname}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}_ERR.out.h5 - testfiles/${infile}_ERR.out - testfiles/${infile}_ERR.out.err - testfiles/${testname}_ERR.out.h5.out - testfiles/${testname}_ERR.out.h5.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}_ERR.out.h5 ) if (${resultcode} EQUAL 2) add_test ( @@ -424,8 +400,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5COPY-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove simple.out.h5 chunk.out.h5 compact.out.h5 @@ -458,8 +433,6 @@ samefile1.out.h5 samefile2.out.h5 h5copy_misc1.out.h5 - h5copy_misc1.out.out - h5copy_misc1.out.out.err ) set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (last_test) diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 4e5b2ef..93dfd72 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -374,17 +374,6 @@ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -398,7 +387,9 @@ -D "TEST_APPEND=EXIT CODE:" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS H5DIFF-${resultfile}-clear-objects) + if (last_test) + set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () endif () if (H5_HAVE_PARALLEL) ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN}) @@ -417,17 +408,6 @@ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME MPI_TEST_H5DIFF-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - PAR/testfiles/${resultfile}.out - PAR/testfiles/${resultfile}.out.err - ) - if (last_test) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME MPI_TEST_H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -443,21 +423,15 @@ -D "TEST_SORT_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS MPI_TEST_H5DIFF-${resultfile}-clear-objects) + if (last_test) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () set (last_test "PH5DIFF-${resultfile}") 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_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) if (${resultcode} EQUAL 2) add_test ( NAME H5DIFF_UD-${testname} @@ -493,7 +467,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS H5DIFF_UD-${testname}-clear-objects) + if (last_test) + set_tests_properties (H5DIFF_UD-${testname} PROPERTIES DEPENDS ${last_test}) + endif () endif () endmacro () diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 7a3fdd6..84016f9 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -414,17 +414,6 @@ endif () set (last_test "H5DUMP-${testname}") else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/std/h5dump-${testname}.out - testfiles/std/h5dump-${testname}.out.err - ) - if (last_test) - set_tests_properties (H5DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5DUMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -437,7 +426,9 @@ -D "TEST_REFERENCE=h5dump-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS H5DUMP-${testname}-clear-objects) + if (last_test) + set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) + endif () endif () endmacro () @@ -469,11 +460,7 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.bin - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.bin ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -506,11 +493,7 @@ else () add_test ( NAME H5DUMP-N-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}-N.bin - ${resultfile}-N.out - ${resultfile}-N.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}-N.bin ) set_tests_properties (H5DUMP-N-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -543,11 +526,7 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.txt - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -566,8 +545,7 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") add_test ( NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp ) 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}) @@ -589,12 +567,9 @@ else () add_test ( NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${ddlfile}.txt ${resultfile}.txt - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -613,15 +588,13 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") add_test ( NAME H5DUMP-${resultfile}-output-cmp - COMMAND ${CMAKE_COMMAND} - -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp ) 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}) add_test ( NAME H5DUMP-${resultfile}-output-cmp-ddl - COMMAND ${CMAKE_COMMAND} - -E compare_files --ignore-eol ${ddlfile}.txt ${ddlfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${ddlfile}.txt ${ddlfile}.exp ) 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) @@ -633,8 +606,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-output-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${resultfile}.txt + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.txt ) set_tests_properties (H5DUMP-output-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -646,8 +618,7 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.14.0") add_test ( NAME H5DUMP-output-cmp-${resultfile} - COMMAND ${CMAKE_COMMAND} - -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp + COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${resultfile}.txt ${resultfile}.exp ) 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}) @@ -657,15 +628,6 @@ macro (ADD_H5_MASK_TEST resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -679,21 +641,11 @@ -D "TEST_MASK_ERROR=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5_GREP_TEST resultfile resultcode result_check) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -706,21 +658,11 @@ -D "TEST_REFERENCE=${result_check}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - 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}" @@ -734,21 +676,11 @@ -D "TEST_ERRREF=${result_errcheck}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () macro (ADD_H5ERR_MASK_ENV_TEST resultfile resultcode result_errcheck envvar envval) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -764,7 +696,6 @@ -D "TEST_ENV_VALUE:STRING=${envval}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () @@ -773,11 +704,9 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5DUMP-IMPORT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.bin ${resultfile}.h5 - ${conffile}.out ) set_tests_properties (H5DUMP-IMPORT-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( @@ -804,15 +733,6 @@ 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}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_UD-${testname}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") add_test ( NAME H5DUMP_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -828,7 +748,6 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP_UD-${testname} PROPERTIES DEPENDS H5DUMP_UD-${testname}-clear-objects) endif () endmacro () @@ -838,368 +757,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5dump-help.out - charsets.out - charsets.out.err - file_space.out - file_space.out.err - filter_fail.out - filter_fail.out.err - non_existing.out - non_existing.out.err - packedbits.out - packedbits.out.err - tall-1.out - tall-1.out.err - tall-2.out - tall-2.out.err - tall-2A.out - tall-2A.out.err - tall-2A0.out - tall-2A0.out.err - tall-2B.out - tall-2B.out.err - tall-3.out - tall-3.out.err - tall-4s.out - tall-4s.out.err - tall-5s.out - tall-5s.out.err - tall-6.txt - tall-6.out - tall-6.out.err - tall-7.out - tall-7.out.err - tall-7N.out - tall-7N.out.err - tallfilters.out - tallfilters.out.err - tarray1.out - tarray1.out.err - tarray1_big.out - tarray1_big.out.err - tarray2.out - tarray2.out.err - tarray3.out - tarray3.out.err - tarray4.out - tarray4.out.err - tarray5.out - tarray5.out.err - tarray6.out - tarray6.out.err - tarray7.out - tarray7.out.err - tarray8.out - tarray8.out.err - tattr-1.out - tattr-1.out.err - tattr-2.out - tattr-2.out.err - tattr-3.out - tattr-3.out.err - tattr-4_be.out - tattr-4_be.out.err - tattrcontents1.out - tattrcontents1.out.err - tattrcontents2.out - tattrcontents2.out.err - tattrintsize.out - tattrintsize.out.err - tattrreg.out - tattrreg.out.err - tattrregR.out - tattrregR.out.err - tbin1LE.bin - tbinregR.txt - tbinregR.out - tbinregR.out.err - tbigdims.out - tbigdims.out.err - tbitnopaque_be.out - tbitnopaque_be.out.err - tbitnopaque_le.out - tbitnopaque_le.out.err - tboot1.out - tboot1.out.err - tboot2.out - tboot2.out.err - tboot2A.out - tboot2A.out.err - tboot2B.out - tboot2B.out.err - tchar1.out - tchar1.out.err - tchunked.out - tchunked.out.err - tcmpdattrintsize.out - tcmpdattrintsize.out.err - tcmpdintarray.out - tcmpdintarray.out.err - tcmpdints.out - tcmpdints.out.err - tcmpdintsize.out - tcmpdintsize.out.err - tcomp-1.out - tcomp-1.out.err - tcomp-2.out - tcomp-2.out.err - tcomp-3.out - tcomp-3.out.err - tcomp-4.out - tcomp-4.out.err - tcompact.out - tcompact.out.err - tcompound_complex.out - tcompound_complex.out.err - tcontents.out - tcontents.out.err - tcontiguos.out - tcontiguos.out.err - tdatareg.out - tdatareg.out.err - tdataregR.out - tdataregR.out.err - tdeflate.out - tdeflate.out.err - tdset-1.out - tdset-1.out.err - tdset-2.out - tdset-2.out.err - tdset-3s.out - tdset-3s.out.err - tempty.out - tempty.out.err - texternal.out - texternal.out.err - textlinksrc.out - textlinksrc.out.err - textlinkfar.out - textlinkfar.out.err - textlink.out - textlink.out.err - tfamily.out - tfamily.out.err - tfill.out - tfill.out.err - tfletcher32.out - tfletcher32.out.err - tfpformat.out - tfpformat.out.err - tgroup-1.out - tgroup-1.out.err - tgroup-2.out - tgroup-2.out.err - tgrp_comments.out - tgrp_comments.out.err - tgrpnullspace.out - tgrpnullspace.out.err - thlink-1.out - thlink-1.out.err - thlink-2.out - thlink-2.out.err - thlink-3.out - thlink-3.out.err - thlink-4.out - thlink-4.out.err - thlink-5.out - thlink-5.out.err - thyperslab.out - thyperslab.out.err - tindicesno.out - tindicesno.out.err - tindicessub1.out - tindicessub1.out.err - tindicessub2.out - tindicessub2.out.err - tindicessub3.out - tindicessub3.out.err - tindicessub4.out - tindicessub4.out.err - texceedsubstart.out - texceedsubstart.out.err - texceedsubcount.out - texceedsubcount.out.err - texceedsubstride.out - texceedsubstride.out.err - texceedsubblock.out - texceedsubblock.out.err - tindicesyes.out - tindicesyes.out.err - tints4dims.out - tints4dims.out.err - tints4dimsBlock2.out - tints4dimsBlock2.out.err - tints4dimsBlockEq.out - tints4dimsBlockEq.out.err - tints4dimsCount2.out - tints4dimsCount2.out.err - tints4dimsCountEq.out - tints4dimsCountEq.out.err - tints4dimsStride2.out - tints4dimsStride2.out.err - tintsattrs.out - tintsattrs.out.err - tintsnodata.out - tintsnodata.out.err - tlarge_objname.out - tlarge_objname.out.err - tldouble.out - tldouble.out.err - tlonglinks.out - tlonglinks.out.err - tloop-1.out - tloop-1.out.err - tmulti.out - tmulti.out.err - tmultifile.out - tmultifile.out.err -# tqmarkfile.out -# tqmarkfile.out.err -# tstarfile.out -# tstarfile.out.err - tnamed_dtype_attr.out - tnamed_dtype_attr.out.err - tnbit.out - tnbit.out.err - tnestcomp-1.out - tnestcomp-1.out.err - tnestedcmpddt.out - tnestedcmpddt.out.err - tnoattrdata.out - tnoattrdata.out.err - tnoattrddl.out - tnoattrddl.out.err - tnodata.out - tnodata.out.err - tnoddl.out - tnoddl.out.err - tnoddlfile.out - tnoddlfile.out.err - tno-subset.out - tno-subset.out.err - tnullspace.out - tnullspace.out.err - tordergr1.out - tordergr1.out.err - tordergr2.out - tordergr2.out.err - tordergr3.out - tordergr3.out.err - tordergr4.out - tordergr4.out.err - tordergr5.out - tordergr5.out.err - torderattr1.out - torderattr1.out.err - torderattr2.out - torderattr2.out.err - torderattr3.out - torderattr3.out.err - torderattr4.out - torderattr4.out.err - tordercontents1.out - tordercontents1.out.err - tordercontents2.out - tordercontents2.out.err - torderlinks1.out - torderlinks1.out.err - torderlinks2.out - torderlinks2.out.err - tperror.out - tperror.out.err - trawdatafile.out - trawdatafile.out.err - trawdatafile.txt - trawssetfile.out - trawssetfile.out.err - trawssetfile.txt - treadfilter.out - treadfilter.out.err - treadintfilter.out - treadintfilter.out.err - treference.out - treference.out.err - tsaf.out - tsaf.out.err - tscalarattrintsize.out - tscalarattrintsize.out.err - tscalarintattrsize.out - tscalarintattrsize.out.err - tscalarintsize.out - tscalarintsize.out.err - tscalarstring.out - tscalarstring.out.err - tscaleoffset.out - tscaleoffset.out.err - tshuffle.out - tshuffle.out.err - tslink-1.out - tslink-1.out.err - tslink-2.out - tslink-2.out.err - tslink-D.out - tslink-D.out.err - tsplit_file.out - tsplit_file.out.err - tstr-1.out - tstr-1.out.err - tstr-2.out - tstr-2.out.err - tstr2bin2.txt - tstr2bin6.txt - tstring.out - tstring.out.err - tstring2.out - tstring2.out.err - tstringe.out - tstringe.out.err - tszip.out - tszip.out.err - tudlink-1.out - tudlink-1.out.err - tudlink-2.out - tudlink-2.out.err - tuserfilter.out - tuserfilter.out.err - tvldtypes1.out - tvldtypes1.out.err - tvldtypes2.out - tvldtypes2.out.err - tvldtypes3.out - tvldtypes3.out.err - tvldtypes4.out - tvldtypes4.out.err - tvldtypes5.out - tvldtypes5.out.err - tvlenstr_array.out - tvlenstr_array.out.err - tvlstr.out - tvlstr.out.err - tvms.out - tvms.out.err - twidedisplay.out - twidedisplay.out.err - twithddl.txt - twithddlfile.out - twithddlfile.out.err - twithddlfile.txt - zerodim.out - zerodim.out.err - ) - set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (last_test) - set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5DUMP-clearall-objects") - endif () - ADD_HELP_TEST(help 0 -h) # test data output redirection diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 57c1ad7..a6be9ae 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -137,15 +137,6 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -158,7 +149,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS H5DUMP-${resultfile}-clear-objects) endif () endmacro () @@ -168,126 +158,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_PACKED_BITS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tnofilename-with-packed-bits.out - tnofilename-with-packed-bits.out.err - tpbitsArray.out - tpbitsArray.out.err - tpbitsCompound.out - tpbitsCompound.out.err - tpbitsIncomplete.out - tpbitsIncomplete.out.err - tpbitsLengthExceeded.out - tpbitsLengthExceeded.out.err - tpbitsCharLengthExceeded.out - tpbitsCharLengthExceeded.out.err - tpbitsIntLengthExceeded.out - tpbitsIntLengthExceeded.out.err - tpbitsLongLengthExceeded.out - tpbitsLongLengthExceeded.out.err - tpbitsLengthPositive.out - tpbitsLengthPositive.out.err - tpbitsMax.out - tpbitsMax.out.err - tpbitsMaxExceeded.out - tpbitsMaxExceeded.out.err - tpbitsOffsetExceeded.out - tpbitsOffsetExceeded.out.err - tpbitsCharOffsetExceeded.out - tpbitsCharOffsetExceeded.out.err - tpbitsIntOffsetExceeded.out - tpbitsIntOffsetExceeded.out.err - tpbitsLongOffsetExceeded.out - tpbitsLongOffsetExceeded.out.err - tpbitsOffsetNegative.out - tpbitsOffsetNegative.out.err - tpbitsOverlapped.out - tpbitsOverlapped.out.err - tpbitsSigned.out - tpbitsSigned.out.err - tpbitsUnsigned.out - tpbitsUnsigned.out.err - tpbitsSignedInt.out - tpbitsSignedInt.out.err - tpbitsUnsignedInt.out - tpbitsUnsignedInt.out.err - tpbitsSignedLong.out - tpbitsSignedLong.out.err - tpbitsUnsignedLong.out - tpbitsUnsignedLong.out.err - tpbitsSignedLongLong.out - tpbitsSignedLongLong.out.err - tpbitsUnsignedLongLong.out - tpbitsUnsignedLongLong.out.err - tpbitsSignedWhole.out - tpbitsSignedWhole.out.err - tpbitsUnsignedWhole.out - tpbitsUnsignedWhole.out.err - tpbitsSignedIntWhole.out - tpbitsSignedIntWhole.out.err - tpbitsUnsignedIntWhole.out - tpbitsUnsignedIntWhole.out.err - tpbitsSignedLongWhole.out - tpbitsSignedLongWhole.out.err - tpbitsUnsignedLongWhole.out - tpbitsUnsignedLongWhole.out.err - tpbitsSignedLongLongWhole.out - tpbitsSignedLongLongWhole.out.err - tpbitsUnsignedLongLongWhole.out - tpbitsUnsignedLongLongWhole.out.err - tpbitsSignedLongLongWhole1.out - tpbitsSignedLongLongWhole1.out.err - tpbitsUnsignedLongLongWhole1.out - tpbitsUnsignedLongLongWhole1.out.err - tpbitsSignedLongLongWhole63.out - tpbitsSignedLongLongWhole63.out.err - tpbitsUnsignedLongLongWhole63.out - tpbitsUnsignedLongLongWhole63.out.err - tpbitsSigned4.out - tpbitsSigned4.out.err - tpbitsUnsigned4.out - tpbitsUnsigned4.out.err - tpbitsSignedInt8.out - tpbitsSignedInt8.out.err - tpbitsUnsignedInt8.out - tpbitsUnsignedInt8.out.err - tpbitsSignedLong16.out - tpbitsSignedLong16.out.err - tpbitsUnsignedLong16.out - tpbitsUnsignedLong16.out.err - tpbitsSignedLongLong32.out - tpbitsSignedLongLong32.out.err - tpbitsUnsignedLongLong32.out - tpbitsUnsignedLongLong32.out.err - tpbitsSigned2.out - tpbitsSigned2.out.err - tpbitsUnsigned2.out - tpbitsUnsigned2.out.err - tpbitsSignedInt4.out - tpbitsSignedInt4.out.err - tpbitsUnsignedInt4.out - tpbitsUnsignedInt4.out.err - tpbitsSignedLong8.out - tpbitsSignedLong8.out.err - tpbitsUnsignedLong8.out - tpbitsUnsignedLong8.out.err - tpbitsSignedLongLong16.out - tpbitsSignedLongLong16.out.err - tpbitsUnsignedLongLong16.out - tpbitsUnsignedLongLong16.out.err - ) - set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (last_pbits_test) - set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) - endif () - set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") - endif () - # test failure handling # Missing file name ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 --enable-error-stack) diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 454d9ef..036609c 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -133,15 +133,6 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -154,7 +145,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS H5DUMP-${resultfile}-clear-objects) endif () endmacro () @@ -173,15 +163,6 @@ set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") add_test ( NAME H5DUMP_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -196,7 +177,6 @@ -D "TEST_ENV_VALUE=${PROJECT_BINARY_DIR}/testfiles/vds/" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS H5DUMP_PREFIX-${resultfile}-clear-objects) endif () endmacro () @@ -212,15 +192,6 @@ set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") add_test ( NAME H5DUMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -233,7 +204,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") endif () endmacro () @@ -243,54 +213,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP_VDS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tvds-1.out - tvds-1.out.err - tvds-2.out - tvds-2.out.err - tvds-3_1.out - tvds-3_1.out.err - tvds-3_2.out - tvds-3_2.out.err - tvds-4.out - tvds-4.out.err - tvds-5.out - tvds-5.out.err - vds-first.out - vds-first.out.err - vds-gap1.out - vds-gap1.out.err - vds-gap2.out - vds-gap2.out.err - tvds_layout-1.out - tvds_layout-1.out.err - tvds_layout-2.out - tvds_layout-2.out.err - tvds_layout-3_1.out - tvds_layout-3_1.out.err - tvds_layout-3_2.out - tvds_layout-3_2.out.err - tvds_layout-4.out - tvds_layout-4.out.err - tvds_layout-5.out - tvds_layout-5.out.err - vds_layout-eiger.out - vds_layout-eiger.out.err - vds_layout-maxmin.out - vds_layout-maxmin.out.err - ) - set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (last_vds_test) - set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test}) - endif () - set (last_VDS_test "H5DUMP_VDS-clearall-objects") - 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. diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index c4e3f7b..6d73cb1 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -191,15 +191,6 @@ set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () else () - # Remove any output file left over from previous test run - 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") add_test ( NAME H5DUMP_XML-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -212,7 +203,6 @@ -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 () endmacro () @@ -222,154 +212,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DUMP-XML-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tall.h5.out - tall.h5.out.err - tall-2A.h5.out - tall-2A.h5.out.err - tarray1.h5.out - tarray1.h5.out.err - tarray2.h5.out - tarray2.h5.out.err - tarray3.h5.out - tarray3.h5.out.err - tarray6.h5.out - tarray6.h5.out.err - tarray7.h5.out - tarray7.h5.out.err - tattr.h5.out - tattr.h5.out.err - tbitfields_be.h5.out - tbitfields_be.h5.out.err - tbitfields_le.h5.out - tbitfields_le.h5.out.err - tcompound.h5.out - tcompound.h5.out.err - tcompound2.h5.out - tcompound2.h5.out.err - tcompound_complex.h5.out - tcompound_complex.h5.out.err - tdatareg.h5.out - tdatareg.h5.out.err - tdset.h5.out - tdset.h5.out.err - tdset2.h5.out - tdset2.h5.out.err - tempty-dtd-2.h5.out - tempty-dtd-2.h5.out.err - tempty-dtd-uri.h5.out - tempty-dtd-uri.h5.out.err - tempty-dtd.h5.out - tempty-dtd.h5.out.err - tempty-nons-2.h5.out - tempty-nons-2.h5.out.err - tempty-nons-uri.h5.out - tempty-nons-uri.h5.out.err - tempty-nons.h5.out - tempty-nons.h5.out.err - tempty-ns-2.h5.out - tempty-ns-2.h5.out.err - tempty-ns.h5.out - tempty-ns.h5.out.err - tempty.h5.out - tempty.h5.out.err - tenum.h5.out - tenum.h5.out.err - test35.nc.out - test35.nc.out.err - textlink.h5.out - textlink.h5.out.err - tfpformat.h5.out - tfpformat.h5.out.err - tgroup.h5.out - tgroup.h5.out.err - thlink.h5.out - thlink.h5.out.err - tloop.h5.out - tloop.h5.out.err - tloop2.h5.out - tloop2.h5.out.err - tmany.h5.out - tmany.h5.out.err - tname-amp.h5.out - tname-amp.h5.out.err - tname-apos.h5.out - tname-apos.h5.out.err - tname-gt.h5.out - tname-gt.h5.out.err - tname-lt.h5.out - tname-lt.h5.out.err - tname-quot.h5.out - tname-quot.h5.out.err - tname-sp.h5.out - tname-sp.h5.out.err - tnamed_dtype_attr.h5.out - tnamed_dtype_attr.h5.out.err - tnestedcomp.h5.out - tnestedcomp.h5.out.err - tnodata.h5.out - tnodata.h5.out.err - tnoname.h5.out - tnoname.h5.out.err - tnullspace.h5.out - tnullspace.h5.out.err - tobjref.h5.out - tobjref.h5.out.err - topaque.h5.out - topaque.h5.out.err - torderattr1.h5.out - torderattr1.h5.out.err - torderattr2.h5.out - torderattr2.h5.out.err - torderattr3.h5.out - torderattr3.h5.out.err - torderattr4.h5.out - torderattr4.h5.out.err - tref-escapes-at.h5.out - tref-escapes-at.h5.out.err - tref-escapes.h5.out - tref-escapes.h5.out.err - tref.h5.out - tref.h5.out.err - tsaf.h5.out - tsaf.h5.out.err - tslink.h5.out - tslink.h5.out.err - tstr.h5.out - tstr.h5.out.err - tstr2.h5.out - tstr2.h5.out.err - tstring.h5.out - tstring.h5.out.err - tstring-at.h5.out - tstring-at.h5.out.err - tudlink.h5.out - tudlink.h5.out.err - tvldtypes1.h5.out - tvldtypes1.h5.out.err - tvldtypes2.h5.out - tvldtypes2.h5.out.err - tvldtypes3.h5.out - tvldtypes3.h5.out.err - tvldtypes4.h5.out - tvldtypes4.h5.out.err - tvldtypes5.h5.out - tvldtypes5.h5.out.err - tvlstr.h5.out - tvlstr.h5.out.err - ) - set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (last_xml_test) - set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) - endif () - set (last_test "H5DUMP-XML-clearall-objects") - endif () - ########## test XML ADD_XML_H5_TEST (tall.h5 0 tall.h5) ADD_XML_H5_TEST (tattr.h5 0 tattr.h5) diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 6e13664..398866c 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -108,11 +108,7 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) @@ -120,8 +116,7 @@ if (${testfile}) add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -163,19 +158,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -200,19 +190,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/outtmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/outtmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 ) set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -238,19 +223,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/tmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/tmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/tmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -286,19 +266,14 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/chktmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/chktmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} testfiles/chktmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -324,25 +299,18 @@ endmacro () macro (ADD_H5_H5DUMP_CHECK testname) - # If using memchecker add tests without using scripts + # If using memchecker skip tests if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5FC-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ./testfiles/dmptmp.h5 - ./testfiles/${testname}.out - ./testfiles/${testname}.out.err - ./testfiles/${testname}_chk.out - ./testfiles/${testname}_chk.out.err + COMMAND ${CMAKE_COMMAND} -E remove ./testfiles/dmptmp.h5 ) if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( NAME H5FC-${testname}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testname}.h5 testfiles/dmptmp.h5 ) set_tests_properties (H5FC-${testname}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") add_test ( @@ -385,60 +353,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5FC-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5fc_help.out - h5fc_help.out.err - h5fc_nooption.out - h5fc_nooption.out.err - h5fc_nonexistfile.out - h5fc_nonexistfile.out.err - h5fc_d_file.out - h5fc_d_file.out.err - h5fc_d_file-d.out - h5fc_d_file-d.out.err - h5fc_dname.out - h5fc_dname.out.err - h5fc_nonexistdset_file.out - h5fc_nonexistdset_file.out.err - h5fc_v_non_chunked.out - h5fc_v_non_chunked.out.err - h5fc_v_bt1.out - h5fc_v_bt1.out.err - h5fc_v_ndata_bt1.out - h5fc_v_ndata_bt1.out.err - h5fc_v_all.out - h5fc_v_all.out.err - h5fc_v_n_1d.out - h5fc_v_n_1d.out.err - h5fc_v_n_all.out - h5fc_v_n_all.out.err - h5fc_ext1_i.out - h5fc_ext1_i.out.err - h5fc_ext1_s.out - h5fc_ext1_s.out.err - h5fc_ext1_f.out - h5fc_ext1_f.out.err - h5fc_ext2_if.out - h5fc_ext2_if.out.err - h5fc_ext2_is.out - h5fc_ext2_is.out.err - h5fc_ext2_sf.out - h5fc_ext2_sf.out.err - h5fc_ext3_isf.out - h5fc_ext3_isf.out.err - old_h5fc_ext1_i.out - old_h5fc_ext1_i.out.err - old_h5fc_ext1_s.out - old_h5fc_ext1_s.out.err - old_h5fc_ext1_f.out - old_h5fc_ext1_f.out.err - old_h5fc_ext2_if.out - old_h5fc_ext2_is.out.err - old_h5fc_ext2_is.out - old_h5fc_ext2_sf.out.err - old_h5fc_ext3_isf.out - old_h5fc_ext3_isf.out.err + COMMAND ${CMAKE_COMMAND} -E remove outtmp.h5 tmp.h5 chktmp.h5 diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 4aaee68..22ab848 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -106,25 +106,22 @@ # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) - if (last_test) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) - endif () + set_tests_properties (H5IMPORT-${testname} PROPERTIES + FIXTURES_REQUIRED set_h5importtest + ) else () add_test ( NAME H5IMPORT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${testfile} - ${testfile}.new - ${testfile}.new.err - ${testfile}.out - ${testfile}.out.err - ${testfile} + COMMAND ${CMAKE_COMMAND} -E remove ${testfile} + ) + set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED set_h5importtest ) - set_tests_properties (H5IMPORT-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) add_test (NAME H5IMPORT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${importfile} -c ${conffile} -o ${testfile}) - set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-${testname}-clear-objects) + set_tests_properties (H5IMPORT-${testname} PROPERTIES + DEPENDS H5IMPORT-${testname}-clear-objects + ) add_test ( NAME H5IMPORT-${testname}-H5DMP @@ -139,7 +136,9 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES DEPENDS H5IMPORT-${testname}) + set_tests_properties (H5IMPORT-${testname}-H5DMP PROPERTIES + DEPENDS H5IMPORT-${testname} + ) add_test ( NAME H5IMPORT-${testname}-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" @@ -153,7 +152,9 @@ -D "TEST_REFERENCE=${testfile}.new" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES DEPENDS H5IMPORT-${testname}-H5DMP) + set_tests_properties (H5IMPORT-${testname}-H5DMP_CMP PROPERTIES + DEPENDS H5IMPORT-${testname}-H5DMP + ) endif () endmacro () @@ -162,18 +163,13 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT-DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove d${testfile} d${testfile}.bin - d${testfile}.dmp - d${testfile}.dmp.err - d${testfile}.imp - d${testfile}.imp.err - d${testfile}.dff - d${testfile}.dff.err ) - set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) + set_tests_properties (H5IMPORT-DUMP-${testname}-clear-objects PROPERTIES + DEPENDS H5IMPORT-${testname}-H5DMP_CMP + ) if ("${ARGN}" STREQUAL "BINARY") add_test ( @@ -202,7 +198,9 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () - set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects") + set_tests_properties (H5IMPORT-DUMP-${testname}-H5DMP PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}-clear-objects" + ) add_test ( NAME H5IMPORT-DUMP-${testname} @@ -216,7 +214,9 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP") + set_tests_properties (H5IMPORT-DUMP-${testname} PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}-H5DMP" + ) add_test ( NAME H5IMPORT-DUMP-${testname}-H5DFF @@ -231,7 +231,9 @@ -D "TEST_REFERENCE=testfiles/d${testfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES DEPENDS "H5IMPORT-DUMP-${testname}") + set_tests_properties (H5IMPORT-DUMP-${testname}-H5DFF PROPERTIES + DEPENDS "H5IMPORT-DUMP-${testname}" + ) endif () endmacro () @@ -240,18 +242,13 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - d-${testname}.dmp - d-${testname}.dmp.err + COMMAND ${CMAKE_COMMAND} -E remove d-${testname}.h5 - ${testname}.dmp - ${testname}.dmp.err - ${testname}.imp - ${testname}.imp.err ${testname}.bin ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clear-objects PROPERTIES DEPENDS H5IMPORT-h5importtest) + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED set_h5importtest + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5DMP @@ -265,7 +262,9 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5DMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-clear-objects" + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-H5IMP @@ -279,7 +278,9 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-H5IMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5DMP" + ) add_test ( NAME H5IMPORT_SUB-DUMP-${testname}-CMP COMMAND "${CMAKE_COMMAND}" @@ -292,7 +293,9 @@ -D "TEST_REFERENCE=testfiles/${testname}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP") + set_tests_properties (H5IMPORT_SUB-DUMP-${testname}-CMP PROPERTIES + DEPENDS "H5IMPORT_SUB-DUMP-${testname}-H5IMP" + ) endif () endmacro () @@ -323,8 +326,7 @@ # Remove any output file left over from previous test run add_test ( NAME H5IMPORT-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove binfp64.bin binin8.bin binin8w.bin @@ -333,164 +335,40 @@ binuin16.bin binuin32.bin txtin32.h5 - txtin32.h5.new - txtin32.h5.new.err - txtin32.h5.out - txtin32.h5.out.err txtin16.h5 - txtin16.h5.new - txtin16.h5.new.err - txtin16.h5.out - txtin16.h5.out.err txtin8.h5 - txtin8.h5.new - txtin8.h5.new.err - txtin8.h5.out - txtin8.h5.out.err txtuin16.h5 - txtuin16.h5.new - txtuin16.h5.new.err - txtuin16.h5.out - txtuin16.h5.out.err txtuin32.h5 - txtuin32.h5.new - txtuin32.h5.new.err - txtuin32.h5.out - txtuin32.h5.out.err txtfp32.h5 - txtfp32.h5.new - txtfp32.h5.new.err - txtfp32.h5.out - txtfp32.h5.out.err txtfp64.h5 - txtfp64.h5.new - txtfp64.h5.new.err - txtfp64.h5.out - txtfp64.h5.out.err binfp64.h5 - binfp64.h5.new - binfp64.h5.new.err - binfp64.h5.out - binfp64.h5.out.err binin8.h5 - binin8.h5.new - binin8.h5.new.err - binin8.h5.out - binin8.h5.out.err binin8w.h5 - binin8w.h5.new - binin8w.h5.new.err - binin8w.h5.out - binin8w.h5.out.err binin16.h5 - binin16.h5.new - binin16.h5.new.err - binin16.h5.out - binin16.h5.out.err binin32.h5 - binin32.h5.new - binin32.h5.new.err - binin32.h5.out - binin32.h5.out.err binuin16.h5 - binuin16.h5.new - binuin16.h5.new.err - binuin16.h5.out - binuin16.h5.out.err binuin32.h5 - binuin32.h5.new - binuin32.h5.new.err - binuin32.h5.out - binuin32.h5.out.err txtstr.h5 - txtstr.h5.new - txtstr.h5.new.err - txtstr.h5.out - txtstr.h5.out.err textpfe.h5 - textpfe.h5.new - textpfe.h5.new.err - textpfe.h5.out - textpfe.h5.out.err dbinfp64.h5 dbinfp64.h5.bin - dbinfp64.h5.imp - dbinfp64.h5.imp.err - dbinfp64.h5.dmp - dbinfp64.h5.dmp.err - dbinfp64.h5.dff - dbinfp64.h5.dff.err dbinin8.h5 dbinin8.h5.bin - dbinin8.h5.imp - dbinin8.h5.imp.err - dbinin8.h5.dmp - dbinin8.h5.dmp.err - dbinin8.h5.dff - dbinin8.h5.dff.err dbinin8w.h5 dbinin8w.h5.bin - dbinin8w.h5.imp - dbinin8w.h5.imp.err - dbinin8w.h5.dmp - dbinin8w.h5.dmp.err - dbinin8w.h5.dff - dbinin8w.h5.dff.err dbinin16.h5 dbinin16.h5.bin - dbinin16.h5.imp - dbinin16.h5.imp.err - dbinin16.h5.dmp - dbinin16.h5.dmp.err - dbinin16.h5.dff - dbinin16.h5.dff.err dbinin32.h5 dbinin32.h5.bin - dbinin32.h5.imp - dbinin32.h5.imp.err - dbinin32.h5.dmp - dbinin32.h5.dmp.err - dbinin32.h5.dff - dbinin32.h5.dff.err dbinuin16.h5 dbinuin16.h5.bin - dbinuin16.h5.imp - dbinuin16.h5.imp.err - dbinuin16.h5.dmp - dbinuin16.h5.dmp.err - dbinuin16.h5.dff - dbinuin16.h5.dff.err dbinuin32.h5 dbinuin32.h5.bin - dbinuin32.h5.imp - dbinuin32.h5.imp.err - dbinuin32.h5.dmp - dbinuin32.h5.dmp.err - dbinuin32.h5.dff - dbinuin32.h5.dff.err dtxtstr.h5 dtxtstr.h5.bin - dtxtstr.h5.imp - dtxtstr.h5.imp.err - dtxtstr.h5.dmp - dtxtstr.h5.dmp.err - dtxtstr.h5.dff - dtxtstr.h5.dff.err - tall_fp32.dmp - tall_fp32.dmp.err tall_fp32.bin - tall_fp32.imp - tall_fp32.imp.err - d-tall_fp32.dmp - d-tall_fp32.dmp.err d-tall_fp32.h5 - tall_i32.dmp - tall_i32.dmp.err tall_i32.bin - tall_i32.imp - tall_i32.imp.err - d-tall_i32.dmp - d-tall_i32.dmp.err d-tall_i32.h5 ) set (last_test "H5IMPORT-clear-objects") @@ -498,8 +376,7 @@ add_test ( NAME H5IMPORT-h5importtest-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove binfp64.bin binfp64.conf binin8.bin @@ -515,13 +392,12 @@ binuin32.bin binuin32.conf ) - if (last_test) - set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5IMPORT-clear-objects") add_test (NAME H5IMPORT-h5importtest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - set_tests_properties (H5IMPORT-h5importtest PROPERTIES DEPENDS H5IMPORT-h5importtest-clear-objects) + set_tests_properties (H5IMPORT-h5importtest PROPERTIES + FIXTURES_SETUP set_h5importtest + DEPENDS H5IMPORT-h5importtest-clear-objects + ) # ----- TESTING "ASCII I32 rank 3 - Output BE " ; ADD_H5_TEST (ASCII_I32 testfiles/txtin32.txt testfiles/txtin32.conf txtin32.h5) diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index d930a1e..f108afc 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -66,13 +66,6 @@ endif () else () add_test ( - NAME H5JAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -86,7 +79,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${expectfile} PROPERTIES DEPENDS "H5JAM-${expectfile}-clear-objects") endif () endmacro () @@ -103,13 +95,6 @@ endif () else () add_test ( - NAME H5JAM-UNJAM-${expectfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${expectfile}.out - ${expectfile}.out.err - ) - add_test ( NAME H5JAM-UNJAM-${expectfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -121,7 +106,6 @@ -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS "H5JAM-UNJAM-${expectfile}-clear-objects") endif () endmacro () @@ -129,16 +113,6 @@ # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5JAM-${testname}-CHECKFILE-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${actual}.new - ${actual}.new.err - ${actual}.out - ${actual}.out.err - ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends}) - add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -151,7 +125,7 @@ -D "TEST_SKIP_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects) + set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends}) add_test ( NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP COMMAND "${CMAKE_COMMAND}" @@ -219,8 +193,7 @@ if (${compare_test}) add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${infile}.len.txt ${infile}.cmp ${infile}-ub.cmp @@ -285,8 +258,7 @@ add_test ( NAME H5JAM-${testname}-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${compare_test}.len.txt ${compare_test}.cmp ${compare_test}-ub.cmp @@ -341,8 +313,7 @@ add_test ( NAME H5JAM-${testname}_NONE-CHECK_UB_1-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove ${compare_test}.len.txt ${compare_test}.cmp ${compare_test}-ub.cmp diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 9110f01..2f3f3ab 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -148,19 +148,9 @@ if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () # Remove any output file left over from previous test run add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) - add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -172,7 +162,6 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) endif () endmacro () @@ -184,18 +173,7 @@ if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () - # Remove any output file left over from previous test run - add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -209,20 +187,11 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) 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}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}.out - testfiles/${resultfile}.out.err - ) add_test ( NAME H5LS_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -238,7 +207,6 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS_UD-${testname} PROPERTIES DEPENDS H5LS_UD-${testname}-clear-objects) endif () endmacro () @@ -248,128 +216,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5LS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - help-1.out - help-1.out.err - help-2.out - help-2.out.err - help-3.out - help-3.out.err - nosuchfile.out - nosuchfile.out.err - tall-1.out - tall-1.out.err - tall-2.out - tall-2.out.err - tarray1.out - tarray1.out.err - tattr2.out - tattr2.out.err - tcomp-1.out - tcomp-1.out.err - tdataregbe.out - tdataregbe.out.err - tdataregle.out - tdataregle.out.err - tdset-1.out - tdset-1.out.err - tempty.out - tempty.out.err - textlink-1.out - textlink-1.out.err - textlinksrc-1.out - textlinksrc-1.out.err - textlinksrc-2.out - textlinksrc-2.out.err - textlinksrc-3.out - textlinksrc-3.out.err - textlinksrc-4.out - textlinksrc-4.out.err - textlinksrc-5.out - textlinksrc-5.out.err - textlinksrc-6.out - textlinksrc-6.out.err - textlinksrc-7.out - textlinksrc-7.out.err - textlinksrc-1-old.out - textlinksrc-1-old.out.err - textlinksrc-2-old.out - textlinksrc-2-old.out.err - textlinksrc-3-old.out - textlinksrc-3-old.out.err - textlinksrc-6-old.out - textlinksrc-6-old.out.err - textlinksrc-7-old.out - textlinksrc-7-old.out.err - tgrp_comments.out - tgrp_comments.out.err - tgrpnullspace.out - tgrpnullspace.out.err - tsoftlinks-1.out - tsoftlinks-1.out.err - tsoftlinks-2.out - tsoftlinks-2.out.err - tsoftlinks-3.out - tsoftlinks-3.out.err - tsoftlinks-4.out - tsoftlinks-4.out.err - tsoftlinks-5.out - tsoftlinks-5.out.err - textlinksrc-nodangle-1.out - textlinksrc-nodangle-1.out.err - textlinksrc-nodangle-2.out - textlinksrc-nodangle-2.out.err - tsoftlinks-nodangle-1.out - tsoftlinks-nodangle-1.out.err - thlinks-nodangle-1.out - thlinks-nodangle-1.out.err - tgroup.out - tgroup.out.err - tgroup-1.out - tgroup-1.out.err - tgroup-2.out - tgroup-2.out.err - tgroup-3.out - tgroup-3.out.err - thlink-1.out - thlink-1.out.err - tloop-1.out - tloop-1.out.err - tnestcomp-1.out - tnestcomp-1.out.err - tnestcomp-2.out - tnestcomp-2.out.err - tnestcomp-3.out - tnestcomp-3.out.err - tnestcomp-4.out - tnestcomp-4.out.err - tsaf.out - tsaf.out.err - tslink-1.out - tslink-1.out.err - tstr-1.out - tstr-1.out.err - tudlink-1.out - tudlink-1.out.err - tvldtypes1.out - tvldtypes1.out.err - tvldtypes2le.out - tvldtypes2le.out.err - tvldtypes2be.out - tvldtypes2be.out.err - ) - set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5LS-clearall-objects") - 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. diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index b975d4a..cf5b6d7 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -94,19 +94,8 @@ if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( - NAME H5LS-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5LS-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - add_test ( NAME H5LS-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -118,7 +107,6 @@ -D "TEST_REFERENCE=${resultfile}.ls" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) endif () endmacro () @@ -133,19 +121,8 @@ if (${resultcode} EQUAL 1) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( - NAME H5LS_PREFIX-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5LS_PREFIX-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix") - add_test ( NAME H5LS_PREFIX-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -159,7 +136,6 @@ -D "TEST_ENV_VALUE=\${ORIGIN}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS H5LS_PREFIX-${resultfile}-clear-objects) endif () endmacro () @@ -169,44 +145,6 @@ ############################################################################## ############################################################################## - if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5LS_VDS-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tvds-1.out - tvds-1.out.err - tvds-2.out - tvds-2.out.err - tvds-3_1.out - tvds-3_1.out.err - tvds-3_2.out - tvds-3_2.out.err - tvds-4.out - tvds-4.out.err - tvds-5.out - tvds-5.out.err - tvds_layout-1.out - tvds_layout-1.out.err - tvds_layout-2.out - tvds_layout-2.out.err - tvds_layout-3_1.out - tvds_layout-3_1.out.err - tvds_layout-3_2.out - tvds_layout-3_2.out.err - tvds_layout-4.out - tvds_layout-4.out.err - tvds_layout-5.out - tvds_layout-5.out.err - ) - set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (last_test) - set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5LS_VDS-clearall-objects") - endif () - ADD_H5_VDS_TEST (tvds-1 0 -w80 -v -S 1_vds.h5) ADD_H5_VDS_TEST (tvds-2 0 -w80 -v -S 2_vds.h5) ADD_H5_VDS_TEST (tvds-3_1 0 -w80 -v -S 3_1_vds.h5) diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index d1e9c7a..cd20f77 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -167,22 +167,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-h5repack-${testname}") - else () - add_test ( - NAME H5REPACK-h5repack-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/h5repack-${testname}.out - testfiles/h5repack-${testname}.out.err + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - if (last_test) - set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + else () add_test ( NAME H5REPACK-h5repack-${testname} COMMAND "${CMAKE_COMMAND}" @@ -195,39 +183,43 @@ -D "TEST_REFERENCE=h5repack-${testname}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS H5REPACK-h5repack-${testname}-clear-objects) endif () + set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) endmacro () macro (ADD_H5_TEST_OLD testname testtype testfile) - if ("${testtype}" STREQUAL "SKIP") - if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + if ("${testtype}" STREQUAL "SKIP") add_test ( NAME H5REPACK_OLD-${testname} COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}" ) set_property(TEST H5REPACK_OLD-${testname} PROPERTY DISABLED) + else () + add_test ( + NAME H5REPACK_OLD-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) + add_test ( + NAME H5REPACK_OLD-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES + DEPENDS H5REPACK_OLD-${testname}-clear-objects + ) + add_test ( + NAME H5REPACK_OLD-${testname}_DFF + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES + DEPENDS H5REPACK_OLD-${testname} + ) endif () - else () - add_test ( - NAME H5REPACK_OLD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - ) - if (last_test) - set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5REPACK_OLD-${testname} - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} -i ${PROJECT_BINARY_DIR}/testfiles/${testfile} -o ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_OLD-${testname} PROPERTIES DEPENDS H5REPACK_OLD-${testname}-clear-objects) - add_test ( - NAME H5REPACK_OLD-${testname}_DFF - COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} - ) - set_tests_properties (H5REPACK_OLD-${testname}_DFF PROPERTIES DEPENDS H5REPACK_OLD-${testname}) endif () endmacro () @@ -243,23 +235,25 @@ else () add_test ( NAME H5REPACK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK-${testname} PROPERTIES DEPENDS H5REPACK-${testname}-clear-objects) + set_tests_properties (H5REPACK-${testname} PROPERTIES + DEPENDS H5REPACK-${testname}-clear-objects + ) add_test ( NAME H5REPACK-${testname}_DFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --enable-error-stack ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES DEPENDS H5REPACK-${testname}) + set_tests_properties (H5REPACK-${testname}_DFF PROPERTIES + DEPENDS H5REPACK-${testname} + ) endif () endmacro () @@ -279,21 +273,14 @@ NAME H5REPACK_CMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (last_test) - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) - endif () else () add_test ( NAME H5REPACK_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -307,7 +294,9 @@ -D "TEST_REFERENCE=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS H5REPACK_CMP-${testname}-clear-objects) + set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES + DEPENDS H5REPACK_CMP-${testname}-clear-objects + ) endif () endif () endmacro () @@ -328,21 +317,17 @@ NAME H5REPACK_MASK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (last_test) - set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_MASK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test} + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_MASK-${testname} COMMAND "${CMAKE_COMMAND}" @@ -374,20 +359,18 @@ else () add_test ( NAME H5REPACK_DMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_DMP-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES DEPENDS H5REPACK_DMP-${testname}-clear-objects) + set_tests_properties (H5REPACK_DMP-${testname} PROPERTIES + DEPENDS H5REPACK_DMP-${testname}-clear-objects + ) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_DMP-h5dump-${testname} @@ -401,7 +384,9 @@ -D "TEST_REFERENCE=${testname}.${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES DEPENDS "H5REPACK_DMP-${testname}") + set_tests_properties (H5REPACK_DMP-h5dump-${testname} PROPERTIES + DEPENDS "H5REPACK_DMP-${testname}" + ) endif () endif () endmacro () @@ -418,20 +403,18 @@ else () add_test ( NAME H5REPACK_STAT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${statarg}.${resultfile} - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${statarg}.${resultfile} + ) + set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_STAT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${statarg}.${resultfile} ) - set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES DEPENDS H5REPACK_STAT-${testname}-clear-objects) + set_tests_properties (H5REPACK_STAT-${testname} PROPERTIES + DEPENDS H5REPACK_STAT-${testname}-clear-objects + ) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_STAT-h5stat-${testname} @@ -445,7 +428,9 @@ -D "TEST_REFERENCE=${statarg}.${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES DEPENDS "H5REPACK_STAT-${testname}") + set_tests_properties (H5REPACK_STAT-h5stat-${testname} PROPERTIES + DEPENDS "H5REPACK_STAT-${testname}" + ) endif () endif () endmacro () @@ -463,25 +448,25 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects + ) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DFF COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname} + ) if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP @@ -496,7 +481,9 @@ -D "TEST_REFERENCE=${testfilter}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF + ) else () if ("${testfilter}" STREQUAL "CHUNKED") set (nottestfilter "(CONTIGUOUS|COMPACT)") @@ -520,7 +507,9 @@ -D "TEST_REFERENCE=${testfilter}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}_DFF + ) endif () endif () endif () @@ -540,21 +529,19 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects + ) add_test ( NAME H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -567,8 +554,10 @@ -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname}) + set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}_DMP PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5REPACK_VERIFY_LAYOUT_VDS-${testname} + ) endif () endif () endmacro () @@ -578,20 +567,18 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} - testfiles/${testfile}-${testname}-v.out - testfiles/${testfile}-${testname}-v.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname} PROPERTIES + DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects + ) add_test ( NAME H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -605,28 +592,27 @@ -D "TEST_REFERENCE=SUPERBLOCK_VERSION ${superblock}" -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" ) - set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname}) + set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}_DMP PROPERTIES + DEPENDS H5REPACK_VERIFY_SUPERBLOCK-${testname} + ) endif () endmacro () macro (ADD_H5_VERIFY_INVALIDBOUNDS testname resultcode lowbound highbound) add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${testfile} + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile} + ) + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -j;${lowbound};-k;${highbound} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) - set_tests_properties ( - ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES - DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects - WILL_FAIL "true" + set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname} PROPERTIES + DEPENDS ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects + WILL_FAIL "true" ) endmacro () @@ -634,28 +620,33 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_META-${testname}_N-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}_N.${testname}.h5 testfiles/out-${testname}_M.${testname}.h5 ) - if (last_test) - set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack + ) add_test ( NAME H5REPACK_META-${testname}_N COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ) - set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES DEPENDS H5REPACK_META-${testname}_N-clear-objects) + set_tests_properties (H5REPACK_META-${testname}_N PROPERTIES + DEPENDS H5REPACK_META-${testname}_N-clear-objects + ) add_test ( NAME H5REPACK_META-${testname}_M COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5 ) - set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES DEPENDS H5REPACK_META-${testname}_N) + set_tests_properties (H5REPACK_META-${testname}_M PROPERTIES + DEPENDS H5REPACK_META-${testname}_N + ) add_test (NAME H5REPACK_META-${testname} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_N.${testname}.h5 ${PROJECT_BINARY_DIR}/testfiles/out-${testname}_M.${testname}.h5) - set_tests_properties (H5REPACK_META-${testname} PROPERTIES WILL_FAIL "true") - set_tests_properties (H5REPACK_META-${testname} PROPERTIES DEPENDS H5REPACK_META-${testname}_M) + set_tests_properties (H5REPACK_META-${testname} PROPERTIES + WILL_FAIL "true" + DEPENDS H5REPACK_META-${testname}_M + ) endmacro () macro (ADD_H5_UD_TEST testname resultcode resultfile) @@ -663,17 +654,11 @@ # Remove any output file left over from previous test run add_test ( NAME H5REPACK_UD-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/out-${testname}.${resultfile} - testfiles/${testname}.${resultfile}.out - testfiles/${testname}.${resultfile}.out.err - testfiles/${resultfile}-${testname}.out - testfiles/${resultfile}-${testname}.out.err + COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${resultfile} + ) + set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES + FIXTURES_REQUIRED clear_h5repack ) - if (last_test) - set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () add_test ( NAME H5REPACK_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -690,7 +675,9 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-${testname} PROPERTIES DEPENDS H5REPACK_UD-${testname}-clear-objects) + set_tests_properties (H5REPACK_UD-${testname} PROPERTIES + DEPENDS H5REPACK_UD-${testname}-clear-objects + ) add_test ( NAME H5REPACK_UD-${testname}-h5dump COMMAND "${CMAKE_COMMAND}" @@ -706,7 +693,9 @@ -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES DEPENDS "H5REPACK_UD-${testname}") + set_tests_properties (H5REPACK_UD-${testname}-h5dump PROPERTIES + DEPENDS "H5REPACK_UD-${testname}" + ) endif () endmacro () @@ -750,67 +739,6 @@ if (HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run set (LIST_TO_CLEAR - h5dump-help.out - h5repack_layout.h5-chunk_18x13-v.out - h5repack_layout.h5-chunk_18x13-v.out.err - h5repack_layout.h5-chunk_20x10-v.out - h5repack_layout.h5-chunk_20x10-v.out.err - h5repack_layout.h5-chunk_compa-v.out - h5repack_layout.h5-chunk_compa-v.out.err - h5repack_layout.h5-chunk_conti-v.out - h5repack_layout.h5-chunk_conti-v.out.err - h5repack_layout.h5-compa-v.out - h5repack_layout.h5-compa-v.out.err - h5repack_layout.h5-conti-v.out - h5repack_layout.h5-conti-v.out.err - h5repack_layout.h5-deflate_limit.out - h5repack_layout.h5-deflate_limit.out.err - h5repack_layout.h5-dset2_chunk_20x10-v.out - h5repack_layout.h5-dset2_chunk_20x10-v.out.err - h5repack_layout.h5-dset2_chunk_20x10-errstk.out - h5repack_layout.h5-dset2_chunk_20x10-errstk.out.err - h5repack_layout.h5-dset2_compa-v.out - h5repack_layout.h5-dset2_compa-v.out.err - h5repack_layout.h5-dset2_conti-v.out - h5repack_layout.h5-dset2_conti-v.out.err - h5repack_layout.h5-dset_compa_chunk-v.out - h5repack_layout.h5-dset_compa_chunk-v.out.err - h5repack_layout.h5-dset_compa_compa-v.out - h5repack_layout.h5-dset_compa_compa-v.out.err - h5repack_layout.h5-dset_compa_conti-v.out - h5repack_layout.h5-dset_compa_conti-v.out.err - h5repack_layout.h5-dset_conti_chunk-v.out - h5repack_layout.h5-dset_conti_chunk-v.out.err - h5repack_layout.h5-dset_conti_compa-v.out - h5repack_layout.h5-dset_conti_compa-v.out.err - h5repack_layout.h5-dset_conti_conti-v.out - h5repack_layout.h5-dset_conti_conti-v.out.err - h5repack_layout.h5-layout_long_switches-v.out - h5repack_layout.h5-layout_long_switches-v.out.err - h5repack_layout.h5-layout_short_switches-v.out - h5repack_layout.h5-layout_short_switches-v.out.err - h5repack_layout.h5-plugin_test.out - h5repack_layout.h5-plugin_test.out.err - h5repack_layout2.h5-contig_small_compa-v.out - h5repack_layout2.h5-contig_small_compa-v.out.err - h5repack_layout2.h5-contig_small_fixed_compa-v.out - h5repack_layout2.h5-contig_small_fixed_compa-v.out.err - h5repack_layout3.h5-ckdim_biger-v.out - h5repack_layout3.h5-ckdim_biger-v.out.err - h5repack_layout3.h5-ckdim_smaller-v.out - h5repack_layout3.h5-ckdim_smaller-v.out.err - h5repack_layout3.h5-chunk2chunk-v.out - h5repack_layout3.h5-chunk2chunk-v.out.err - h5repack_layout3.h5-chunk2compa-v.out - h5repack_layout3.h5-chunk2compa-v.out.err - h5repack_layout3.h5-chunk2conti-v.out - h5repack_layout3.h5-chunk2conti-v.out.err - h5repack_layout3.h5-error1-v.out - h5repack_layout3.h5-error1-v.out.err - h5repack_layout3.h5-error2-v.out - h5repack_layout3.h5-error2-v.out.err - h5repack_layout3.h5-error3-v.out - h5repack_layout3.h5-error3-v.out.err out-family.tfamily%05d.h5 out-HDFFV-7840.h5diff_attr1.h5 out-attr.h5repack_attr.h5 @@ -919,10 +847,10 @@ NAME H5REPACK-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} ) - set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () + set_tests_properties (H5REPACK-clearall-objects PROPERTIES + FIXTURES_SETUP clear_h5repack + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endif () ADD_HELP_TEST(help 0 -h) diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index 7761c17..f88f147 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -48,10 +48,6 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - if (last_test) - set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") endmacro () ############################################################################## diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index 7d0e3f9..9674a77 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -106,21 +106,8 @@ if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5STAT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -132,7 +119,6 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) endif () endmacro () @@ -143,21 +129,8 @@ if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (last_test) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () else (HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5STAT-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.out - ${resultfile}.out.err - ) - if (last_test) - set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5STAT-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -170,7 +143,6 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) endif () endmacro () @@ -187,13 +159,8 @@ endforeach () add_test ( NAME H5STAT-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove ${CLEAR_LIST} + COMMAND ${CMAKE_COMMAND} -E remove ${CLEAR_LIST} ) - if (last_test) - set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5STAT-clearall-objects") endif () # Test for help flag diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index 99650e6..a2c494d 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -94,16 +94,6 @@ macro (ADD_H5_CMP testname resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -115,24 +105,12 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) - set (last_test "H5CLEAR_CMP-${testname}") endif () endmacro () macro (ADD_H5_ERR_CMP testname resultfile resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( - NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -145,8 +123,6 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) - set (last_test "H5CLEAR_CMP-${testname}") endif () endmacro () @@ -154,22 +130,16 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - testfiles/${testfile} - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} + ) add_test ( NAME H5CLEAR_CMP-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" ) - set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -182,8 +152,9 @@ -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) - set (last_test "H5CLEAR_CMP-${testname}") + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-copy_${testname} + ) endif () endmacro () @@ -191,22 +162,16 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_CMP-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}.out - testfiles/${testname}.out.err - testfiles/${testfile} - ) - if (last_test) - set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testfile} + ) add_test ( NAME H5CLEAR_CMP-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" ) - set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_CMP-${testname} COMMAND "${CMAKE_COMMAND}" @@ -220,8 +185,9 @@ -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) - set (last_test "H5CLEAR_CMP-${testname}") + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES + DEPENDS H5CLEAR_CMP-copy_${testname} + ) endif () endmacro () @@ -231,12 +197,10 @@ NAME H5CLEAR_RET-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN} ) - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") - if (last_test) - set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR_RET-${testname}") + set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + WILL_FAIL "${resultcode}" + ) endif () endmacro () @@ -244,24 +208,16 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR_FILESIZE_TEST-${testname}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${testname}_before_size.out - testfiles/${testname}_before_size.out.err - testfiles/${testname}_after_size.out - testfiles/${testname}_after_size.out.err - testfiles/${testname}.h5 - ) - if (last_test) - set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 + ) add_test ( NAME H5CLEAR_FILESIZE_TEST-copy_${testname} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5" ) - set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects) + set_tests_properties (H5CLEAR_FILESIZE_TEST-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_FILESIZE_TEST-${testname}-clear-objects + ) add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_before_size COMMAND "${CMAKE_COMMAND}" @@ -274,7 +230,9 @@ -D "TEST_REFERENCE=${resultfile}_before_size.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname}) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_before_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_TEST-copy_${testname} + ) if (NOT ${incr_size} MATCHES "NONE") add_test ( NAME H5CLEAR_FILESIZE_INCR-${testname} @@ -286,9 +244,11 @@ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ --increment ${testname}.h5 ) endif () - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES WILL_FAIL "${resultcode}") - set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size) + set_tests_properties (H5CLEAR_FILESIZE_INCR-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + WILL_FAIL "${resultcode}" + DEPENDS H5CLEAR_FILESIZE_CMP-${testname}_before_size + ) add_test ( NAME H5CLEAR_FILESIZE_CMP-${testname}_after_size COMMAND "${CMAKE_COMMAND}" @@ -297,12 +257,75 @@ -D "TEST_ARGS:STRING=--filesize;${testname}.h5" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" -D "TEST_OUTPUT=${testname}_after_size.out" + -D "TEST_EXPECT=0" + -D "TEST_REFERENCE=${resultfile}_after_size.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_INCR-${testname} + ) + endif () + endmacro () + + macro (ADD_H5_FILESIZE_FAIL_TEST testname resultcode resultfile incr_size) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_TEST-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove testfiles/${testname}.h5 + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testname}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testname}.h5" + ) + set_tests_properties (H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_TEST-${testname}-clear-objects + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_before_size.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_TEST-copy_${testname} + ) + if (NOT ${incr_size} MATCHES "NONE") + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment=${incr_size} ${testname}.h5 + ) + else () + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_INCR-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s --increment ${testname}.h5 + ) + endif () + set_tests_properties (H5CLEAR_FILESIZE_FAIL_INCR-${testname} PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5CLEAR_FILESIZE_FAIL_CMP-${testname}_before_size + ) + add_test ( + NAME H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=--filesize;${testname}.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}_after_size.out" + -D "TEST_EXPECT=0" -D "TEST_REFERENCE=${resultfile}_after_size.ddl" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5CLEAR_FILESIZE_CMP-${testname}_after_size PROPERTIES DEPENDS H5CLEAR_FILESIZE_INCR-${testname}) - set (last_test "H5CLEAR_FILESIZE_CMP-${testname}_after_size") + set_tests_properties (H5CLEAR_FILESIZE_FAIL_CMP-${testname}_after_size PROPERTIES + DEPENDS H5CLEAR_FILESIZE_FAIL_INCR-${testname} + ) endif () endmacro () @@ -310,32 +333,39 @@ if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5CLEAR-clr_open_chk-copy_${testname}.h5 - COMMAND ${CMAKE_COMMAND} - -E copy_if_different + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testfile}.h5" ) - if (last_test) - set_tests_properties (H5CLEAR-clr_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-clr_open_chk-copy_${testname}.h5") # Initial file open fails OR # File open succeeds because the library does not check status_flags for file with < v3 superblock - add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5) - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}") - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES DEPENDS ${last_test}) - endif () + add_test ( + NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES + WILL_FAIL "${resultcode}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS H5CLEAR-clr_open_chk-copy_${testname}.h5 + ) # After "h5clear" the file, the subsequent file open succeeds - add_test (NAME H5CLEAR-h5clr-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5) - set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode}) - set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - add_test (NAME H5CLEAR-clr_open_chk-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5) - set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES DEPENDS H5CLEAR-h5clr-${testname}) - set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - set (last_test "H5CLEAR-clr_open_chk-${testname}") + add_test ( + NAME H5CLEAR-h5clr-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -s ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-h5clr-${testname} PROPERTIES + DEPENDS H5CLEAR-clr_open_chk-${testname}_${resultcode} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + add_test ( + NAME H5CLEAR-clr_open_chk-${testname} + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${testfile}.h5 + ) + set_tests_properties (H5CLEAR-clr_open_chk-${testname} PROPERTIES + DEPENDS H5CLEAR-h5clr-${testname} + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) endif () endmacro () @@ -347,73 +377,6 @@ # # # -# The following are tests to verify the status_flags field is cleared properly: -if (HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5CLEAR-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5clear_log_v3.h5 - h5clear_mdc_image.h5 - h5clear_sec2_v0.h5 - h5clear_sec2_v2.h5 - h5clear_sec2_v3.h5 - orig_h5clear_sec2_v0.h5 - orig_h5clear_sec2_v2.h5 - orig_h5clear_sec2_v3.h5 - latest_h5clear_log_v3.h5 - latest_h5clear_sec2_v3.h5 - mod_h5clear_mdc_image.h5 - mod_h5clear_mdc_image2.h5 - ${HDF5_TEST_FILES} - ) - if (last_test) - set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-clearall-objects") - - foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES}) - add_test ( - NAME H5CLEAR-copy_${h5_file} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_${h5_file}") - endforeach () - # make second copy of h5clear_sec2.h5 - foreach (h5_file ${HDF5_SEC2_TEST_FILES}) - add_test ( - NAME H5CLEAR-copy_orig_${h5_file} - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_orig_${h5_file}") - endforeach () - # make second copy of mod_h5clear_mdc_image.h5 - add_test ( - NAME H5CLEAR-copy_mod_h5clr_mdc_image2.h5 - COMMAND ${CMAKE_COMMAND} - -E copy_if_different - "${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" - ) - if (last_test) - set_tests_properties (H5CLEAR-copy_mod_h5clr_mdc_image2.h5 PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5CLEAR-copy_mod_h5clr_mdc_image2.h5") -endif() - -# -# -# # The following are tests to verify the expected output from h5clear # "h5clear -h" # "h5clear" (no options, no file) @@ -487,9 +450,7 @@ endif() # "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action) - ADD_H5_ERR_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") - ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5) - ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5) + ADD_H5_FILESIZE_FAIL_TEST (h5clear_status_noclose 1 h5clear_status_noclose 0) # # (2) h5clear_fsm_persist_noclose.h5 # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index 37d87ca..11fa3f2 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -61,29 +61,22 @@ endif () macro (ADD_H5_TEST resultfile resultcode resultoption) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - add_test ( - NAME H5MKGRP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err - ) - set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - endif () - + add_test ( + NAME H5MKGRP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 + ) + set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) add_test ( NAME H5MKGRP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${resultoption} ${resultfile}.h5 ${ARGN} ) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (HDF5_ENABLE_USING_MEMCHECKER) - if (last_test) - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) + set_tests_properties (H5MKGRP-${resultfile} PROPERTIES + DEPENDS H5MKGRP-${resultfile}-clear-objects + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + ) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-${resultfile}-h5ls COMMAND "${CMAKE_COMMAND}" @@ -107,13 +100,11 @@ else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err + COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 + ) + set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( NAME H5MKGRP_CMP-${resultfile} COMMAND "${CMAKE_COMMAND}" @@ -126,7 +117,9 @@ -D "TEST_REFERENCE=${resultfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) + set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES + DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects + ) endif () endmacro () @@ -138,54 +131,23 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - h5mkgrp_help.out - h5mkgrp_help.out.err - h5mkgrp_version.out - h5mkgrp_version.out.err - h5mkgrp_single.h5 - h5mkgrp_single.out - h5mkgrp_single.out.err - h5mkgrp_single_v.h5 - h5mkgrp_single_v.out - h5mkgrp_single_v.out.err - h5mkgrp_single_p.h5 - h5mkgrp_single_p.out - h5mkgrp_single_p.out.err - h5mkgrp_single_l.h5 - h5mkgrp_single_l.out - h5mkgrp_single_l.out.err - h5mkgrp_several.h5 - h5mkgrp_several.out - h5mkgrp_several.out.err - h5mkgrp_several_v.h5 - h5mkgrp_several_v.out - h5mkgrp_several_v.out.err - h5mkgrp_several_p.h5 - h5mkgrp_several_p.out - h5mkgrp_several_p.out.err - h5mkgrp_several_l.h5 - h5mkgrp_several_l.out - h5mkgrp_several_l.out.err - h5mkgrp_nested_p.h5 - h5mkgrp_nested_p.out - h5mkgrp_nested_p.out.err - h5mkgrp_nested_lp.h5 - h5mkgrp_nested_lp.out - h5mkgrp_nested_lp.out.err - h5mkgrp_nested_mult_p.h5 - h5mkgrp_nested_mult_p.out - h5mkgrp_nested_mult_p.out.err - h5mkgrp_nested_mult_lp.h5 - h5mkgrp_nested_mult_lp.out - h5mkgrp_nested_mult_lp.out.err + COMMAND ${CMAKE_COMMAND} -E remove + h5mkgrp_single.h5 + h5mkgrp_single_v.h5 + h5mkgrp_single_p.h5 + h5mkgrp_single_l.h5 + h5mkgrp_several.h5 + h5mkgrp_several_v.h5 + h5mkgrp_several_p.h5 + h5mkgrp_several_l.h5 + h5mkgrp_nested_p.h5 + h5mkgrp_nested_lp.h5 + h5mkgrp_nested_mult_p.h5 + h5mkgrp_nested_mult_lp.h5 + ) + set_tests_properties (H5MKGRP-clearall-objects PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (last_test) - set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5MKGRP-clearall-objects") endif () # Check that help & version is displayed properly diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 24b6004..fa49c53 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -80,31 +80,46 @@ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. - add_test (NAME H5REPART-h5repart_20K COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5) + add_test ( + NAME H5REPART-h5repart_20K + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 family_file%05d.h5 fst_family%05d.h5 + ) set_tests_properties (H5REPART-h5repart_20K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # repartition family member size to 5 KB. - add_test (NAME H5REPART-h5repart_5K COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5) + add_test ( + NAME H5REPART-h5repart_5K + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 5k family_file%05d.h5 scd_family%05d.h5 + ) set_tests_properties (H5REPART-h5repart_5K PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes - add_test (NAME H5REPART-h5repart_single COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) + add_test ( + NAME H5REPART-h5repart_single + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5 + ) set_tests_properties (H5REPART-h5repart_single PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # convert family file to sec2 file of 20,000 bytes (old argument) - add_test (NAME H5REPART-h5repart_sec2 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) + add_test ( + NAME H5REPART-h5repart_sec2 + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5 + ) set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES FIXTURES_REQUIRED clear_testrepart ) # test the output files repartitioned above. - add_test (NAME H5REPART-h5repart_test COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) + add_test ( + NAME H5REPART-h5repart_test + COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ + ) set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" ) diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index f0eb65f..f0ae416 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -67,8 +67,10 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) -set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_h5perf_serial PROPERTIES + TIMEOUT ${CTEST_VERY_LONG_TIMEOUT} + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_BUILD_PERFORM_STANDALONE) add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -89,7 +91,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_chunk PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_chunk PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -106,7 +110,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_iopipe PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_iopipe PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -123,7 +129,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_overhead PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_overhead PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) @@ -140,7 +148,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_perf_meta PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_perf_meta PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ "-h") @@ -157,7 +167,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_zip_perf_help PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_zip_perf_help PROPERTIES + DEPENDS "PERFORM_h5perform-clearall-objects" +) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ tfilters.h5) @@ -174,7 +186,9 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") +set_tests_properties (PERFORM_zip_perf PROPERTIES + DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects" +) if (H5_HAVE_PARALLEL) if (UNIX) -- cgit v0.12 From f723e0e7f19b778d9c865982fda5f76cc2f875e0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Jul 2019 16:28:54 -0500 Subject: HDFFV-10529 add note --- release_docs/RELEASE.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index fe40021..b4fa11c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,14 @@ New Features Configuration: ------------- + - Update CMake tests to use FIXTURES + + CMake test fixtures allow setup/cleanup tests and other dependency + requirements as properties for tests. This is more flexible for + modern CMake code. + + (ADB - 2019/07/23, HDFFV-10529) + - Windows PDB files are always installed There are build configuration or flag settings for Windows that may not @@ -55,7 +63,7 @@ New Features utility will fail because those PDB files are not found. An optional variable, DISABLE_PDB_FILES, was added to not install PDB files. - (ADB - 2019/07/17, HDFFV-100424) + (ADB - 2019/07/17, HDFFV-10424) - Add mingw CMake support with a toolchain file -- cgit v0.12 From 8008294578b5a133907d7ab1dd20e34735c54535 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 25 Jul 2019 11:36:37 -0500 Subject: Squashed commit of the following: Merge changes from update_merged_S3_HDFS branch into develop. commit d5034315aea88629929ac0c9c59ebfafd5f21a31 Merge: 9c48823 d3fdcd8 Author: Larry Knox Date: Thu Jul 25 08:24:53 2019 -0500 Merge branch 'develop' into update_merged_S3_HDFS --- CMakeLists.txt | 21 + MANIFEST | 22 + bin/trace | 2 + config/cmake/ConfigureChecks.cmake | 15 + config/cmake/FindHDFS.cmake | 70 + config/cmake/H5pubconf.h.in | 31 + config/cmake/libhdf5.settings.cmake.in | 2 + configure.ac | 125 + java/examples/groups/JavaGroupExample.sh.in | 2 + java/src/Makefile.am | 2 + java/src/hdf/hdf5lib/CMakeLists.txt | 2 + java/src/hdf/hdf5lib/H5.java | 10 + java/src/hdf/hdf5lib/HDF5Constants.java | 6 + java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 102 + java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 121 + java/src/jni/h5Constants.c | 4 + java/test/CMakeLists.txt | 14 + java/test/Makefile.am | 2 + java/test/TestAll.java | 1 + java/test/TestH5Pfapl.java | 4 + java/test/TestH5Pfaplhdfs.java | 393 ++ java/test/TestH5Pfapls3.java | 406 +++ java/test/junit.sh.in | 48 + java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt | 9 + java/test/testfiles/JUnit-TestH5Pfapls3.txt | 10 + src/CMakeLists.txt | 7 + src/H5FDhdfs.c | 2070 +++++++++++ src/H5FDhdfs.h | 122 + src/H5FDros3.c | 1847 ++++++++++ src/H5FDros3.h | 105 + src/H5FDs3comms.c | 3770 ++++++++++++++++++++ src/H5FDs3comms.h | 634 ++++ src/Makefile.am | 8 +- src/hdf5.h | 18 +- src/libhdf5.settings.in | 2 + test/CMakeLists.txt | 3 + test/CMakeVFDTests.cmake | 1 + test/Makefile.am | 16 +- test/hdfs.c | 1836 ++++++++++ test/ros3.c | 2020 +++++++++++ test/s3comms.c | 2813 +++++++++++++++ test/vfd.c | 167 +- tools/CMakeLists.txt | 7 + tools/lib/h5tools_utils.c | 517 ++- tools/lib/h5tools_utils.h | 10 + tools/libtest/CMakeLists.txt | 21 + tools/libtest/CMakeTests.cmake | 49 + tools/libtest/Makefile.am | 34 + tools/libtest/h5tools_utils.c | 1296 +++++++ tools/src/h5dump/h5dump.c | 330 +- tools/src/h5ls/h5ls.c | 321 +- tools/src/h5stat/h5stat.c | 251 +- tools/test/h5stat/testfiles/h5stat_help1.ddl | 10 + tools/test/h5stat/testfiles/h5stat_help2.ddl | 10 + tools/test/h5stat/testfiles/h5stat_nofile.ddl | 10 + tools/testfiles/h5dump-help.txt | 10 + tools/testfiles/help-1.ls | 9 + tools/testfiles/help-2.ls | 9 + tools/testfiles/help-3.ls | 9 + .../pbits/tnofilename-with-packed-bits.ddl | 10 + tools/testfiles/pbits/tpbitsIncomplete.ddl | 10 + tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 10 + tools/testfiles/pbits/tpbitsLengthPositive.ddl | 10 + tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 10 + tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 10 + tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 10 + tools/testfiles/textlinksrc-nodangle-1.ls | 9 + tools/testfiles/tgroup-1.ls | 9 + 68 files changed, 19629 insertions(+), 225 deletions(-) create mode 100644 config/cmake/FindHDFS.cmake create mode 100644 java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java create mode 100644 java/test/TestH5Pfaplhdfs.java create mode 100644 java/test/TestH5Pfapls3.java create mode 100644 java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt create mode 100644 java/test/testfiles/JUnit-TestH5Pfapls3.txt create mode 100644 src/H5FDhdfs.c create mode 100644 src/H5FDhdfs.h create mode 100644 src/H5FDros3.c create mode 100644 src/H5FDros3.h create mode 100644 src/H5FDs3comms.c create mode 100644 src/H5FDs3comms.h create mode 100644 test/hdfs.c create mode 100644 test/ros3.c create mode 100644 test/s3comms.c create mode 100644 tools/libtest/CMakeLists.txt create mode 100644 tools/libtest/CMakeTests.cmake create mode 100644 tools/libtest/Makefile.am create mode 100644 tools/libtest/h5tools_utils.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 95d24bb..dc6a94f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -574,6 +574,27 @@ include (${HDF_RESOURCES_DIR}/HDFCompilerFlags.cmake) set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${HDF_RESOURCES_EXT_DIR} ${CMAKE_MODULE_PATH}) #----------------------------------------------------------------------------- +# Option to Enable HDFS +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_HDFS "Enable HDFS" OFF) +if (HDF5_ENABLE_HDFS) + find_package(JNI REQUIRED) + if (JNI_FOUND) + set (H5_HAVE_LIBJVM 1) + endif () + find_package(HDFS REQUIRED) + if (HDFS_FOUND) + set (H5_HAVE_LIBHDFS 1) + set (H5_HAVE_HDFS_H 1) + if (NOT MSVC) + list (APPEND LINK_LIBS -pthread) + endif () + else () + message (FATAL_ERROR "Set to use libhdfs library, but could not find or use libhdfs. Please verify that the path to HADOOP_HOME is valid, and/or reconfigure without HDF5_ENABLE_HDFS") + endif () +endif () + +#----------------------------------------------------------------------------- # Option to Enable MPI Parallel #----------------------------------------------------------------------------- option (HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF) diff --git a/MANIFEST b/MANIFEST index 8403d60..02feb72 100644 --- a/MANIFEST +++ b/MANIFEST @@ -636,6 +636,8 @@ ./src/H5FDdrvr_module.h ./src/H5FDfamily.c ./src/H5FDfamily.h +./src/H5FDhdfs.c +./src/H5FDhdfs.h ./src/H5FDint.c ./src/H5FDlog.c ./src/H5FDlog.h @@ -646,9 +648,13 @@ ./src/H5FDmpio.h ./src/H5FDmulti.c ./src/H5FDmulti.h +./src/H5FDros3.c +./src/H5FDros3.h ./src/H5FDpkg.h ./src/H5FDprivate.h ./src/H5FDpublic.h +./src/H5FDs3comms.h +./src/H5FDs3comms.c ./src/H5FDsec2.c ./src/H5FDsec2.h ./src/H5FDspace.c @@ -1069,6 +1075,7 @@ ./test/h5fc_ext_none.h5 ./test/h5test.c ./test/h5test.h +./test/hdfs.c ./test/hyperslab.c ./test/istore.c ./test/le_data.h5 @@ -1094,7 +1101,9 @@ ./test/paged_nopersist.h5 ./test/paged_persist.h5 ./test/reserved.c +./test/ros3.c ./test/pool.c +./test/s3comms.c ./test/set_extent.c # ====distribute this for now. See HDFFV-8236==== ./test/space_overflow.c @@ -1546,6 +1555,9 @@ ./tools/lib/io_timer.c ./tools/lib/io_timer.h +./tools/libtest/Makefile.am +./tools/libtest/h5tools_utils.c + ./tools/src/misc/Makefile.am ./tools/src/misc/h5clear.c ./tools/src/misc/h5debug.c @@ -3015,6 +3027,8 @@ ./java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java ./java/src/hdf/hdf5lib/structs/H5E_error2_t.java ./java/src/hdf/hdf5lib/structs/H5F_info2_t.java +./java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +./java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java ./java/src/hdf/hdf5lib/structs/H5G_info_t.java ./java/src/hdf/hdf5lib/structs/H5L_info_t.java ./java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -3178,6 +3192,8 @@ ./java/test/testfiles/JUnit-TestH5P.txt ./java/test/testfiles/JUnit-TestH5PData.txt ./java/test/testfiles/JUnit-TestH5Pfapl.txt +./java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt +./java/test/testfiles/JUnit-TestH5Pfapls3.txt ./java/test/testfiles/JUnit-TestH5Plist.txt ./java/test/testfiles/JUnit-TestH5Pvirtual.txt ./java/test/testfiles/JUnit-TestH5PL.txt @@ -3216,6 +3232,8 @@ ./java/test/TestH5P.java ./java/test/TestH5PData.java ./java/test/TestH5Pfapl.java +./java/test/TestH5Pfaplhdfs.java +./java/test/TestH5Pfapls3.java ./java/test/TestH5Plist.java ./java/test/TestH5Pvirtual.java ./java/test/TestH5PL.java @@ -3249,6 +3267,7 @@ ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake +./config/cmake/FindHDFS.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in @@ -3358,6 +3377,8 @@ ./testpar/CMakeVFDTests.cmake ./tools/CMakeLists.txt ./tools/lib/CMakeLists.txt +./tools/libtest/CMakeLists.txt +./tools/libtest/CMakeTests.cmake ./tools/src/CMakeLists.txt ./tools/test/CMakeLists.txt ./tools/src/h5copy/CMakeLists.txt @@ -3478,6 +3499,7 @@ ./testpar/Makefile.in ./tools/Makefile.in ./tools/lib/Makefile.in +./tools/libtest/Makefile.in ./tools/src/Makefile.in ./tools/src/h5copy/Makefile.in ./tools/src/h5diff/Makefile.in diff --git a/bin/trace b/bin/trace index 50660fe..241c69c 100755 --- a/bin/trace +++ b/bin/trace @@ -139,6 +139,8 @@ $Source = ""; "H5FD_t" => "x", "H5FD_class_t" => "x", "H5FD_stream_fapl_t" => "x", + "H5FD_ros3_fapl_t" => "x", + "H5FD_hdfs_fapl_t" => "x", "H5FD_file_image_callbacks_t" => "x", "H5G_iterate_t" => "x", "H5G_info_t" => "x", diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 3bd0553..f295a1c 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -155,6 +155,21 @@ if (NOT WINDOWS) endif () #----------------------------------------------------------------------------- +# Check if ROS3 driver works +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) + if (HDF5_ENABLE_ROS3_VFD) + find_package(CURL REQUIRED) + find_package(OpenSSL REQUIRED) + if (${CURL_FOUND} AND ${OPENSSL_FOUND}) + set (${HDF_PREFIX}_HAVE_ROS3_VFD 1) + list (APPEND LINK_LIBS ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + else () + message (STATUS "The Read-Only S3 VFD was requested but cannot be built.\nPlease check that openssl and cURL are available on your\nsystem, and/or re-configure without option HDF5_ENABLE_ROS3_VFD.") + endif () +endif () + +#----------------------------------------------------------------------------- # Check if C has __float128 extension #----------------------------------------------------------------------------- diff --git a/config/cmake/FindHDFS.cmake b/config/cmake/FindHDFS.cmake new file mode 100644 index 0000000..e401a94 --- /dev/null +++ b/config/cmake/FindHDFS.cmake @@ -0,0 +1,70 @@ + +# DerivedFrom: https://github.com/cloudera/Impala/blob/cdh5-trunk/cmake_modules/FindHDFS.cmake +# - Find HDFS (hdfs.h and libhdfs.so) +# This module defines +# Hadoop_VERSION, version string of ant if found +# HDFS_INCLUDE_DIR, directory containing hdfs.h +# HDFS_LIBRARIES, location of libhdfs.so +# HDFS_FOUND, whether HDFS is found. + +exec_program($ENV{HADOOP_HOME}/bin/hadoop ARGS version OUTPUT_VARIABLE Hadoop_VERSION + RETURN_VALUE Hadoop_RETURN) + +# currently only looking in HADOOP_HOME +find_path(HDFS_INCLUDE_DIR hdfs.h PATHS + $ENV{HADOOP_HOME}/include/ + # make sure we don't accidentally pick up a different version + NO_DEFAULT_PATH +) + +if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") + set(arch_hint "x64") +elseif ("$ENV{LIB}" MATCHES "(amd64|ia64)") + set(arch_hint "x64") +else () + set(arch_hint "x86") +endif() + +message(STATUS "Architecture: ${arch_hint}") + +if ("${arch_hint}" STREQUAL "x64") + set(HDFS_LIB_PATHS $ENV{HADOOP_HOME}/lib/native) +else () + set(HDFS_LIB_PATHS $ENV{HADOOP_HOME}/lib/native) +endif () + +message(STATUS "HDFS_LIB_PATHS: ${HDFS_LIB_PATHS}") + +find_library(HDFS_LIB NAMES hdfs PATHS + ${HDFS_LIB_PATHS} + # make sure we don't accidentally pick up a different version + NO_DEFAULT_PATH +) + +if (HDFS_LIB) + set(HDFS_FOUND TRUE) + set(HDFS_LIBRARIES ${HDFS_LIB}) + set(HDFS_STATIC_LIB ${HDFS_LIB_PATHS}/${CMAKE_STATIC_LIBRARY_PREFIX}hdfs${CMAKE_STATIC_LIBRARY_SUFFIX}) + + add_library(hdfs_static STATIC IMPORTED) + set_target_properties(hdfs_static PROPERTIES IMPORTED_LOCATION ${HDFS_STATIC_LIB}) +else () + set(HDFS_FOUND FALSE) +endif () + +if (HDFS_FOUND) + if (NOT HDFS_FIND_QUIETLY) + message(STATUS "${Hadoop_VERSION}") + message(STATUS "HDFS_INCLUDE_DIR: ${HDFS_INCLUDE_DIR}") + message(STATUS "HDFS_LIBRARIES: ${HDFS_LIBRARIES}") + message(STATUS "hdfs_static: ${HDFS_STATIC_LIB}") + endif () +else () + message(FATAL_ERROR "HDFS includes and libraries NOT found." + "(${HDFS_INCLUDE_DIR}, ${HDFS_LIB})") +endif () + +mark_as_advanced( + HDFS_LIBRARIES + HDFS_INCLUDE_DIR +) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 9e7b8b7..cb05974 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -110,6 +110,9 @@ /* Define if the function stack tracing code is to be compiled in */ #cmakedefine H5_HAVE_CODESTACK @H5_HAVE_CODESTACK@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_CURL_H @H5_HAVE_CURL_H@ + /* Define if Darwin or Mac OS X */ #cmakedefine H5_HAVE_DARWIN @H5_HAVE_DARWIN@ @@ -185,6 +188,9 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine H5_HAVE_GETTIMEOFDAY @H5_HAVE_GETTIMEOFDAY@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_HDFS_H @H5_HAVE_HDFS_H@ + /* Define if the compiler understands inline */ #cmakedefine H5_HAVE_INLINE @H5_HAVE_INLINE@ @@ -201,12 +207,24 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_IO_H @H5_HAVE_IO_H@ +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#cmakedefine H5_HAVE_LIBCRYPTO @H5_HAVE_LIBCRYPTO@ + +/* Define to 1 if you have the `curl' library (-lcurl). */ +#cmakedefine H5_HAVE_LIBCURL @H5_HAVE_LIBCURL@ + /* Define to 1 if you have the `dl' library (-ldl). */ #cmakedefine H5_HAVE_LIBDL @H5_HAVE_LIBDL@ /* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ #cmakedefine H5_HAVE_LIBDMALLOC @H5_HAVE_LIBDMALLOC@ +/* Proceed to build with libhdfs */ +#cmakedefine H5_HAVE_LIBHDFS @H5_HAVE_LIBHDFS@ + +/* Define to 1 if you have the `jvm' library (-ljvm). */ +#cmakedefine H5_HAVE_LIBJVM @H5_HAVE_LIBJVM@ + /* Define to 1 if you have the `m' library (-lm). */ #cmakedefine H5_HAVE_LIBM @H5_HAVE_LIBM@ @@ -264,6 +282,15 @@ /* Define if MPI_Info_c2f and MPI_Info_f2c exists */ #cmakedefine H5_HAVE_MPI_MULTI_LANG_Info @H5_HAVE_MPI_MULTI_LANG_Info@ +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_OPENSSL_EVP_H @H5_HAVE_OPENSSL_EVP_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_OPENSSL_HMAC_H @H5_HAVE_OPENSSL_HMAC_H@ + +/* Define to 1 if you have the header file. */ +#cmakedefine H5_HAVE_OPENSSL_SHA_H @H5_HAVE_OPENSSL_SHA_H@ + /* Define if we have parallel support */ #cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ @@ -282,6 +309,10 @@ /* Define to 1 if you have the `rand_r' function. */ #cmakedefine H5_HAVE_RAND_R @H5_HAVE_RAND_R@ +/* Define whether the Read-Only S3 virtual file driver (VFD) should be + compiled */ +#cmakedefine H5_HAVE_ROS3_VFD @H5_HAVE_ROS3_VFD@ + /* Define to 1 if you have the `round' function. */ #cmakedefine H5_HAVE_ROUND @H5_HAVE_ROUND@ diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 2117f3b..3451545 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -76,6 +76,8 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @H5_HAVE_LIBLMPE@ Direct VFD: @H5_HAVE_DIRECT@ + (Read-Only) S3 VFD: @H5_HAVE_ROS3_VFD@ + (Read-Only) HDFS VFD: @H5_HAVE_LIBHDFS@ dmalloc: @H5_HAVE_LIBDMALLOC@ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ API Tracing: @HDF5_ENABLE_TRACE@ diff --git a/configure.ac b/configure.ac index d1d209f..3d6ab10 100644 --- a/configure.ac +++ b/configure.ac @@ -2809,6 +2809,130 @@ fi AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- +## Check if Read-Only S3 virtual file driver is enabled by --enable-ros3-vfd +## +AC_SUBST([ROS3_VFD]) + +## Default is no Read-Only S3 VFD +ROS3_VFD=no + +AC_ARG_ENABLE([ros3-vfd], + [AS_HELP_STRING([--enable-ros3-vfd], + [Build the Read-Only S3 virtual file driver (VFD). + [default=no]])], + [ROS3_VFD=$enableval], [ROS3_VFD=no]) + +if test "X$ROS3_VFD" = "Xyes"; then + AC_CHECK_HEADERS([curl/curl.h],, [unset ROS3_VFD]) + AC_CHECK_HEADERS([openssl/evp.h],, [unset ROS3_VFD]) + AC_CHECK_HEADERS([openssl/hmac.h],, [unset ROS3_VFD]) + AC_CHECK_HEADERS([openssl/sha.h],, [unset ROS3_VFD]) + if test "X$ROS3_VFD" = "Xyes"; then + AC_CHECK_LIB([curl], [curl_global_init],, [unset ROS3_VFD]) + AC_CHECK_LIB([crypto], [EVP_sha256],, [unset ROS3_VFD]) + fi + + AC_MSG_CHECKING([if the Read-Only S3 virtual file driver (VFD) is enabled]) + if test "X$ROS3_VFD" = "Xyes"; then + AC_DEFINE([HAVE_ROS3_VFD], [1], + [Define whether the Read-Only S3 virtual file driver (VFD) should be compiled]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + ROS3_VFD=no + AC_MSG_ERROR([The Read-Only S3 VFD was requested but cannot be built. + Please check that openssl and cURL are available on your + system, and/or re-configure without option + --enable-ros3-vfd.]) + fi +else + AC_MSG_CHECKING([if the Read-Only S3 virtual file driver (VFD) is enabled]) + AC_MSG_RESULT([no]) + ROS3_VFD=no + +fi +## ---------------------------------------------------------------------- +## Is libhdfs (Hadoop Distributed File System) present? +## It might be specified with the `--with-libhdfs' command-line switch. +## If found, enables the HDFS VFD. +## +AC_SUBST([HAVE_LIBHDFS]) +AC_ARG_WITH([libhdfs], + [AS_HELP_STRING([--with-libhdfs=DIR], + [Provide libhdfs library to enable HDFS virtual file driver (VFD) [default=no]])],, + [withval=no]) + +case $withval in + no) + HAVE_LIBHDFS="no" + AC_MSG_CHECKING([for libhdfs]) + AC_MSG_RESULT([suppressed]) + ;; + *) + HAVE_LIBHDFS="yes" + case "$withval" in + *,*) + libhdfs_inc="`echo $withval |cut -f1 -d,`" + libhdfs_lib="`echo $withval |cut -f2 -d, -s`" + ;; + yes) + libhdfs_inc="$HADOOP_HOME/include" + libhdfs_lib="$HADOOP_HOME/lib" + ;; + *) + if test -n "$withval"; then + libhdfs_inc="$withval/include" + libhdfs_lib="$withval/lib" + fi + ;; + esac + + if test -n "$libhdfs_inc"; then + CPPFLAGS="$CPPFLAGS -I$libhdfs_inc" + AM_CPPFLAGS="$AM_CPPFLAGS -I$libhdfs_inc" + fi + AC_CHECK_HEADERS([hdfs.h],, + [unset HAVE_LIBHDFS]) + + if test "x$HAVE_LIBHDFS" = "xyes"; then + dnl Check for '-ljvm' needed by libhdfs + JNI_LDFLAGS="" + if test $JAVA_HOME != "" + then + JNI_LDFLAGS="-L$JAVA_HOME/jre/lib/$OS_ARCH -L$JAVA_HOME/jre/lib/$OS_ARCH/server" + fi + ldflags_bak=$LDFLAGS + LDFLAGS="$LDFLAGS $JNI_LDFLAGS" + AC_CHECK_LIB([jvm], [JNI_GetCreatedJavaVMs]) + LDFLAGS=$ldflags_bak + AC_SUBST([JNI_LDFLAGS]) + if test -n "$libhdfs_lib"; then + ## Hadoop distribution hides libraries down one level in 'lib/native' + libhdfs_lib="$libhdfs_lib/native" + LDFLAGS="$LDFLAGS -L$libhdfs_lib $JNI_LDFLAGS" + AM_LDFLAGS="$AM_LDFLAGS -L$libhdfs_lib $JNI_LDFLAGS" + fi + AC_CHECK_LIB([hdfs], [hdfsConnect],, + [unset HAVE_LIBHDFS]) + fi + + if test -z "$HAVE_LIBHDFS"; then + AC_MSG_ERROR([Set to use libhdfs library, but could not find or use + libhdfs. Please verify that the path to HADOOP_HOME is + valid, and/or reconfigure without --with-libhdfs.]) + fi + ;; +esac + +if test "x$HAVE_LIBHDFS" = "xyes"; then + AC_DEFINE([HAVE_LIBHDFS], [1], + [Proceed to build with libhdfs]) +fi + +## Checkpoint the cache +AC_CACHE_SAVE + +## ---------------------------------------------------------------------- ## Enable custom plugin default path for library. It requires SHARED support. ## AC_MSG_CHECKING([for custom plugin default path definition]) @@ -3537,6 +3661,7 @@ AC_CONFIG_FILES([src/libhdf5.settings testpar/testpflush.sh tools/Makefile tools/lib/Makefile + tools/libtest/Makefile tools/src/Makefile tools/src/h5dump/Makefile tools/src/h5import/Makefile diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 9d4673f..3ba512a 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -64,6 +64,8 @@ $HDFTEST_HOME/h5ex_g_iterate.h5 $HDFTEST_HOME/h5ex_g_visit.h5 " LIST_DATA_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.h5 +$HDFTEST_HOME/h5ex_g_visit.h5 $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt diff --git a/java/src/Makefile.am b/java/src/Makefile.am index bd55c39..fcdeae9 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -98,6 +98,8 @@ hdf5_java_JAVA = \ ${pkgpath}/structs/H5A_info_t.java \ ${pkgpath}/structs/H5E_error2_t.java \ ${pkgpath}/structs/H5F_info2_t.java \ + ${pkgpath}/structs/H5FD_hdfs_fapl_t.java \ + ${pkgpath}/structs/H5FD_ros3_fapl_t.java \ ${pkgpath}/structs/H5G_info_t.java \ ${pkgpath}/structs/H5L_info_t.java \ ${pkgpath}/structs/H5O_info_t.java \ diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index c171ea8..be8f60a 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -73,6 +73,8 @@ set (HDF5_JAVA_HDF_HDF5_STRUCTS_SOURCES structs/H5AC_cache_config_t.java structs/H5E_error2_t.java structs/H5F_info2_t.java + structs/H5FD_ros3_fapl_t.java + structs/H5FD_hdfs_fapl_t.java structs/H5G_info_t.java structs/H5L_info_t.java structs/H5O_hdr_info_t.java diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index a1a8ede..481ca8c 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -50,6 +50,8 @@ import hdf.hdf5lib.structs.H5AC_cache_config_t; import hdf.hdf5lib.structs.H5A_info_t; import hdf.hdf5lib.structs.H5E_error2_t; import hdf.hdf5lib.structs.H5F_info2_t; +import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; +import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import hdf.hdf5lib.structs.H5G_info_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; @@ -7796,6 +7798,10 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fapl_family(long fapl_id, long memb_size, long memb_fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_hdfs(long fapl_id, H5FD_hdfs_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native H5FD_hdfs_fapl_t H5Pget_fapl_hdfs(long fapl_id) throws HDF5LibraryException, NullPointerException; + /** * H5Pget_fapl_multi Sets up use of the multi I/O driver. * @@ -7880,6 +7886,10 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Pset_fapl_windows(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_ros3(long fapl_id, H5FD_ros3_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native H5FD_ros3_fapl_t H5Pget_fapl_ros3(long fapl_id) throws HDF5LibraryException, NullPointerException; + // /////// unimplemented //////// // Generic property list routines // diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index cb5ed22..2e80f2e 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -246,6 +246,8 @@ public class HDF5Constants { public static final long H5FD_SEC2 = H5FD_SEC2(); public static final long H5FD_STDIO = H5FD_STDIO(); public static final long H5FD_WINDOWS = H5FD_WINDOWS(); + public static final long H5FD_ROS3 = H5FD_ROS3(); + public static final long H5FD_HDFS = H5FD_HDFS(); public static final int H5FD_LOG_LOC_READ = H5FD_LOG_LOC_READ(); public static final int H5FD_LOG_LOC_WRITE = H5FD_LOG_LOC_WRITE(); public static final int H5FD_LOG_LOC_SEEK = H5FD_LOG_LOC_SEEK(); @@ -1111,6 +1113,10 @@ public class HDF5Constants { private static native final long H5FD_WINDOWS(); + private static native final long H5FD_ROS3(); + + private static native final long H5FD_HDFS(); + private static native final int H5FD_LOG_LOC_READ(); private static native final int H5FD_LOG_LOC_WRITE(); diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java new file mode 100644 index 0000000..f56a038 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -0,0 +1,102 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only HDFS Virtual File Driver (VFD) * + * Copyright (c) 2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +/* + * Java representation of the HDFS VFD file access property list (fapl) + * structure. + * + * Used for the access of files hosted on the Hadoop Distributed File System. + */ + +@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly +public class H5FD_hdfs_fapl_t implements Serializable { + + private long version; + private String namenode_name; + private String user_name; + private String kerberos_ticket_cache; + private int namenode_port; + private int stream_buffer_size; + + /** + * Create a fapl_t structure with the specified components. + */ + public H5FD_hdfs_fapl_t( + String namenode_name, + int namenode_port, + String user_name, + String kerberos_ticket_cache, + int stream_buffer_size) + { + this.version = 1; + this.namenode_name = namenode_name; + this.namenode_port = namenode_port; + this.user_name = user_name; + this.kerberos_ticket_cache = kerberos_ticket_cache; + this.stream_buffer_size = stream_buffer_size; + } + + @Override + public boolean equals(Object o) { + if (o == null) + return false; + if (!(o instanceof H5FD_hdfs_fapl_t)) + return false; + + H5FD_hdfs_fapl_t other = (H5FD_hdfs_fapl_t)o; + if (this.version != other.version) + return false; + if (!this.namenode_name.equals(other.namenode_name)) + return false; + if (this.namenode_port != other.namenode_port) + return false; + if (!this.user_name.equals(other.user_name)) + return false; + if (!this.kerberos_ticket_cache.equals(other.kerberos_ticket_cache)) + return false; + if (this.stream_buffer_size != other.stream_buffer_size) + return false; + return true; + } + + @Override + public int hashCode() { + /* this is a _very bad_ hash algorithm for purposes of hashing! */ + /* implemented to satisfy the "contract" regarding equality */ + int k = (int)this.version; + k += this.namenode_name.length(); + k += this.user_name.length(); + k += this.kerberos_ticket_cache.length(); + k += namenode_port; + k += stream_buffer_size; + return k; + } + + @Override + public String toString() { + return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" + + "\n namenode_name: '" + this.namenode_name + + "'\n namenode_port: " + this.namenode_port + + "\n user_name: '" + this.user_name + + "'\n kerberos_ticket_cache: '" + this.kerberos_ticket_cache + + "'\n stream_buffer_size: " + this.stream_buffer_size + + "\n}\n"; + } +} + + diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java new file mode 100644 index 0000000..6b086c3 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +/* + * Java representation of the ROS3 VFD file access property list (fapl) + * structure. + * + * Used for the access of files hosted remotely on S3 by Amazon. + * + * For simplicity, implemented assuming that all ROS3 fapls have components: + * - version + * - aws_region + * - secret_id + * - secret_key + * + * Future implementations may be created to enable different fapl "shapes" + * depending on provided version. + * + * proposed: + * + * H5FD_ros3_fapl_t (super class, has only version field) + * H5FD_ros3_fapl_v1_t (extends super with Version 1 components) + * H5FD_ros3_fapl_v2_t (extends super with Version 2 components) + * and so on, for each version + * + * "super" is passed around, and is version-checked and re-cast as + * appropriate + */ + +@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly +public class H5FD_ros3_fapl_t implements Serializable { + + private long version; + private String aws_region; + private String secret_id; + private String secret_key; + + /** + * Create a "default" fapl_t structure, for anonymous access. + */ + public H5FD_ros3_fapl_t () { + /* H5FD_ros3_fapl_t("", "", ""); */ /* defer */ + this.version = 1; + this.aws_region = ""; + this.secret_id = ""; + this.secret_key = ""; + } + + /** + * Create a fapl_t structure with the specified components. + * If all are the empty string, is anonymous (non-authenticating). + * Region and ID must both be supplied for authentication. + * + * @param region "aws region" for authenticating request + * @param id "secret id" or "access id" for authenticating request + * @param key "secret key" or "access key" for authenticating request + */ + public H5FD_ros3_fapl_t (String region, String id, String key) { + this.version = 1; /* must equal H5FD__CURR_ROS3_FAPL_T_VERSION */ + /* as found in H5FDros3.h */ + this.aws_region = region; + this.secret_id = id; + this.secret_key = key; + } + + @Override + public boolean equals(Object o) { + if (o == null) + return false; + if (!(o instanceof H5FD_ros3_fapl_t)) + return false; + + H5FD_ros3_fapl_t other = (H5FD_ros3_fapl_t)o; + if (this.version != other.version) + return false; + if (!this.aws_region.equals(other.aws_region)) + return false; + if (!this.secret_key.equals(other.secret_key)) + return false; + if (!this.secret_id.equals(other.secret_id)) + return false; + return true; + } + + @Override + public int hashCode() { + /* this is a _very bad_ hash algorithm for purposes of hashing! */ + /* implemented to satisfy the "contract" regarding equality */ + int k = (int)this.version; + k += this.aws_region.length(); + k += this.secret_id.length(); + k += this.secret_key.length(); + return k; + } + + @Override + public String toString() { + return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" + + "\n aws_region : " + this.aws_region + + "\n secret_id : " + this.secret_id + + "\n secret_key : " + this.secret_key + + "\n}\n"; + } +} + + diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index b9e320f..ac55a13 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -453,6 +453,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { return H5FD_HDFS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; } @@ -461,6 +463,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5F JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { return H5FD_ROS3; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) { diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 3298a47..dfb6e72 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -51,6 +51,20 @@ if (NOT HDF5_ENABLE_DEBUG_APIS) ) endif () +if (HDF5_ENABLE_ROS3_VFD) + set (HDF5_JAVA_TEST_SOURCES + ${HDF5_JAVA_TEST_SOURCES} + TestH5Pfapls3 + ) +endif () + +if (HDF5_ENABLE_HDFS) + set (HDF5_JAVA_TEST_SOURCES + ${HDF5_JAVA_TEST_SOURCES} + TestH5Pfaplhdfs + ) +endif () + set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LIB_DIR}/junit.jar;${HDF5_JAVA_LIB_DIR}/hamcrest-core.jar;${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_SIMPLE_JAR}") foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index af99d92..c375938 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -61,6 +61,8 @@ noinst_JAVA = \ TestH5P.java \ TestH5PData.java \ TestH5Pfapl.java \ + TestH5Pfaplhdfs.java \ + TestH5Pfapls3.java \ TestH5Pvirtual.java \ TestH5Plist.java \ TestH5A.java \ diff --git a/java/test/TestAll.java b/java/test/TestAll.java index 13cb597..c7c206c 100644 --- a/java/test/TestAll.java +++ b/java/test/TestAll.java @@ -27,6 +27,7 @@ import org.junit.runners.Suite; TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, TestH5R.class, TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, + TestH5Pfapls3.class, TestH5Pfaplhdfs.class, TestH5A.class, TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, TestH5PL.class, TestH5Z.class diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 10a79dd..81a7ecb 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -15,6 +15,7 @@ package test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -28,6 +29,8 @@ import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; import hdf.hdf5lib.structs.H5AC_cache_config_t; +import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; +import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; import org.junit.Before; @@ -1398,4 +1401,5 @@ public class TestH5Pfapl { fail("H5P_evict_on_close: " + err); } } + } diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java new file mode 100644 index 0000000..2b0a808 --- /dev/null +++ b/java/test/TestH5Pfaplhdfs.java @@ -0,0 +1,393 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; +import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; +import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Pfaplhdfs { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "testPf.h5"; + private static final String H5_LOG_FILE = "testPf.log"; + private static final String H5_FAMILY_FILE = "testPf%05d"; + private static final String H5_MULTI_FILE = "testPfmulti"; + private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int DIMF_X = 12; + private static final int DIMF_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5Fdsid = -1; + long H5Fdid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long fapl_id = -1; + long plapl_id = -1; + long dapl_id = -1; + long plist_id = -1; + long btplist_id = -1; + long[] H5Fdims = { DIMF_X, DIMF_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteLogFile() { + File file = null; + try { + file = new File(H5_LOG_FILE); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteFamilyFile() { + File file = null; + for(int indx = 0; ;indx++) { + java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); + try { + file = new File("test"+myFormat.format(new Integer(indx))+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + else + return; + } + } + + private final void _deleteMultiFile() { + File file = null; + for(int indx = 1;indx<7;indx++) { + try { + file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createDataset: ", did > 0); + + return did; + } + + private final void _createFloatDataset() { + try { + H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); + H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFileDS() { + try { + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5File(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5familyFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() { + _deleteFile(H5_FILE); + } + + public void deleteH5familyfile() { + _deleteFamilyFile(); + } + + public void deleteH5multifile() { + _deleteMultiFile(); + } + + @Before + public void createFileAccess() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(fapl_id > 0); + try { + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plapl_id > 0); + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plist_id > 0); + assertTrue(btplist_id > 0); + assertTrue(dapl_id > 0); + } + + @After + public void deleteFileAccess() throws HDF5LibraryException { + if (fapl_id > 0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (plapl_id > 0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (dapl_id > 0) + try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (btplist_id > 0) + try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + + if (H5Fdsid > 0) + try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} + if (H5Fdid > 0) + try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testHDFS_fapl() + throws Exception + { + if (HDF5Constants.H5FD_HDFS < 0) + throw new HDF5LibraryException("skip"); + + String nodename = "blues"; + int nodeport = 12345; + String username = "sparticus"; + String kerbcache = "/dev/null"; + int streamsize = 1024; + + final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t( + nodename, + nodeport, + username, + kerbcache, + streamsize + ); + assertTrue("setting fapl should succeed", + -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); + + assertEquals("driver types should match", + HDF5Constants.H5FD_HDFS, + H5.H5Pget_driver(fapl_id)); + + H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id); + assertEquals("fapl contents should match", + new H5FD_hdfs_fapl_t( + nodename, + nodeport, + username, + kerbcache, + streamsize), + copy); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_fapl_hdfs_invalid_fapl_id() + throws Exception + { + if (HDF5Constants.H5FD_HDFS < 0) + throw new HDF5LibraryException("skip"); + H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() + throws Exception + { + if (HDF5Constants.H5FD_HDFS < 0) + throw new HDF5LibraryException("skip"); + if (HDF5Constants.H5FD_SEC2 < 0 ) + throw new HDF5LibraryException("skip"); + /* TODO: for now, test against a sec2 fapl only */ + + H5.H5Pset_fapl_sec2(fapl_id); + assertEquals("fapl_id was not set properly", + HDF5Constants.H5FD_SEC2, + H5.H5Pget_driver(fapl_id)); + H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id); + } + +} diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java new file mode 100644 index 0000000..3107bc8 --- /dev/null +++ b/java/test/TestH5Pfapls3.java @@ -0,0 +1,406 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; +import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; +import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Pfapls3 { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "testPf.h5"; + private static final String H5_LOG_FILE = "testPf.log"; + private static final String H5_FAMILY_FILE = "testPf%05d"; + private static final String H5_MULTI_FILE = "testPfmulti"; + private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int DIMF_X = 12; + private static final int DIMF_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5Fdsid = -1; + long H5Fdid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long fapl_id = -1; + long plapl_id = -1; + long dapl_id = -1; + long plist_id = -1; + long btplist_id = -1; + long[] H5Fdims = { DIMF_X, DIMF_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteLogFile() { + File file = null; + try { + file = new File(H5_LOG_FILE); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteFamilyFile() { + File file = null; + for(int indx = 0; ;indx++) { + java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); + try { + file = new File("test"+myFormat.format(new Integer(indx))+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + else + return; + } + } + + private final void _deleteMultiFile() { + File file = null; + for(int indx = 1;indx<7;indx++) { + try { + file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createDataset: ", did > 0); + + return did; + } + + private final void _createFloatDataset() { + try { + H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); + H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFileDS() { + try { + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5File(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5familyFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() { + _deleteFile(H5_FILE); + } + + public void deleteH5familyfile() { + _deleteFamilyFile(); + } + + public void deleteH5multifile() { + _deleteMultiFile(); + } + + @Before + public void createFileAccess() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(fapl_id > 0); + try { + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plapl_id > 0); + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plist_id > 0); + assertTrue(btplist_id > 0); + assertTrue(dapl_id > 0); + } + + @After + public void deleteFileAccess() throws HDF5LibraryException { + if (fapl_id > 0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (plapl_id > 0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (dapl_id > 0) + try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (btplist_id > 0) + try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + + if (H5Fdsid > 0) + try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} + if (H5Fdid > 0) + try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pset_fapl_ros3() + throws Exception + { + if (HDF5Constants.H5FD_ROS3 < 0) + return; + + final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(); + assertEquals("Default fapl has unexpected contents", + new H5FD_ros3_fapl_t("", "", ""), + config); + + H5.H5Pset_fapl_ros3(fapl_id, config); + + assertEquals("driver types don't match", + HDF5Constants.H5FD_ROS3, + H5.H5Pget_driver(fapl_id)); + + /* get_fapl_ros3 can throw exception in error cases */ + H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); + assertEquals("contents of fapl set and get don't match", + new H5FD_ros3_fapl_t("", "", ""), + copy); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_fapl_ros3_invalid_fapl_id() + throws Exception + { + if (HDF5Constants.H5FD_ROS3 < 0) + throw new HDF5LibraryException("skip"); + H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() + throws Exception + { + if (HDF5Constants.H5FD_ROS3 < 0) + throw new HDF5LibraryException("skip"); + if (HDF5Constants.H5FD_SEC2 < 0 ) + throw new HDF5LibraryException("skip"); + /* TODO: for now, test against a sec2 fapl only */ + + H5.H5Pset_fapl_sec2(fapl_id); + assertEquals("fapl_id was not set properly", + HDF5Constants.H5FD_SEC2, + H5.H5Pget_driver(fapl_id)); + H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id); + } + + @Test + public void testH5Pset_fapl_ros3_specified() + throws Exception + { + if (HDF5Constants.H5FD_ROS3 < 0) + return; + + String region = "us-east-1"; + String acc_id = "my_access_id"; + String acc_key = "my_access_key"; + + final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t( + region, + acc_id, + acc_key); + H5.H5Pset_fapl_ros3(fapl_id, config); + assertEquals("driver types don't match", + HDF5Constants.H5FD_ROS3, + H5.H5Pget_driver(fapl_id)); + + H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); + assertEquals("contents of fapl set and get don't match", + new H5FD_ros3_fapl_t(region, acc_id, acc_key), + copy); + } + +} diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 7fb1bae..008c89c 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -18,6 +18,8 @@ srcdir=@srcdir@ USE_FILTER_SZIP="@USE_FILTER_SZIP@" USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" +USE_ROS3_VFD="@HAVE_ROS3_VFD@" +USE_HDFS_VFD="@HAVE_LIBHDFS@" TESTNAME=JUnitInterface EXIT_SUCCESS=0 @@ -93,6 +95,8 @@ $HDFTEST_HOME/testfiles/JUnit-TestH5R.txt $HDFTEST_HOME/testfiles/JUnit-TestH5P.txt $HDFTEST_HOME/testfiles/JUnit-TestH5PData.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Pfapl.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Pfapls3.txt +$HDFTEST_HOME/testfiles/JUnit-TestH5Pfaplhdfs.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Pvirtual.txt $HDFTEST_HOME/testfiles/JUnit-TestH5Plist.txt $HDFTEST_HOME/testfiles/JUnit-TestH5A.txt @@ -1096,6 +1100,50 @@ if test $USE_FILTER_SZIP = "yes"; then test yes = "$verbose" && $DIFF JUnit-TestH5Giterate.txt JUnit-TestH5Giterate.out |sed 's/^/ /' fi fi +if test $ROS3_VFD = "yes"; then + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3" + TESTING JUnit-TestH5Pfapls3 + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3 > JUnit-TestH5Pfapls3.ext) + + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Pfapls3.ext > JUnit-TestH5Pfapls3.out + + if diff JUnit-TestH5Pfapls3.out JUnit-TestH5Pfapls3.txt > /dev/null; then + echo " PASSED JUnit-TestH5Pfapls3" + else + echo "**FAILED** JUnit-TestH5Pfapls3" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Pfapls3.txt JUnit-TestH5Pfapls3.out |sed 's/^/ /' + fi +fi +if test $HAVE_LIBHDFS = "yes"; then + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs" + TESTING JUnit-TestH5Pfaplhdfs + ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs > JUnit-TestH5Pfaplhdfs.ext) + + # Extract file name, line number, version and thread IDs because they may be different + sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + JUnit-TestH5Pfaplhdfs.ext > JUnit-TestH5Pfaplhdfs.out + + if diff JUnit-TestH5Pfaplhdfs.out JUnit-TestH5Pfaplhdfs.txt > /dev/null; then + echo " PASSED JUnit-TestH5Pfaplhdfs" + else + echo "**FAILED** JUnit-TestH5Pfaplhdfs" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF JUnit-TestH5Pfaplhdfs.txt JUnit-TestH5Pfaplhdfs.out |sed 's/^/ /' + fi +fi # Clean up temporary files/directories diff --git a/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt new file mode 100644 index 0000000..47a00a4 --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Pfaplhdfs.txt @@ -0,0 +1,9 @@ +JUnit version 4.11 +.testH5Pget_fapl_hdfs_invalid_fapl_id +.testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type +.testHDFS_fapl + +Time: XXXX + +OK (3 tests) + diff --git a/java/test/testfiles/JUnit-TestH5Pfapls3.txt b/java/test/testfiles/JUnit-TestH5Pfapls3.txt new file mode 100644 index 0000000..3f46342 --- /dev/null +++ b/java/test/testfiles/JUnit-TestH5Pfapls3.txt @@ -0,0 +1,10 @@ +JUnit version 4.11 +.testH5Pset_fapl_ros3_specified +.testH5Pset_fapl_ros3 +.testH5Pget_fapl_ros3_invalid_fapl_id +.testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type + +Time: XXXX + +OK (4 tests) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4106515..2b693bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -227,11 +227,14 @@ set (H5FD_SOURCES ${HDF5_SRC_DIR}/H5FDcore.c ${HDF5_SRC_DIR}/H5FDdirect.c ${HDF5_SRC_DIR}/H5FDfamily.c + ${HDF5_SRC_DIR}/H5FDhdfs.c ${HDF5_SRC_DIR}/H5FDint.c ${HDF5_SRC_DIR}/H5FDlog.c ${HDF5_SRC_DIR}/H5FDmpi.c ${HDF5_SRC_DIR}/H5FDmpio.c ${HDF5_SRC_DIR}/H5FDmulti.c + ${HDF5_SRC_DIR}/H5FDros3.c + ${HDF5_SRC_DIR}/H5FDs3comms.c ${HDF5_SRC_DIR}/H5FDsec2.c ${HDF5_SRC_DIR}/H5FDspace.c ${HDF5_SRC_DIR}/H5FDstdio.c @@ -243,11 +246,14 @@ set (H5FD_HDRS ${HDF5_SRC_DIR}/H5FDcore.h ${HDF5_SRC_DIR}/H5FDdirect.h ${HDF5_SRC_DIR}/H5FDfamily.h + ${HDF5_SRC_DIR}/H5FDhdfs.h ${HDF5_SRC_DIR}/H5FDlog.h ${HDF5_SRC_DIR}/H5FDmpi.h ${HDF5_SRC_DIR}/H5FDmpio.h ${HDF5_SRC_DIR}/H5FDmulti.h ${HDF5_SRC_DIR}/H5FDpublic.h + ${HDF5_SRC_DIR}/H5FDros3.h + ${HDF5_SRC_DIR}/H5FDs3comms.c ${HDF5_SRC_DIR}/H5FDsec2.h ${HDF5_SRC_DIR}/H5FDstdio.h ${HDF5_SRC_DIR}/H5FDwindows.h @@ -1142,6 +1148,7 @@ if (BUILD_SHARED_LIBS) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) target_include_directories (${HDF5_LIBSH_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + PUBLIC "$<$:${HDFS_INCLUDE_DIR}>" INTERFACE "$/include>" ) target_compile_definitions(${HDF5_LIBSH_TARGET} diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c new file mode 100644 index 0000000..e3e11b2 --- /dev/null +++ b/src/H5FDhdfs.c @@ -0,0 +1,2070 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only HDFS Virtual File Driver (VFD) * + * Copyright (c) 2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Jacob Smith + * 2018-04-23 + * + * Purpose: Provide read-only access to files on the Hadoop Distributed + * File System (HDFS). + */ + +/* This source code file is part of the H5FD driver module */ +#include "H5FDdrvr_module.h" + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDhdfs.h" /* hdfs file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ + +#ifdef H5_HAVE_LIBHDFS +#include "hdfs.h" +#endif + +/* toggle function call prints: 1 turns on */ +#define HDFS_DEBUG 0 + +/* toggle stats collection and reporting */ +#define HDFS_STATS 0 + +/* The driver identification number, initialized at runtime */ +static hid_t H5FD_HDFS_g = 0; + +#if HDFS_STATS + +/* arbitrarily large value, such that any reasonable size read will be "less" + * than this value and set a true minimum + * not 0 because that may be a valid recorded minimum in degenerate cases + */ +#define HDFS_STATS_STARTING_MIN 0xfffffffful + +/* Configuration definitions for stats collection and breakdown + * + * 2^10 = 1024 + * Reads up to 1024 bytes (1 kB) fall in bin 0 + * 2^(10+(1*16)) = 2^26 = 64MB + * Reads of 64MB or greater fall in "overflow" bin[BIN_COUNT] + */ +#define HDFS_STATS_BASE 2 +#define HDFS_STATS_INTERVAL 1 +#define HDFS_STATS_START_POWER 10 +#define HDFS_STATS_BIN_COUNT 16 /* MUST BE GREATER THAN 0 */ + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))` + * Stores result at `(unsigned long long *) out_ptr`. + * Used in computing boundaries between stats bins. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + */ +#define HDFS_STATS_POW(bin_i, out_ptr) { \ + unsigned long long donotshadowresult = 1; \ + unsigned donotshadowindex = 0; \ + for (donotshadowindex = 0; \ + donotshadowindex < (((bin_i) * HDFS_STATS_INTERVAL) + \ + HDFS_STATS_START_POWER); \ + donotshadowindex++) \ + { \ + donotshadowresult *= HDFS_STATS_BASE; \ + } \ + *(out_ptr) = donotshadowresult; \ +} + +/* array to hold pre-computed boundaries for stats bins */ +static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT]; + + +/*************************************************************************** + * + * Structure: hdfs_statsbin + * + * Purpose: + * + * Structure for storing per-file hdfs VFD usage statistics. + * + * + * + * `count` (unsigned long long) + * + * Number of reads with size in this bin's range. + * + * `bytes` (unsigned long long) + * + * Total number of bytes read through this bin. + * + * `min` (unsigned long long) + * + * Smallest read size in this bin. + * + * `max` (unsigned long long) + * + * Largest read size in this bin. + * + * + * + * Programmer: Jacob Smith + * + * Changes: None + * + ***************************************************************************/ +typedef struct { + unsigned long long count; + unsigned long long bytes; + unsigned long long min; + unsigned long long max; +} hdfs_statsbin; + +#endif /* HDFS_STATS */ + +/* "unique" identifier for `hdfs_t` structures. + * Randomly generated by unweighted dice rolls. + */ +#define HDFS_HDFST_MAGIC 0x1AD5DE84 + + +/*************************************************************************** + * + * Structure: hdfs_t + * + * Purpose: + * + * Contain/retain information associated with a file hosted on Hadoop + * Distributed File System (HDFS). Instantiated and populated via + * `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. + * + * + * + * `magic` (unisgned long) + * + * Number to indicate that this structure is of the promised + * type and should still be valid; should be HDFS_HDFST_MAGIC throughout + * the lifespan of the structure. Upon deletion of the structure, the + * programmer should set magic to anything but HDFS_HDFST_MAGIC, to + * indicate that the structure is to no longer be trusted. + * + * `filesystem` (hdfsFS) + * + * A libhdfs file system handle. + * + * `fileinfo` (hdfsFileInfo*) + * + * A pointer to a libhdfs file info structure. + * + * `file` (hdfsFile) + * + * A libhdfs file handle. + * + * + * + * Programmer: Jacob Smith + * May 2018 + * + * Changes: None + * + *************************************************************************** + */ +typedef struct { + unsigned long magic; +#ifdef H5_HAVE_LIBHDFS + hdfsFS filesystem; + hdfsFileInfo *fileinfo; + hdfsFile file; +#endif +} hdfs_t; + +#ifdef H5_HAVE_LIBHDFS + +/*-------------------------------------------------------------------------- + * Function: H5FD_hdfs_handle_open + * + * Purpose: Create a HDFS file handle, 'opening' the target file. + * + * Return: Success: Pointer to HDFS container/handle of opened file. + * Failure: NULL + * + * Programmer: Gerd Herber + * May 2018 + * + * Changes: None. + *-------------------------------------------------------------------------- + */ +static hdfs_t * +H5FD_hdfs_handle_open( + const char *path, + const char *namenode_name, + const int32_t namenode_port, + const char *user_name, + const char *kerberos_ticket_cache, + const int32_t stream_buffer_size) +{ + struct hdfsBuilder *builder = NULL; + hdfs_t *handle = NULL; + hdfs_t *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "called H5FD_hdfs_handle_open.\n"); +#endif + + if (path == NULL || path[0] == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "path cannot be null.\n") + } + if (namenode_name == NULL /* || namenode_name[0] == '\0' */ ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "namenode name cannot be null.\n") + } + if (namenode_port < 0 || namenode_port > 65535) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "namenode port must be non-negative and <= 65535.\n") + } + if (stream_buffer_size < 0) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "buffer size must non-negative.\n") + } + + handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, + "could not malloc space for handle.\n") + } + + handle->magic = (unsigned long)HDFS_HDFST_MAGIC; + handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ + handle->fileinfo = NULL; + handle->file = NULL; /* TODO: not a pointer; NULL may cause bug */ + + builder = hdfsNewBuilder(); + if (!builder) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "(hdfs) failed to create builder") + } + hdfsBuilderSetNameNode(builder, namenode_name); + hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); + if (user_name != NULL && user_name[0] != '\0') { + hdfsBuilderSetUserName(builder, user_name); + } + if (kerberos_ticket_cache != NULL && kerberos_ticket_cache[0] != '\0') { + hdfsBuilderSetKerbTicketCachePath(builder, kerberos_ticket_cache); + } + /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ + handle->filesystem = hdfsBuilderConnect(builder); + if (!handle->filesystem) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "(hdfs) could not connect to default namenode") + } + handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); + if (!handle->fileinfo) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "hdfsGetPathInfo failed") + } + handle->file = hdfsOpenFile( + handle->filesystem, + path, + O_RDONLY, + stream_buffer_size, + 0, + 0); + if (!handle->file) { + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, + "(hdfs) could not open") + } + + ret_value = handle; + +done: + if (ret_value == NULL && handle != NULL) { + /* error; clean up */ + HDassert(handle->magic == HDFS_HDFST_MAGIC); + handle->magic++; + if (handle->file != NULL) { + if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + "unable to close hdfs file handle") + } + } + if (handle->fileinfo != NULL) { + hdfsFreeFileInfo(handle->fileinfo, 1); + } + if (handle->filesystem != NULL) { + if (FAIL == (hdfsDisconnect(handle->filesystem))) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + "unable to disconnect from hdfs") + } + } + H5MM_xfree(handle); + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_handle_open() */ + + +/*-------------------------------------------------------------------------- + * Function: H5FD_hdfs_handle_close + * + * Purpose: 'Close' an HDFS file container/handle, releasing underlying + * resources. + * + * Return: Success: `SUCCEED` (0) + * Failure: `FAIL` (-1) + * + * Programmer: Gerd Herber + * May 2018 + * + * Changes: None. + *-------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_handle_close(hdfs_t *handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "called H5FD_hdfs_close.\n"); +#endif + + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle cannot be null.\n") + } + if (handle->magic != HDFS_HDFST_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has invalid magic.\n") + } + + handle->magic++; + if (handle->file != NULL) { + if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close hdfs file handle") + } + } + if (handle->fileinfo != NULL) { + hdfsFreeFileInfo(handle->fileinfo, 1); + } + if (handle->filesystem != NULL) { + if (FAIL == (hdfsDisconnect(handle->filesystem))) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to disconnect hdfs file system") + } + } + + H5MM_xfree(handle); + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_close() */ +#endif /* H5_HAVE_LIBHDFS */ + + +/*************************************************************************** + * + * Structure: H5FD_hdfs_t + * + * Purpose: + * + * H5FD_hdfs_t is a structure used to store all information needed to + * maintain R/O access to a single HDF5 file in an HDFS file system. + * This structure is created when such a file is "opened" and + * discarded when it is "closed". + * + * + * `pub` (H5FD_t) + * + * Instance of H5FD_t which contains all fields common to all VFDs. + * It must be the first item in this structure, since at higher levels, + * this structure will be treated as an instance of H5FD_t. + * + * `fa` (H5FD_hdfs_fapl_t) + * + * Instance of `H5FD_hdfs_fapl_t` containing the HDFS configuration data + * needed to "open" the HDF5 file. + * + * `eoa` (haddr_t) + * + * End of addressed space in file. After open, it should always + * equal the file size. + * + * `hdfs_handle` (hdfs_t *) + * + * Instance of HDFS Request handle associated with the target resource. + * Responsible for communicating with remote host and presenting file + * contents as indistinguishable from a file on the local filesystem. + * + * *** present only if HDFS_SATS is flagged to enable stats collection *** + * + * `meta` (hdfs_statsbin[]) + * `raw` (hdfs_statsbin[]) + * + * Only present if hdfs stats collection is enabled. + * + * Arrays of `hdfs_statsbin` structures to record raw- and metadata reads. + * + * Records count and size of reads performed by the VFD, and is used to + * print formatted usage statistics to stdout upon VFD shutdown. + * + * Reads of each raw- and metadata type are recorded in an individual bin + * determined by the size of the read. The last bin of each type is + * reserved for "big" reads, with no defined upper bound. + * + * *** end HDFS_STATS *** + * + * + * + * Programmer: Jacob Smith + * + * Changes: None. + * + *************************************************************************** + */ +typedef struct H5FD_hdfs_t { + H5FD_t pub; + H5FD_hdfs_fapl_t fa; + haddr_t eoa; +#ifdef H5_HAVE_LIBHDFS + hdfs_t *hdfs_handle; +#endif +#if HDFS_STATS + hdfs_statsbin meta[HDFS_STATS_BIN_COUNT + 1]; + hdfs_statsbin raw[HDFS_STATS_BIN_COUNT + 1]; +#endif +} H5FD_hdfs_t; + +/* + * These macros check for overflow of various quantities. These macros + * assume that HDoff_t is signed and haddr_t and size_t are unsigned. + * + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. + * + */ +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) + +/* Prototypes */ +static herr_t H5FD_hdfs_term(void); +static void *H5FD_hdfs_fapl_get(H5FD_t *_file); +static void *H5FD_hdfs_fapl_copy(const void *_old_fa); +static herr_t H5FD_hdfs_fapl_free(void *_fa); +static H5FD_t *H5FD_hdfs_open(const char *name, unsigned flags, hid_t fapl_id, + haddr_t maxaddr); +static herr_t H5FD_hdfs_close(H5FD_t *_file); +static int H5FD_hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD_hdfs_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl, + void** file_handle); +static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, + haddr_t addr, size_t size, void *buf); +static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, + haddr_t addr, size_t size, const void *buf); +static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, + hbool_t closing); +static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_hdfs_unlock(H5FD_t *_file); +static herr_t H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa); + +static const H5FD_class_t H5FD_hdfs_g = { + "hdfs", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_hdfs_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_hdfs_fapl_t), /* fapl_size */ + H5FD_hdfs_fapl_get, /* fapl_get */ + H5FD_hdfs_fapl_copy, /* fapl_copy */ + H5FD_hdfs_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_hdfs_open, /* open */ + H5FD_hdfs_close, /* close */ + H5FD_hdfs_cmp, /* cmp */ + H5FD_hdfs_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_hdfs_get_eoa, /* get_eoa */ + H5FD_hdfs_set_eoa, /* set_eoa */ + H5FD_hdfs_get_eof, /* get_eof */ + H5FD_hdfs_get_handle, /* get_handle */ + H5FD_hdfs_read, /* read */ + H5FD_hdfs_write, /* write */ + NULL, /* flush */ + H5FD_hdfs_truncate, /* truncate */ + H5FD_hdfs_lock, /* lock */ + H5FD_hdfs_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +/* Declare a free list to manage the H5FD_hdfs_t struct */ +H5FL_DEFINE_STATIC(H5FD_hdfs_t); + + +/*------------------------------------------------------------------------- + * Function: H5FD__init_package + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Non-negative on success/Negative on failure + * + * Changes: Rename as appropriate for hdfs vfd. + * Jacob Smith 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__init_package(void) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + if (H5FD_hdfs_init() < 0) { + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + "unable to initialize hdfs VFD") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_init + * + * Purpose: Initialize this driver by registering the driver with the + * library. + * + * Return: Success: The driver ID for the hdfs driver. + * Failure: Negative + * + * Programmer: Robb Matzke + * Thursday, July 29, 1999 + * + * Changes: Rename as appropriate for hdfs vfd. + * Jacob Smith 2018 + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_hdfs_init(void) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_init() called.\n"); +#endif + + if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) { + H5FD_HDFS_g = H5FD_register( + &H5FD_hdfs_g, + sizeof(H5FD_class_t), + FALSE); + } + +#if HDFS_STATS + /* pre-compute statsbin boundaries + */ + for (unsigned bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { + unsigned long long value = 0; + HDFS_STATS_POW(bin_i, &value) + hdfs_stats_boundaries[bin_i] = value; + } +#endif + + ret_value = H5FD_HDFS_g; + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_hdfs_init() */ + + +/*--------------------------------------------------------------------------- + * Function: H5FD_hdfs_term + * + * Purpose: Shut down the VFD + * + * Returns: SUCCEED (Can't fail) + * + * Programmer: Quincey Koziol + * Friday, Jan 30, 2004 + * + * Changes: Rename as appropriate for hdfs vfd. + * Jacob Smith 2018 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_term(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_term() called.\n"); +#endif + + /* Reset VFL ID */ + H5FD_HDFS_g = 0; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD_hdfs_term() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_hdfs + * + * Purpose: Modify the file access property list to use the H5FD_HDFS + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably + * initialized instance of H5FD_hdfs_fapl_t + * + * Return: SUCCEED/FAIL + * + * Programmer: John Mainzer + * 9/10/17 + * + * Changes: Rename as appropriate for hdfs vfd. + * Jacob Smith 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_hdfs(hid_t fapl_id, + H5FD_hdfs_fapl_t *fa) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = FAIL; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa); + + HDassert(fa != NULL); + +#if HDFS_DEBUG + HDfprintf(stdout, "H5Pset_fapl_hdfs() called.\n"); +#endif + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ + "not a file access property list") + } + + if (FAIL == H5FD_hdfs_validate_config(fa)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid hdfs config") + } + + ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa); + +done: + FUNC_LEAVE_API(ret_value) + +} /* H5Pset_fapl_hdfs() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_validate_config() + * + * Purpose: Test to see if the supplied instance of H5FD_hdfs_fapl_t + * contains internally consistant data. Return SUCCEED if so, + * and FAIL otherwise. + * + * Note the difference between internally consistant and + * correct. As we will have to try to access the target + * object to determine whether the supplied data is correct, + * we will settle for internal consistancy at this point + * + * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally + * consistant data, FAIL otherwise. + * + * Programmer: Jacob Smith + * 9/10/17 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_validate_config(const H5FD_hdfs_fapl_t * fa) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(fa != NULL); + + if ( fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Unknown H5FD_hdfs_fapl_t version"); + } + + if ( fa->namenode_port > 65535 ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Invalid namenode port number"); + } + if ( fa->namenode_port < 0 ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Invalid namenode port number"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_validate_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_fapl_hdfs + * + * Purpose: Returns information about the hdfs file access property + * list though the function arguments. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: John Mainzer + * 9/10/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_fapl_hdfs(hid_t fapl_id, + H5FD_hdfs_fapl_t *fa_out) +{ + const H5FD_hdfs_fapl_t *fa = NULL; + H5P_genplist_t *plist = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa_out); + +#if HDFS_DEBUG + HDfprintf(stdout, "H5Pget_fapl_hdfs() called.\n"); +#endif + + if (fa_out == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "fa_out is NULL") + } + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not a file access list") + } + if (H5FD_HDFS != H5P_peek_driver(plist)) { + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, + "incorrect VFL driver") + } + + fa = (const H5FD_hdfs_fapl_t *)H5P_peek_driver_info(plist); + if (fa == NULL) { + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, + "bad VFL driver info") + } + + /* Copy the hdfs fapl data out */ + HDmemcpy(fa_out, fa, sizeof(H5FD_hdfs_fapl_t)); + +done: + FUNC_LEAVE_API(ret_value) + +} /* H5Pget_fapl_hdfs() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_get + * + * Purpose: Gets a file access property list which could be used to + * create an identical file. + * + * Return: Success: Ptr to new file access property list value. + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_hdfs_fapl_get(H5FD_t *_file) +{ + H5FD_hdfs_t *file = (H5FD_hdfs_t*)_file; + H5FD_hdfs_fapl_t *fa = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); + if (fa == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed") + } + + /* Copy the fields of the structure */ + HDmemcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); + + ret_value = fa; + +done: + if (ret_value == NULL && fa != NULL) { + H5MM_xfree(fa); /* clean up on error */ + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_fapl_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_copy + * + * Purpose: Copies the hdfs-specific file access properties. + * + * Return: Success: Ptr to a new property list + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_hdfs_fapl_copy(const void *_old_fa) +{ + const H5FD_hdfs_fapl_t *old_fa = (const H5FD_hdfs_fapl_t*)_old_fa; + H5FD_hdfs_fapl_t *new_fa = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); + if (new_fa == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed") + } + + HDmemcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); + ret_value = new_fa; + +done: + if (ret_value == NULL && new_fa != NULL) { + H5MM_xfree(new_fa); /* clean up on error */ + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_fapl_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_fapl_free + * + * Purpose: Frees the hdfs-specific file access properties. + * + * Return: SUCCEED (cannot fail) + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_fapl_free(void *_fa) +{ + H5FD_hdfs_fapl_t *fa = (H5FD_hdfs_fapl_t*)_fa; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(fa != NULL); /* sanity check */ + + H5MM_xfree(fa); + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5FD_hdfs_fapl_free() */ + +#if HDFS_STATS + +/*---------------------------------------------------------------------------- + * + * Function: hdfs_reset_stats() + * + * Purpose: + * + * Reset the stats collection elements in this virtual file structure. + * + * Clears any set data in stats bins; initializes/zeroes values. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - Occurs if the file is invalid somehow + * + * Programmer: Jacob Smith + * 2017-12-08 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static herr_t +hdfs_reset_stats(H5FD_hdfs_t *file) +{ + unsigned i = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDprintf("hdfs_reset_stats() called\n"); +#endif + + if (file == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file was null") + } + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + file->raw[i].bytes = 0; + file->raw[i].count = 0; + file->raw[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; + file->raw[i].max = 0; + + file->meta[i].bytes = 0; + file->meta[i].count = 0; + file->meta[i].min = (unsigned long long)HDFS_STATS_STARTING_MIN; + file->meta[i].max = 0; + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* hdfs_reset_stats */ +#endif /* HDFS_STATS */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_open() + * + * Purpose: + * + * Create and/or opens a file as an HDF5 file. + * + * Any flag except H5F_ACC_RDONLY will cause an error. + * + * Return: + * + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is + * always H5FD_open(). + * + * Failure: NULL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static H5FD_t * +H5FD_hdfs_open( + const char *path, + unsigned flags, + hid_t fapl_id, + haddr_t maxaddr) +{ + H5FD_t *ret_value = NULL; +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_t *file = NULL; + hdfs_t *handle = NULL; + H5FD_hdfs_fapl_t fa; +#endif + + FUNC_ENTER_NOAPI_NOINIT + +#ifndef H5_HAVE_LIBHDFS + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, + "Illegal open of unsupported virtual file (hdfs)"); +#else +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_open() called.\n"); +#endif /* HDFS_DEBUG */ + + /* Sanity check on file offsets */ + HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); + + /* Check arguments */ + if (!path || !*path) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "invalid file name") + } + if (0 == maxaddr || HADDR_UNDEF == maxaddr) { + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, + "bogus maxaddr") + } + if (ADDR_OVERFLOW(maxaddr)) { + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, + "bogus maxaddr") + } + if (flags != H5F_ACC_RDONLY) { + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, + "only Read-Only access allowed") + } + if (fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "fapl cannot be H5P_DEFAULT") + } + if (FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "can't get property list") + } + + handle = H5FD_hdfs_handle_open( + path, + fa.namenode_name, + fa.namenode_port, + fa.user_name, + fa.kerberos_ticket_cache, + fa.stream_buffer_size); + + if (handle == NULL) { + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, + "could not open") + } + + HDassert(handle->magic == HDFS_HDFST_MAGIC); + + /* create new file struct + */ + file = H5FL_CALLOC(H5FD_hdfs_t); + if (file == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "unable to allocate file struct") + } + file->hdfs_handle = handle; + HDmemcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t)); + +#if HDFS_STATS + if (FAIL == hdfs_reset_stats(file)) { + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, + "unable to reset file statistics") + } +#endif /* HDFS_STATS */ + + ret_value = (H5FD_t*)file; +#endif /* H5_HAVE_LIBHDFS */ + +done: +#ifdef H5_HAVE_LIBHDFS + if (ret_value == NULL) { + if (handle != NULL) { + if (FAIL == H5FD_hdfs_handle_close(handle)) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + "unable to close HDFS file handle") + } + } + if (file != NULL) { + file = H5FL_FREE(H5FD_hdfs_t, file); + } + } /* if null return value (error) */ +#endif /* H5_HAVE_LIBHDFS */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_open() */ + +#if HDFS_STATS + +/*---------------------------------------------------------------------------- + * + * Function: hdfs_fprint_stats() + * + * Purpose: + * + * Tabulate and pretty-print statistics for this virtual file. + * + * Should be called upon file close. + * + * Shows number of reads and bytes read, broken down by + * "raw" (H5FD_MEM_DRAW) + * or "meta" (any other flag) + * + * Prints filename and listing of total number of reads and bytes read, + * both as a grand total and separate meta- and rawdata reads. + * + * If any reads were done, prints out two tables: + * + * 1. overview of raw- and metadata reads + * - min (smallest size read) + * - average of size read + * - k,M,G suffixes by powers of 1024 (2^10) + * - max (largest size read) + * 2. tabulation of "bins", sepraring reads into exponentially-larger + * ranges of size. + * - columns for number of reads, total bytes, and average size, with + * separate sub-colums for raw- and metadata reads. + * - each row represents one bin, identified by the top of its range + * + * Bin ranges can be modified with pound-defines at the top of this file. + * + * Bins without any reads in their bounds are not printed. + * + * An "overflow" bin is also present, to catch "big" reads. + * + * Output for all bins (and range ceiling and average size report) + * is divied by powers of 1024. By corollary, four digits before the decimal + * is valid. + * + * - 41080 bytes is represented by 40.177k, not 41.080k + * - 1004.831M represents approx. 1052642000 bytes + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - occurs if the file passed in is invalid + * - TODO: if stream is invalid? how can we check this? + * + * Programmer: Jacob Smith + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static herr_t +hdfs_fprint_stats( + FILE *stream, + const H5FD_hdfs_t *file) +{ + herr_t ret_value = SUCCEED; + parsed_url_t *purl = NULL; + unsigned i = 0; + unsigned long count_meta = 0; + unsigned long count_raw = 0; + double average_meta = 0.0; + double average_raw = 0.0; + unsigned long long min_meta = (unsigned long long)HDFS_STATS_STARTING_MIN; + unsigned long long min_raw = (unsigned long long)HDFS_STATS_STARTING_MIN; + unsigned long long max_meta = 0; + unsigned long long max_raw = 0; + unsigned long long bytes_raw = 0; + unsigned long long bytes_meta = 0; + double re_dub = 0.0; /* re-usable double variable */ + unsigned suffix_i = 0; + const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; + + FUNC_ENTER_NOAPI_NOINIT + + if (stream == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file stream cannot be null" ) + } + if (file == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file cannot be null") + } + if (file->hdfs_handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "hdfs handle cannot be null") + } + if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "hdfs handle has invalid magic") + } + + /* TODO: See what libhdfs exposes to us. */ + +#if 0 + if (file->s3r_handle->purl == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "parsed url structure cannot be null") + } + purl = file->s3r_handle->purl; + + /****************** + * PRINT FILENAME * + ******************/ + + HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); + if (purl->port != NULL && purl->port[0] != '\0') { + HDfprintf(stream, ":%s", purl->port); + } + if (purl->query != NULL && purl->query[0] != '\0') { + if (purl->path != NULL && purl->path[0] != '\0') { + HDfprintf(stream, "/%s", purl->path); + } else { + HDfprintf(stream, "/"); + } + HDfprintf(stream, "?%s", purl->query); + } else if (purl->path != NULL && purl->path[0] != '\0') { + HDfprintf(stream, "/%s", purl->path); + } + HDfprintf(stream, "\n"); +#endif + + /******************* + * AGGREGATE STATS * + *******************/ + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + const hdfs_statsbin *r = &file->raw[i]; + const hdfs_statsbin *m = &file->meta[i]; + + if (m->min < min_meta) min_meta = m->min; + if (r->min < min_raw) min_raw = r->min; + if (m->max > max_meta) max_meta = m->max; + if (r->max > max_raw) max_raw = r->max; + + count_raw += r->count; + count_meta += m->count; + bytes_raw += r->bytes; + bytes_meta += m->bytes; + } + if (count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; + if (count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; + + /****************** + * PRINT OVERVIEW * + ******************/ + + HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", + count_raw + count_meta, count_meta, count_raw); + HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", + bytes_raw + bytes_meta, bytes_meta, bytes_raw); + + if (count_raw + count_meta == 0) { + goto done; + } + + /************************* + * PRINT AGGREGATE STATS * + *************************/ + + HDfprintf(stream, "SIZES meta raw\n"); + HDfprintf(stream, " min "); + if (count_meta == 0) { + HDfprintf(stream, " 0.000 "); + } else { + re_dub = (double)min_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + } + + if (count_raw == 0) { + HDfprintf(stream, " 0.000 \n"); + } else { + re_dub = (double)min_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + } + + HDfprintf(stream, " avg "); + re_dub = (double)average_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)average_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + HDfprintf(stream, " max "); + re_dub = (double)max_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)max_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + /****************************** + * PRINT INDIVIDUAL BIN STATS * + ******************************/ + + HDfprintf(stream, + "BINS # of reads total bytes average size\n"); + HDfprintf(stream, + " up-to meta raw meta raw meta raw\n"); + + for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { + const hdfs_statsbin *m; + const hdfs_statsbin *r; + unsigned long long range_end = 0; + char bm_suffix = ' '; /* bytes-meta */ + double bm_val = 0.0; + char br_suffix = ' '; /* bytes-raw */ + double br_val = 0.0; + char am_suffix = ' '; /* average-meta */ + double am_val = 0.0; + char ar_suffix = ' '; /* average-raw */ + double ar_val = 0.0; + + m = &file->meta[i]; + r = &file->raw[i]; + if (r->count == 0 && m->count == 0) { + continue; + } + + range_end = hdfs_stats_boundaries[i]; + + if (i == HDFS_STATS_BIN_COUNT) { + range_end = hdfs_stats_boundaries[i-1]; + HDfprintf(stream, ">"); + } else { + HDfprintf(stream, " "); + } + + bm_val = (double)m->bytes; + for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) { + bm_val /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + bm_suffix = suffixes[suffix_i]; + + br_val = (double)r->bytes; + for (suffix_i = 0; br_val >= 1024.0; suffix_i++) { + br_val /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + br_suffix = suffixes[suffix_i]; + + if (m->count > 0) { + am_val = (double)(m->bytes) / (double)(m->count); + } + for (suffix_i = 0; am_val >= 1024.0; suffix_i++) { + am_val /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + am_suffix = suffixes[suffix_i]; + + if (r->count > 0) { + ar_val = (double)(r->bytes) / (double)(r->count); + } + for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) { + ar_val /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + ar_suffix = suffixes[suffix_i]; + + re_dub = (double)range_end; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) { + re_dub /= 1024.0; + } + HDassert(suffix_i < sizeof(suffixes)); + + HDfprintf( + stream, + " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", + re_dub, suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* rawdata reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* rawdata bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* rawdata average */ + fflush(stream); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* hdfs_fprint_stats */ +#endif /* HDFS_STATS */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_close() + * + * Purpose: + * + * Close an HDF5 file. + * + * Return: + * + * SUCCEED/FAIL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_close(H5FD_t *_file) +{ + herr_t ret_value = SUCCEED; +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; +#endif + + FUNC_ENTER_NOAPI_NOINIT + +#ifndef H5_HAVE_LIBHDFS + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "Illegal close of unsupported Virtual File (hdfs)") +#else +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_close() called.\n"); +#endif + + /* Sanity checks + */ + HDassert(file != NULL); + HDassert(file->hdfs_handle != NULL); + HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + + /* Close the underlying request handle + */ + if (file->hdfs_handle != NULL) { + if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) { + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close HDFS file handle") + } + } + +#if HDFS_STATS + /* TODO: mechanism to re-target stats printout */ + if (FAIL == hdfs_fprint_stats(stdout, file)) { + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, + "problem while writing file statistics") + } +#endif /* HDFS_STATS */ + + /* Release the file info + */ + file = H5FL_FREE(H5FD_hdfs_t, file); +#endif /* H5_HAVE_LIBHDFS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_hdfs_close() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_cmp() + * + * Purpose: + * + * Compares two files using this driver by their HDFS-provided file info, + * field-by-field. + * + * Return: + * + Equivalent: 0 + * + Not Equivalent: -1 + * + * Programmer: Gerd Herber + * May 2018 + * + * Changes: + * + * + Replace `if (ret_value == 0)` chain with `HGOTO_DONE` jumps. + * Jacob Smith 17 May 2018 + * + *------------------------------------------------------------------------- + */ +static int +H5FD_hdfs_cmp(const H5FD_t *_f1, + const H5FD_t *_f2) +{ + int ret_value = 0; +#ifdef H5_HAVE_LIBHDFS + const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1; + const H5FD_hdfs_t *f2 = (const H5FD_hdfs_t *)_f2; + hdfsFileInfo *finfo1 = NULL; + hdfsFileInfo *finfo2 = NULL; +#endif /* H5_HAVE_LIBHDFS */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifdef H5_HAVE_LIBHDFS +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n"); +#endif /* HDFS_DEBUG */ + + HDassert(f1->hdfs_handle != NULL); + HDassert(f2->hdfs_handle != NULL); + HDassert(f1->hdfs_handle->magic == HDFS_HDFST_MAGIC); + HDassert(f2->hdfs_handle->magic == HDFS_HDFST_MAGIC); + + finfo1 = f1->hdfs_handle->fileinfo; + finfo2 = f2->hdfs_handle->fileinfo; + HDassert(finfo1 != NULL); + HDassert(finfo2 != NULL); + + if (finfo1->mKind != finfo2->mKind) HGOTO_DONE(-1); + if (finfo1->mName != finfo2->mName) HGOTO_DONE(-1); + if (finfo1->mLastMod != finfo2->mLastMod) HGOTO_DONE(-1); + if (finfo1->mSize != finfo2->mSize) HGOTO_DONE(-1); + if (finfo1->mReplication != finfo2->mReplication) HGOTO_DONE(-1); + if (finfo1->mBlockSize != finfo2->mBlockSize) HGOTO_DONE(-1); + if (strcmp(finfo1->mOwner, finfo2->mOwner)) HGOTO_DONE(-1); + if (strcmp(finfo1->mGroup, finfo2->mGroup)) HGOTO_DONE(-1); + if (finfo1->mPermissions != finfo2->mPermissions) HGOTO_DONE(-1); + if (finfo1->mLastAccess != finfo2->mLastAccess) HGOTO_DONE(-1); +#endif /* H5_HAVE_LIBHDFS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_hdfs_query + * + * Purpose: Set the flags that this VFL driver is capable of supporting. + * (listed in H5FDpublic.h) + * + * Note that since the HDFS VFD is read only, most flags + * are irrelevant. + * + * The term "set" is highly misleading... + * stores/copies the supported flags in the out-pointer `flags`. + * + * Return: SUCCEED (Can't fail) + * + * Programmer: John Mainzer + * 9/11/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_query( + const H5FD_t H5_ATTR_UNUSED *_file, + unsigned long *flags) /* out variable */ +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_query() called.\n"); +#endif + + if (flags) { + *flags = 0; + *flags |= H5FD_FEAT_DATA_SIEVE; + } + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5FD_hdfs_query() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_get_eoa() + * + * Purpose: + * + * Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. + * + * Return: + * + * The end-of-address marker. + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static haddr_t +H5FD_hdfs_get_eoa( + const H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ +#ifdef H5_HAVE_LIBHDFS + const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; +#endif /* H5_HAVE_LIBHDFS */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); +#endif + +#ifdef H5_HAVE_LIBHDFS + FUNC_LEAVE_NOAPI(file->eoa) +#else + FUNC_LEAVE_NOAPI(0) +#endif /* H5_HAVE_LIBHDFS */ + +} /* end H5FD_hdfs_get_eoa() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_set_eoa() + * + * Purpose: + * + * Set the end-of-address marker for the file. + * + * Return: + * + * SUCCEED (can't fail) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_set_eoa( + H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + haddr_t addr) +{ +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; +#endif /* H5_HAVE_LIBHDFS */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); +#endif + +#ifdef H5_HAVE_LIBHDFS + file->eoa = addr; + + FUNC_LEAVE_NOAPI(SUCCEED) +#else + FUNC_LEAVE_NOAPI(FAIL) +#endif /* H5_HAVE_LIBHDFS */ + +} /* H5FD_hdfs_set_eoa() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_get_eof() + * + * Purpose: + * + * Returns the end-of-file marker. + * + * Return: + * + * EOF: the first address past the end of the "file", either the + * filesystem file or the HDF5 file. + * + * Programmer: Jacob Smith + * 2017-11-02 + * + *------------------------------------------------------------------------- + */ +static haddr_t +H5FD_hdfs_get_eof( + const H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ +#ifdef H5_HAVE_LIBHDFS + const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; +#endif /* H5_HAVE_LIBHDFS */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); +#endif + +#ifdef H5_HAVE_LIBHDFS + HDassert(file->hdfs_handle != NULL); + HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + + FUNC_LEAVE_NOAPI((size_t) file->hdfs_handle->fileinfo->mSize) +#else + FUNC_LEAVE_NOAPI((size_t)0) +#endif /* H5_HAVE_LIBHDFS */ + +} /* end H5FD_hdfs_get_eof() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_get_handle() + * + * Purpose: + * + * Returns the HDFS handle (hdfs_t) of hdfs file driver. + * + * Returns: + * + * SUCCEED/FAIL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_get_handle( + H5FD_t *_file, + hid_t H5_ATTR_UNUSED fapl, + void **file_handle) +{ + herr_t ret_value = SUCCEED; +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; +#endif + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); +#endif /* HDFS_DEBUG */ + +#ifdef H5_HAVE_LIBHDFS + if (!file_handle) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file handle not valid") + } + + *file_handle = file->hdfs_handle; +#else + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "Illegal get-handle of unsupported virtual file (hdfs)"); +#endif /* H5_HAVE_LIBHDFS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_hdfs_get_handle() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_read() + * + * Purpose: + * + * Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in DXPL_ID. + * + * Return: + * + * Success: `SUCCEED` + * - Result is stored in caller-supplied buffer BUF. + * Failure: `FAIL` + * - Unable to complete read. + * - Contents of buffer `buf` are undefined. + * + * Programmer: Jacob Smith + * 2017-11-?? + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_read( + H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t addr, /* start offset */ + size_t size, /* length of read */ + void *buf) /* out */ +{ + herr_t ret_value = SUCCEED; +#if H5_HAVE_LIBHDFS + H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; + size_t filesize = 0; +#endif /* H5_HAVE_LIBHDFS */ +#if HDFS_STATS + /* working variables for storing stats */ + hdfs_statsbin *bin = NULL; + unsigned bin_i = 0; +#endif /* HDFS_STATS */ + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); +#endif /* HDFS_DEBUG */ + +#ifndef H5_HAVE_LIBHDFS + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "Illegal get-handle of unsupported virtual file (hdfs)"); +#else + HDassert(file != NULL); + HDassert(file->hdfs_handle != NULL); + HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + HDassert(buf != NULL); + + filesize = (size_t) file->hdfs_handle->fileinfo->mSize; + + if ((addr > filesize) || ((addr + size) > filesize)) { + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, + "range exceeds file address") + } + + if (FAIL == hdfsPread( + file->hdfs_handle->filesystem, + file->hdfs_handle->file, + (tOffset)addr, + buf, + (tSize)size)) + { + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, + "unable to execute read") + } + +#if HDFS_STATS + + /* Find which "bin" this read fits in. Can be "overflow" bin. + */ + for (bin_i = 0; bin_i < HDFS_STATS_BIN_COUNT; bin_i++) { + if ((unsigned long long)size < hdfs_stats_boundaries[bin_i]) { + break; + } + } + bin = (type == H5FD_MEM_DRAW) + ? &file->raw[bin_i] + : &file->meta[bin_i]; + + /* Store collected stats in appropriate bin + */ + if (bin->count == 0) { + bin->min = size; + bin->max = size; + } else { + if (size < bin->min) bin->min = size; + if (size > bin->max) bin->max = size; + } + bin->count++; + bin->bytes += (unsigned long long)size; + +#endif /* HDFS_STATS */ +#endif /* H5_HAVE_LIBHDFS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_hdfs_read() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_write() + * + * Purpose: + * + * Write bytes to file. + * UNSUPPORTED IN READ-ONLY HDFS VFD. + * + * Return: + * + * FAIL (Not possible with Read-Only S3 file.) + * + * Programmer: Jacob Smith + * 2017-10-23 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_write( + H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, + const void H5_ATTR_UNUSED *buf) +{ + herr_t ret_value = FAIL; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_write() called.\n"); +#endif + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "cannot write to read-only file.") + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_write() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_truncate() + * + * Purpose: + * + * Makes sure that the true file size is the same (or larger) + * than the end-of-address. + * + * NOT POSSIBLE ON READ-ONLY S3 FILES. + * + * Return: + * + * FAIL (Not possible on Read-Only S3 files.) + * + * Programmer: Jacob Smith + * 2017-10-23 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_truncate( + H5FD_t H5_ATTR_UNUSED *_file, + hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_truncate() called.\n"); +#endif + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "cannot truncate read-only file.") + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_hdfs_truncate() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_lock() + * + * Purpose: + * + * Place an advisory lock on a file. + * No effect on Read-Only S3 file. + * + * Suggestion: remove lock/unlock from class + * > would result in error at H5FD_[un]lock() (H5FD.c) + * + * Return: + * + * SUCCEED (No-op always succeeds) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_lock( + H5FD_t H5_ATTR_UNUSED *_file, + hbool_t H5_ATTR_UNUSED rw) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* end H5FD_hdfs_lock() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_hdfs_unlock() + * + * Purpose: + * + * Remove the existing lock on the file. + * No effect on Read-Only S3 file. + * + * Return: + * + * SUCCEED (No-op always succeeds) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* end H5FD_hdfs_unlock() */ + diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h new file mode 100644 index 0000000..3d4128d --- /dev/null +++ b/src/H5FDhdfs.h @@ -0,0 +1,122 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only HDFS Virtual File Driver (VFD) * + * Copyright (c) 2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Jacob Smith + * 2018-04-23 + * + * Purpose: The public header file for the hdfs driver. + */ + +#ifndef H5FDhdfs_H +#define H5FDhdfs_H + +#define H5FD_HDFS (H5FD_hdfs_init()) + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * Structure: H5FD_hdfs_fapl_t + * + * Purpose: + * + * H5FD_hdfs_fapl_t is a public structure that is used to pass + * configuration information to the appropriate HDFS VFD via the FAPL. + * A pointer to an instance of this structure is a parameter to + * H5Pset_fapl_hdfs() and H5Pget_fapl_hdfs(). + * + * + * + * `version` (int32_t) + * + * Version number of the `H5FD_hdfs_fapl_t` structure. Any instance passed + * to the above calls must have a recognized version number, or an error + * will be flagged. + * + * This field should be set to `H5FD__CURR_HDFS_FAPL_T_VERSION`. + * + * `namenode_name` (const char[]) + * + * Name of "Name Node" to access as the HDFS server. + * + * Must not be longer than `H5FD__HDFS_NODE_NAME_SPACE`. + * + * TBD: Can be NULL. + * + * `namenode_port` (int32_t) TBD + * + * Port number to use to connect with Name Node. + * + * TBD: If 0, uses a default port. + * + * `kerberos_ticket_cache` (const char[]) + * + * Path to the location of the Kerberos authentication cache. + * + * Must not be longer than `H5FD__HDFS_KERB_CACHE_PATH_SPACE`. + * + * TBD: Can be NULL. + * + * `user_name` (const char[]) + * + * Username to use when accessing file. + * + * Must not be longer than `H5FD__HDFS_USER_NAME_SPACE`. + * + * TBD: Can be NULL. + * + * `stream_buffer_size` (int32_t) + * + * Size (in bytes) of the file read stream buffer. + * + * TBD: If -1, relies on a default value. + * + * + * + * Programmer: Jacob Smith + * 2018-04-23 + * + * Changes: None + * + ****************************************************************************/ + +#define H5FD__CURR_HDFS_FAPL_T_VERSION 1 + +#define H5FD__HDFS_NODE_NAME_SPACE 128 +#define H5FD__HDFS_USER_NAME_SPACE 128 +#define H5FD__HDFS_KERB_CACHE_PATH_SPACE 128 + +typedef struct H5FD_hdfs_fapl_t { + int32_t version; + char namenode_name[H5FD__HDFS_NODE_NAME_SPACE + 1]; + int32_t namenode_port; + char user_name[H5FD__HDFS_USER_NAME_SPACE + 1]; + char kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1]; + int32_t stream_buffer_size; +} H5FD_hdfs_fapl_t; + +H5_DLL hid_t H5FD_hdfs_init(void); +H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); +H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef H5FDhdfs_H */ + + diff --git a/src/H5FDros3.c b/src/H5FDros3.c new file mode 100644 index 0000000..8bf0420 --- /dev/null +++ b/src/H5FDros3.c @@ -0,0 +1,1847 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Jacob Smith + * 2017-10-13 + * + * Purpose: + * + * Provide read-only access to files hosted on Amazon's S3 service. + * Relies on "s3comms" utility layer to implement the AWS REST API. + */ + +/* This source code file is part of the H5FD driver module */ +#include "H5FDdrvr_module.h" + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDros3.h" /* ros3 file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5FDs3comms.h" /* S3 Communications */ + +/* toggle function call prints: 1 turns on + */ +#define ROS3_DEBUG 0 + +/* toggle stats collection and reporting + */ +#define ROS3_STATS 0 + +/* The driver identification number, initialized at runtime + */ +static hid_t H5FD_ROS3_g = 0; + +#if ROS3_STATS + +/* arbitrarily large value, such that any reasonable size read will be "less" + * than this value and set a true minimum + * not 0 because that may be a valid recorded minimum in degenerate cases + */ +#define ROS3_STATS_STARTING_MIN 0xfffffffful + +/* Configuration definitions for stats collection and breakdown + * + * 2^10 = 1024 + * Reads up to 1024 bytes (1 kB) fall in bin 0 + * 2^(10+(1*16)) = 2^26 = 64MB + * Reads of 64MB or greater fall in "overflow" bin[BIN_COUNT] + */ +#define ROS3_STATS_BASE 2 +#define ROS3_STATS_INTERVAL 1 +#define ROS3_STATS_START_POWER 10 +#define ROS3_STATS_BIN_COUNT 16 /* MUST BE GREATER THAN 0 */ + + +/* + * Calculate `BASE ^ (START_POWER + (INTERVAL * bin_i))` + * Stores result at `(unsigned long long *) out_ptr`. + * Used in computing boundaries between stats bins. + */ +#define ROS3_STATS_POW(bin_i, out_ptr) { \ + unsigned long long donotshadowresult = 1; \ + unsigned donotshadowindex = 0; \ + for (donotshadowindex = 0; \ + donotshadowindex < (((bin_i) * ROS3_STATS_INTERVAL) + \ + ROS3_STATS_START_POWER); \ + donotshadowindex++) \ + { \ + donotshadowresult *= ROS3_STATS_BASE; \ + } \ + *(out_ptr) = donotshadowresult; \ +} + +/* array to hold pre-computed boundaries for stats bins + */ +static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT]; + +/*************************************************************************** + * + * Structure: ros3_statsbin + * + * Purpose: + * + * Structure for storing per-file ros3 VFD usage statistics. + * + * + * + * `count` (unsigned long long) + * + * Number of reads with size in this bin's range. + * + * `bytes` (unsigned long long) + * + * Total number of bytes read through this bin. + * + * `min` (unsigned long long) + * + * Smallest read size in this bin. + * + * `max` (unsigned long long) + * + * Largest read size in this bin. + * + * + * + * Programmer: Jacob Smith + * + * Changes: None + * + ***************************************************************************/ +typedef struct { + unsigned long long count; + unsigned long long bytes; + unsigned long long min; + unsigned long long max; +} ros3_statsbin; + +#endif /* ROS3_STATS */ + +/*************************************************************************** + * + * Structure: H5FD_ros3_t + * + * Purpose: + * + * H5FD_ros3_t is a structure used to store all information needed to + * maintain R/O access to a single HDF5 file that has been stored as a + * S3 object. This structure is created when such a file is "opened" and + * discarded when it is "closed". + * + * Presents an S3 object as a file to the HDF5 library. + * + * + * + * `pub` (H5FD_t) + * + * Instance of H5FD_t which contains all fields common to all VFDs. + * It must be the first item in this structure, since at higher levels, + * this structure will be treated as an instance of H5FD_t. + * + * `fa` (H5FD_ros3_fapl_t) + * + * Instance of `H5FD_ros3_fapl_t` containing the S3 configuration data + * needed to "open" the HDF5 file. + * + * `eoa` (haddr_t) + * + * End of addressed space in file. After open, it should always + * equal the file size. + * + * `s3r_handle` (s3r_t *) + * + * Instance of S3 Request handle associated with the target resource. + * Responsible for communicating with remote host and presenting file + * contents as indistinguishable from a file on the local filesystem. + * + * *** present only if ROS3_SATS is flagged to enable stats collection *** + * + * `meta` (ros3_statsbin[]) + * `raw` (ros3_statsbin[]) + * + * Only present if ros3 stats collection is enabled. + * + * Arrays of `ros3_statsbin` structures to record raw- and metadata reads. + * + * Records count and size of reads performed by the VFD, and is used to + * print formatted usage statistics to stdout upon VFD shutdown. + * + * Reads of each raw- and metadata type are recorded in an individual bin + * determined by the size of the read. The last bin of each type is + * reserved for "big" reads, with no defined upper bound. + * + * *** end ROS3_STATS *** + * + * + * + * Programmer: Jacob Smith + * + * Changes: None. + * + ***************************************************************************/ +typedef struct H5FD_ros3_t { + H5FD_t pub; + H5FD_ros3_fapl_t fa; + haddr_t eoa; + s3r_t *s3r_handle; +#if ROS3_STATS + ros3_statsbin meta[ROS3_STATS_BIN_COUNT + 1]; + ros3_statsbin raw[ROS3_STATS_BIN_COUNT + 1]; +#endif +} H5FD_ros3_t; + +/* + * These macros check for overflow of various quantities. These macros + * assume that HDoff_t is signed and haddr_t and size_t are unsigned. + * + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. + * + */ +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) + +/* Prototypes */ +static herr_t H5FD_ros3_term(void); +static void *H5FD_ros3_fapl_get(H5FD_t *_file); +static void *H5FD_ros3_fapl_copy(const void *_old_fa); +static herr_t H5FD_ros3_fapl_free(void *_fa); +static H5FD_t *H5FD_ros3_open(const char *name, unsigned flags, hid_t fapl_id, + haddr_t maxaddr); +static herr_t H5FD_ros3_close(H5FD_t *_file); +static int H5FD_ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2); +static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags); +static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); +static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, + void** file_handle); +static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, + haddr_t addr, size_t size, void *buf); +static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, + haddr_t addr, size_t size, const void *buf); +static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id, + hbool_t closing); +static herr_t H5FD_ros3_lock(H5FD_t *_file, hbool_t rw); +static herr_t H5FD_ros3_unlock(H5FD_t *_file); +static herr_t H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa); + +static const H5FD_class_t H5FD_ros3_g = { + "ros3", /* name */ + MAXADDR, /* maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ + H5FD_ros3_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + sizeof(H5FD_ros3_fapl_t), /* fapl_size */ + H5FD_ros3_fapl_get, /* fapl_get */ + H5FD_ros3_fapl_copy, /* fapl_copy */ + H5FD_ros3_fapl_free, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD_ros3_open, /* open */ + H5FD_ros3_close, /* close */ + H5FD_ros3_cmp, /* cmp */ + H5FD_ros3_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD_ros3_get_eoa, /* get_eoa */ + H5FD_ros3_set_eoa, /* set_eoa */ + H5FD_ros3_get_eof, /* get_eof */ + H5FD_ros3_get_handle, /* get_handle */ + H5FD_ros3_read, /* read */ + H5FD_ros3_write, /* write */ + NULL, /* flush */ + H5FD_ros3_truncate, /* truncate */ + H5FD_ros3_lock, /* lock */ + H5FD_ros3_unlock, /* unlock */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ +}; + +/* Declare a free list to manage the H5FD_ros3_t struct */ +H5FL_DEFINE_STATIC(H5FD_ros3_t); + + +/*------------------------------------------------------------------------- + * Function: H5FD__init_package + * + * Purpose: Initializes any interface-specific data or routines. + * + * Return: Non-negative on success/Negative on failure + * + * Changes: Rename as appropriate for ros3 vfd. + * Jacob Smith 2017 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__init_package(void) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + if (H5FD_ros3_init() < 0) { + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + "unable to initialize ros3 VFD") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_init + * + * Purpose: Initialize this driver by registering the driver with the + * library. + * + * Return: Success: The driver ID for the ros3 driver. + * Failure: Negative + * + * Programmer: Robb Matzke + * Thursday, July 29, 1999 + * + * Changes: Rename as appropriate for ros3 vfd. + * Jacob Smith 2017 + * + *------------------------------------------------------------------------- + */ +hid_t +H5FD_ros3_init(void) +{ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_init() called.\n"); +#endif + + if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) + H5FD_ROS3_g = H5FD_register(&H5FD_ros3_g, sizeof(H5FD_class_t), FALSE); + +#if ROS3_STATS + /* pre-compute statsbin boundaries + */ + for (unsigned bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { + unsigned long long value = 0; + ROS3_STATS_POW(bin_i, &value) + ros3_stats_boundaries[bin_i] = value; + } +#endif + + /* Set return value */ + ret_value = H5FD_ROS3_g; + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ros3_init() */ + + +/*--------------------------------------------------------------------------- + * Function: H5FD_ros3_term + * + * Purpose: Shut down the VFD + * + * Returns: SUCCEED (Can't fail) + * + * Programmer: Quincey Koziol + * Friday, Jan 30, 2004 + * + * Changes: Rename as appropriate for ros3 vfd. + * Jacob Smith 2017 + * + *--------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_term(void) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_term() called.\n"); +#endif + + /* Reset VFL ID */ + H5FD_ROS3_g = 0; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FD_ros3_term() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_ros3 + * + * Purpose: Modify the file access property list to use the H5FD_ROS3 + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably + * initialized instance of H5FD_ros3_fapl_t + * + * Return: SUCCEED/FAIL + * + * Programmer: John Mainzer + * 9/10/17 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_ros3(hid_t fapl_id, + H5FD_ros3_fapl_t *fa) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = FAIL; + + + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa); + + HDassert(fa != NULL); + +#if ROS3_DEBUG + HDfprintf(stdout, "H5Pset_fapl_ros3() called.\n"); +#endif + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ + "not a file access property list") + } + + if (FAIL == H5FD_ros3_validate_config(fa)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") + + ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa); + +done: + + FUNC_LEAVE_API(ret_value) + +} /* H5Pset_fapl_ros3() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_validate_config() + * + * Purpose: Test to see if the supplied instance of H5FD_ros3_fapl_t + * contains internally consistant data. Return SUCCEED if so, + * and FAIL otherwise. + * + * Note the difference between internally consistant and + * correct. As we will have to try to access the target + * object to determine whether the supplied data is correct, + * we will settle for internal consistancy at this point + * + * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally + * consistant data, FAIL otherwise. + * + * Programmer: Jacob Smith + * 9/10/17 + * + * Changes: Add checks for authenticate flag requring populated + * `aws_region` and `secret_id` strings. + * -- Jacob Smith 2017-11-01 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(fa != NULL); + + if ( fa->version != H5FD__CURR_ROS3_FAPL_T_VERSION ) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Unknown H5FD_ros3_fapl_t version"); + } + + /* if set to authenticate, region and id cannot be empty strings + */ + if (fa->authenticate == TRUE) { + if ((fa->aws_region[0] == '\0') || + (fa->secret_id[0] == '\0')) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Inconsistent authentication information"); + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_validate_config() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_fapl_ros3 + * + * Purpose: Returns information about the ros3 file access property + * list though the function arguments. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: John Mainzer + * 9/10/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_fapl_ros3(hid_t fapl_id, + H5FD_ros3_fapl_t *fa_out) +{ + const H5FD_ros3_fapl_t *fa; + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*x", fapl_id, fa_out); + +#if ROS3_DEBUG + HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); +#endif + + if (fa_out == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") + + plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); + if (plist == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + } + + if (H5FD_ROS3 != H5P_peek_driver(plist)) { + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + } + + fa = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist); + if (fa == NULL) { + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + } + + /* Copy the ros3 fapl data out */ + HDmemcpy(fa_out, fa, sizeof(H5FD_ros3_fapl_t)); + +done: + FUNC_LEAVE_API(ret_value) + +} /* H5Pget_fapl_ros3() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_get + * + * Purpose: Gets a file access property list which could be used to + * create an identical file. + * + * Return: Success: Ptr to new file access property list value. + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_ros3_fapl_get(H5FD_t *_file) +{ + H5FD_ros3_t *file = (H5FD_ros3_t*)_file; + H5FD_ros3_fapl_t *fa = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); + if (fa == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed") + } + + /* Copy the fields of the structure */ + HDmemcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); + + /* Set return value */ + ret_value = fa; + +done: + if (ret_value == NULL) { + if (fa != NULL) + H5MM_xfree(fa); + } + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_fapl_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_copy + * + * Purpose: Copies the ros3-specific file access properties. + * + * Return: Success: Ptr to a new property list + * + * Failure: NULL + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void * +H5FD_ros3_fapl_copy(const void *_old_fa) +{ + const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t*)_old_fa; + H5FD_ros3_fapl_t *new_fa = NULL; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); + if (new_fa == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed"); + } + + HDmemcpy(new_fa, old_fa, sizeof(H5FD_ros3_fapl_t)); + ret_value = new_fa; + +done: + if (ret_value == NULL) { + if (new_fa != NULL) + H5MM_xfree(new_fa); + } + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_fapl_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_fapl_free + * + * Purpose: Frees the ros3-specific file access properties. + * + * Return: SUCCEED (cannot fail) + * + * Programmer: John Mainzer + * 9/8/17 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_fapl_free(void *_fa) +{ + H5FD_ros3_fapl_t *fa = (H5FD_ros3_fapl_t*)_fa; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(fa != NULL); /* sanity check */ + + H5MM_xfree(fa); + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5FD_ros3_fapl_free() */ + +#if ROS3_STATS + +/*---------------------------------------------------------------------------- + * + * Function: ros3_reset_stats() + * + * Purpose: + * + * Reset the stats collection elements in this virtual file structure. + * + * Clears any set data in stats bins; initializes/zeroes values. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - Occurs if the file is invalid somehow + * + * Programmer: Jacob Smith + * 2017-12-08 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static herr_t +ros3_reset_stats(H5FD_ros3_t *file) +{ + unsigned i = 0; + herr_t ret_value = SUCCEED; + + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDprintf("ros3_reset_stats() called\n"); +#endif + + if (file == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file was null"); + } + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + file->raw[i].bytes = 0; + file->raw[i].count = 0; + file->raw[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; + file->raw[i].max = 0; + + file->meta[i].bytes = 0; + file->meta[i].count = 0; + file->meta[i].min = (unsigned long long)ROS3_STATS_STARTING_MIN; + file->meta[i].max = 0; + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* ros3_reset_stats */ +#endif /* ROS3_STATS */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_open() + * + * Purpose: + * + * Create and/or opens a file as an HDF5 file. + * + * Any flag except H5F_ACC_RDONLY will cause an error. + * + * Name (as received from `H5FD_open()`) must conform to web url: + * NAME :: HTTP "://" DOMAIN [PORT] ["/" [URI] [QUERY] ] + * HTTP :: "http" [ "s" ] + * DOMAIN :: e.g., "mybucket.host.org" + * PORT :: ":" (e.g., ":9000" ) + * URI :: (e.g., "path/to/resource.hd5" ) + * QUERY :: "?" (e.g., "arg1=param1&arg2=param2") + * + * Return: + * + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is + * always H5FD_open(). + * + * Failure: NULL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static H5FD_t * +H5FD_ros3_open(const char *url, + unsigned flags, + hid_t fapl_id, + haddr_t maxaddr) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_t *file = NULL; + struct tm *now = NULL; + char iso8601now[ISO8601_SIZE]; + unsigned char signing_key[SHA256_DIGEST_LENGTH]; + s3r_t *handle = NULL; + H5FD_ros3_fapl_t fa; +#endif + H5FD_t *ret_value = NULL; + + + + FUNC_ENTER_NOAPI_NOINIT +#ifdef H5_HAVE_ROS3_VFD + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_open() called.\n"); +#endif + + + /* Sanity check on file offsets */ + HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); + + /* Check arguments */ + if (!url || !*url) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + if (0 == maxaddr || HADDR_UNDEF == maxaddr) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + if (ADDR_OVERFLOW(maxaddr)) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + if (flags != H5F_ACC_RDONLY) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, + "only Read-Only access allowed") + + if (FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") + } + + if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "unable to initialize curl global (placeholder flags)") + } + + /* open file; procedure depends on whether or not the fapl instructs to + * authenticate requests or not. + */ + if (fa.authenticate == TRUE) { + /* compute signing key (part of AWS/S3 REST API) + * can be re-used by user/key for 7 days after creation. + * find way to re-use/share + */ + now = gmnow(); + HDassert( now != NULL ); + if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "problem while writing iso8601 timestamp") + } + if (FAIL == H5FD_s3comms_signing_key(signing_key, + (const char *)fa.secret_key, + (const char *)fa.aws_region, + (const char *)iso8601now) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "problem while computing signing key") + } + + handle = H5FD_s3comms_s3r_open( + url, + (const char *)fa.aws_region, + (const char *)fa.secret_id, + (const unsigned char *)signing_key); + } else { + handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL); + } /* if/else should authenticate */ + + if (handle == NULL) { + /* If we want to check CURL's say on the matter in a controlled + * fashion, this is the place to do it, but would need to make a + * few minor changes to s3comms `s3r_t` and `s3r_read()`. + */ + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); + } + + /* create new file struct + */ + file = H5FL_CALLOC(H5FD_ros3_t); + if (file == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "unable to allocate file struct") + } + + file->s3r_handle = handle; + HDmemcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t)); + +#if ROS3_STATS + if (FAIL == ros3_reset_stats(file)) { + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, + "unable to reset file statistics") + } +#endif /* ROS3_STATS */ + + ret_value = (H5FD_t*)file; + +done: + if (ret_value == NULL) { + if (handle != NULL) { + if (FAIL == H5FD_s3comms_s3r_close(handle)) { + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + "unable to close s3 file handle") + } + } + if (file != NULL) { + file = H5FL_FREE(H5FD_ros3_t, file); + } + curl_global_cleanup(); /* early cleanup because open failed */ + } /* if null return value (error) */ +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_open() */ + +#if ROS3_STATS + +/*---------------------------------------------------------------------------- + * + * Function: ros3_fprint_stats() + * + * Purpose: + * + * Tabulate and pretty-print statistics for this virtual file. + * + * Should be called upon file close. + * + * Shows number of reads and bytes read, broken down by + * "raw" (H5FD_MEM_DRAW) + * or "meta" (any other flag) + * + * Prints filename and listing of total number of reads and bytes read, + * both as a grand total and separate meta- and rawdata reads. + * + * If any reads were done, prints out two tables: + * + * 1. overview of raw- and metadata reads + * - min (smallest size read) + * - average of size read + * - k,M,G suffixes by powers of 1024 (2^10) + * - max (largest size read) + * 2. tabulation of "bins", sepraring reads into exponentially-larger + * ranges of size. + * - columns for number of reads, total bytes, and average size, with + * separate sub-colums for raw- and metadata reads. + * - each row represents one bin, identified by the top of its range + * + * Bin ranges can be modified with pound-defines at the top of this file. + * + * Bins without any reads in their bounds are not printed. + * + * An "overflow" bin is also present, to catch "big" reads. + * + * Output for all bins (and range ceiling and average size report) + * is divied by powers of 1024. By corollary, four digits before the decimal + * is valid. + * + * - 41080 bytes is represented by 40.177k, not 41.080k + * - 1004.831M represents approx. 1052642000 bytes + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - occurs if the file passed in is invalid + * - TODO: if stream is invalid? how can we check this? + * + * Programmer: Jacob Smith + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static herr_t +ros3_fprint_stats(FILE *stream, + const H5FD_ros3_t *file) +{ + herr_t ret_value = SUCCEED; + parsed_url_t *purl = NULL; + unsigned i = 0; + unsigned long count_meta = 0; + unsigned long count_raw = 0; + double average_meta = 0.0; + double average_raw = 0.0; + unsigned long long min_meta = (unsigned long long)ROS3_STATS_STARTING_MIN; + unsigned long long min_raw = (unsigned long long)ROS3_STATS_STARTING_MIN; + unsigned long long max_meta = 0; + unsigned long long max_raw = 0; + unsigned long long bytes_raw = 0; + unsigned long long bytes_meta = 0; + double re_dub = 0.0; /* re-usable double variable */ + unsigned suffix_i = 0; + const char suffixes[] = { ' ', 'K', 'M', 'G', 'T', 'P' }; + + + + FUNC_ENTER_NOAPI_NOINIT + + if (stream == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file stream cannot be null" ); + } + if (file == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "file cannot be null"); + } + if (file->s3r_handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "s3 request handle cannot be null"); + } + if (file->s3r_handle->purl == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "parsed url structure cannot be null"); + } + purl = file->s3r_handle->purl; + + /****************** + * PRINT FILENAME * + ******************/ + + HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); + if (purl->port != NULL && purl->port[0] != '\0') + HDfprintf(stream, ":%s", purl->port); + if (purl->query != NULL && purl->query[0] != '\0') { + if (purl->path != NULL && purl->path[0] != '\0') + HDfprintf(stream, "/%s", purl->path); + else + HDfprintf(stream, "/"); + HDfprintf(stream, "?%s", purl->query); + } else if (purl->path != NULL && purl->path[0] != '\0') { + HDfprintf(stream, "/%s", purl->path); + } + HDfprintf(stream, "\n"); + + /******************* + * AGGREGATE STATS * + *******************/ + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + const ros3_statsbin *r = &file->raw[i]; + const ros3_statsbin *m = &file->meta[i]; + + if (m->min < min_meta) min_meta = m->min; + if (r->min < min_raw) min_raw = r->min; + if (m->max > max_meta) max_meta = m->max; + if (r->max > max_raw) max_raw = r->max; + + count_raw += r->count; + count_meta += m->count; + bytes_raw += r->bytes; + bytes_meta += m->bytes; + } + if (count_raw > 0) + average_raw = (double)bytes_raw / (double)count_raw; + if (count_meta > 0) + average_meta = (double)bytes_meta / (double)count_meta; + + /****************** + * PRINT OVERVIEW * + ******************/ + + HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", + count_raw + count_meta, count_meta, count_raw); + HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", + bytes_raw + bytes_meta, bytes_meta, bytes_raw); + + if (count_raw + count_meta == 0) + goto done; + + /************************* + * PRINT AGGREGATE STATS * + *************************/ + + HDfprintf(stream, "SIZES meta raw\n"); + HDfprintf(stream, " min "); + if (count_meta == 0) { + HDfprintf(stream, " 0.000 "); + } else { + re_dub = (double)min_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + } + + if (count_raw == 0) { + HDfprintf(stream, " 0.000 \n"); + } else { + re_dub = (double)min_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + } + + HDfprintf(stream, " avg "); + re_dub = (double)average_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)average_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + HDfprintf(stream, " max "); + re_dub = (double)max_meta; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + + re_dub = (double)max_raw; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + + /****************************** + * PRINT INDIVIDUAL BIN STATS * + ******************************/ + + HDfprintf(stream, + "BINS # of reads total bytes average size\n"); + HDfprintf(stream, + " up-to meta raw meta raw meta raw\n"); + + for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { + const ros3_statsbin *m; + const ros3_statsbin *r; + unsigned long long range_end = 0; + char bm_suffix = ' '; /* bytes-meta */ + double bm_val = 0.0; + char br_suffix = ' '; /* bytes-raw */ + double br_val = 0.0; + char am_suffix = ' '; /* average-meta */ + double am_val = 0.0; + char ar_suffix = ' '; /* average-raw */ + double ar_val = 0.0; + + m = &file->meta[i]; + r = &file->raw[i]; + if (r->count == 0 && m->count == 0) + continue; + + range_end = ros3_stats_boundaries[i]; + + if (i == ROS3_STATS_BIN_COUNT) { + range_end = ros3_stats_boundaries[i-1]; + HDfprintf(stream, ">"); + } else { + HDfprintf(stream, " "); + } + + bm_val = (double)m->bytes; + for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) + bm_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + bm_suffix = suffixes[suffix_i]; + + br_val = (double)r->bytes; + for (suffix_i = 0; br_val >= 1024.0; suffix_i++) + br_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + br_suffix = suffixes[suffix_i]; + + if (m->count > 0) + am_val = (double)(m->bytes) / (double)(m->count); + for (suffix_i = 0; am_val >= 1024.0; suffix_i++) + am_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + am_suffix = suffixes[suffix_i]; + + if (r->count > 0) + ar_val = (double)(r->bytes) / (double)(r->count); + for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) + ar_val /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + ar_suffix = suffixes[suffix_i]; + + re_dub = (double)range_end; + for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) + re_dub /= 1024.0; + HDassert(suffix_i < sizeof(suffixes)); + + HDfprintf(stream, + " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", + re_dub, suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* rawdata reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* rawdata bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* rawdata average */ + + fflush(stream); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* ros3_fprint_stats */ +#endif /* ROS3_STATS */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_close() + * + * Purpose: + * + * Close an HDF5 file. + * + * Return: + * + * SUCCEED/FAIL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_close(H5FD_t *_file) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_t *file = (H5FD_ros3_t *)_file; + herr_t ret_value = SUCCEED; +#else + herr_t ret_value = FAIL; +#endif + + + + FUNC_ENTER_NOAPI_NOINIT +#ifdef H5_HAVE_ROS3_VFD + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_close() called.\n"); +#endif + + /* Sanity checks + */ + HDassert(file != NULL); + HDassert(file->s3r_handle != NULL); + + /* Close the underlying request handle + */ + if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) { + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close S3 request handle") + } + +#if ROS3_STATS + /* TODO: mechanism to re-target stats printout */ + if (FAIL == ros3_fprint_stats(stdout, file)) { + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, + "problem while writing file statistics") + } +#endif /* ROS3_STATS */ + + /* Release the file info + */ + file = H5FL_FREE(H5FD_ros3_t, file); + +done: + curl_global_cleanup(); /* cleanup to answer init on open */ +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ros3_close() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_cmp() + * + * Purpose: + * + * Compares two files belonging to this driver using an arbitrary + * (but consistent) ordering: + * + * + url scheme + * + url host + * + url port + * + url path + * + url query + * + fapl aws_region + * + fapl secret_id + * + fapl secret_key + * + * tl;dr -> check URL, check crentials + * + * Return: + * + * - Equivalent: 0 + * - Not Equivalent: -1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + * Changes: + * + * + Change from strcmp-like return values (-1, 0, 1) to instead return + * binary equivalence (0) or inequality (-1). + * + Replace "if still equal then check this" waterfall with GOTO jumps. + * Jacob Smith 2018-05-17 + * + *------------------------------------------------------------------------- + */ +static int +H5FD_ros3_cmp(const H5FD_t *_f1, + const H5FD_t *_f2) +{ +#ifdef H5_HAVE_ROS3_VFD + const H5FD_ros3_t *f1 = (const H5FD_ros3_t *)_f1; + const H5FD_ros3_t *f2 = (const H5FD_ros3_t *)_f2; + const parsed_url_t *purl1 = NULL; + const parsed_url_t *purl2 = NULL; +#endif + int ret_value = 0; + + + + FUNC_ENTER_NOAPI_NOINIT_NOERR +#ifdef H5_HAVE_ROS3_VFD + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_cmp() called.\n"); +#endif + + HDassert(f1->s3r_handle != NULL); + HDassert(f2->s3r_handle != NULL); + + purl1 = (const parsed_url_t *)f1->s3r_handle->purl; + purl2 = (const parsed_url_t *)f2->s3r_handle->purl; + HDassert(purl1 != NULL); + HDassert(purl2 != NULL); + HDassert(purl1->scheme != NULL); + HDassert(purl2->scheme != NULL); + HDassert(purl1->host != NULL); + HDassert(purl2->host != NULL); + + /* URL: SCHEME */ + if (strcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); + + /* URL: HOST */ + if (strcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); + + /* URL: PORT */ + if (purl1->port && purl2->port) { + if (strcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); + } else if (purl1->port) { + HGOTO_DONE(-1); + } else if (purl2->port) { + HGOTO_DONE(-1); + } + + /* URL: PATH */ + if (purl1->path && purl2->path) { + if (strcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); + } else if (purl1->path && !purl2->path) { + HGOTO_DONE(-1); + } else if (purl2->path && !purl1->path) { + HGOTO_DONE(-1); + } + + /* URL: QUERY */ + if (purl1->query && purl2->query) { + if (strcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); + } else if (purl1->query && !purl2->query) { + HGOTO_DONE(-1); + } else if (purl2->query && !purl1->query) { + HGOTO_DONE(-1); + } + + /* FAPL: AWS_REGION */ + if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') { + if (strcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); + } else if (f1->fa.aws_region[0] != '\0') { + HGOTO_DONE(-1); + } else if (f2->fa.aws_region[0] != '\0') { + HGOTO_DONE(-1); + } + + /* FAPL: SECRET_ID */ + if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') { + if (strcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); + } else if (f1->fa.secret_id[0] != '\0') { + HGOTO_DONE(-1); + } else if (f2->fa.secret_id[0] != '\0') { + HGOTO_DONE(-1); + } + + /* FAPL: SECRET_KEY */ + if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') { + if (strcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); + } else if (f1->fa.secret_key[0] != '\0') { + HGOTO_DONE(-1); + } else if (f2->fa.secret_key[0] != '\0') { + HGOTO_DONE(-1); + } +#endif /* H5_HAVE_ROS3_VFD */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5FD_ros3_query + * + * Purpose: Set the flags that this VFL driver is capable of supporting. + * (listed in H5FDpublic.h) + * + * Note that since the ROS3 VFD is read only, most flags + * are irrelevant. + * + * The term "set" is highly misleading... + * stores/copies the supported flags in the out-pointer `flags`. + * + * Return: SUCCEED (Can't fail) + * + * Programmer: John Mainzer + * 9/11/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, + unsigned long *flags /* out */) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_query() called.\n"); +#endif + + /* Set the VFL feature flags that this driver supports */ + if (flags) { + *flags = 0; + /* OK to perform data sieving for faster raw data reads & writes */ + *flags |= H5FD_FEAT_DATA_SIEVE; + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5FD_ros3_query() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_get_eoa() + * + * Purpose: + * + * Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. + * + * Return: + * + * The end-of-address marker. + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static haddr_t +H5FD_ros3_get_eoa(const H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ + const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_get_eoa() called.\n"); +#endif + + FUNC_LEAVE_NOAPI(file->eoa) + +} /* end H5FD_ros3_get_eoa() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_set_eoa() + * + * Purpose: + * + * Set the end-of-address marker for the file. + * + * Return: + * + * SUCCEED (can't fail) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_set_eoa(H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + haddr_t addr) +{ + H5FD_ros3_t *file = (H5FD_ros3_t *)_file; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_set_eoa() called.\n"); +#endif + + file->eoa = addr; + + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* H5FD_ros3_set_eoa() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_get_eof() + * + * Purpose: + * + * Returns the end-of-file marker. + * + * Return: + * + * EOF: the first address past the end of the "file", either the + * filesystem file or the HDF5 file. + * + * Programmer: Jacob Smith + * 2017-11-02 + * + *------------------------------------------------------------------------- + */ +static haddr_t +H5FD_ros3_get_eof(const H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ + const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_get_eof() called.\n"); +#endif + + FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle)) + +} /* end H5FD_ros3_get_eof() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_get_handle() + * + * Purpose: + * + * Returns the S3 Request handle (s3r_t) of ros3 file driver. + * + * Returns: + * + * SUCCEED/FAIL + * + * Programmer: Jacob Smith + * 2017-11-02 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_get_handle(H5FD_t *_file, + hid_t H5_ATTR_UNUSED fapl, + void **file_handle) +{ + H5FD_ros3_t *file = (H5FD_ros3_t *)_file; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n"); +#endif + + if(!file_handle) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + + *file_handle = file->s3r_handle; + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ros3_get_handle() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_read() + * + * Purpose: + * + * Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in DXPL_ID. + * + * Return: + * + * Success: `SUCCEED` + * - Result is stored in caller-supplied buffer BUF. + * Failure: `FAIL` + * - Unable to complete read. + * - Contents of buffer `buf` are undefined. + * + * Programmer: Jacob Smith + * 2017-11-?? + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_read(H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t addr, /* start offset */ + size_t size, /* length of read */ + void *buf) /* out */ +{ + H5FD_ros3_t *file = (H5FD_ros3_t *)_file; + size_t filesize = 0; + herr_t ret_value = SUCCEED; /* Return value */ +#if ROS3_STATS + /* working variables for storing stats */ + ros3_statsbin *bin = NULL; + unsigned bin_i = 0; +#endif /* ROS3_STATS */ + + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_read() called.\n"); +#endif + + HDassert(file != NULL); + HDassert(file->s3r_handle != NULL); + HDassert(buf != NULL); + + filesize = H5FD_s3comms_s3r_get_filesize(file->s3r_handle); + + if ((addr > filesize) || ((addr + size) > filesize)) { + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") + } + + if (FAIL == H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) ) { + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") + } + +#if ROS3_STATS + + /* Find which "bin" this read fits in. Can be "overflow" bin. + */ + for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { + if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) + break; + } + bin = (type == H5FD_MEM_DRAW) + ? &file->raw[bin_i] + : &file->meta[bin_i]; + + /* Store collected stats in appropriate bin + */ + if (bin->count == 0) { + bin->min = size; + bin->max = size; + } else { + if (size < bin->min) + bin->min = size; + if (size > bin->max) + bin->max = size; + } + bin->count++; + bin->bytes += (unsigned long long)size; + +#endif /* ROS3_STATS */ + + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ros3_read() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_write() + * + * Purpose: + * + * Write bytes to file. + * UNSUPPORTED IN READ-ONLY ROS3 VFD. + * + * Return: + * + * FAIL (Not possible with Read-Only S3 file.) + * + * Programmer: Jacob Smith + * 2017-10-23 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, + const void H5_ATTR_UNUSED *buf) +{ + herr_t ret_value = FAIL; + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_write() called.\n"); +#endif + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "cannot write to read-only file.") + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_ros3_write() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_truncate() + * + * Purpose: + * + * Makes sure that the true file size is the same (or larger) + * than the end-of-address. + * + * NOT POSSIBLE ON READ-ONLY S3 FILES. + * + * Return: + * + * FAIL (Not possible on Read-Only S3 files.) + * + * Programmer: Jacob Smith + * 2017-10-23 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, + hid_t H5_ATTR_UNUSED dxpl_id, + hbool_t H5_ATTR_UNUSED closing) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if ROS3_DEBUG + HDfprintf(stdout, "H5FD_ros3_truncate() called.\n"); +#endif + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "cannot truncate read-only file.") + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_ros3_truncate() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_lock() + * + * Purpose: + * + * Place an advisory lock on a file. + * No effect on Read-Only S3 file. + * + * Suggestion: remove lock/unlock from class + * > would result in error at H5FD_[un]lock() (H5FD.c) + * + * Return: + * + * SUCCEED (No-op always succeeds) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, + hbool_t H5_ATTR_UNUSED rw) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* end H5FD_ros3_lock() */ + + +/*------------------------------------------------------------------------- + * + * Function: H5FD_ros3_unlock() + * + * Purpose: + * + * Remove the existing lock on the file. + * No effect on Read-Only S3 file. + * + * Return: + * + * SUCCEED (No-op always succeeds) + * + * Programmer: Jacob Smith + * 2017-11-03 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(SUCCEED) + +} /* end H5FD_ros3_unlock() */ + + diff --git a/src/H5FDros3.h b/src/H5FDros3.h new file mode 100644 index 0000000..49e757c --- /dev/null +++ b/src/H5FDros3.h @@ -0,0 +1,105 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: John Mainzer + * 2017-10-10 + * + * Purpose: The public header file for the ros3 driver. + */ +#ifndef H5FDros3_H +#define H5FDros3_H + +#define H5FD_ROS3 (H5FD_ros3_init()) + +#ifdef __cplusplus +extern "C" { +#endif + +/**************************************************************************** + * + * Structure: H5FD_ros3_fapl_t + * + * Purpose: + * + * H5FD_ros3_fapl_t is a public structure that is used to pass S3 + * authentication data to the appropriate S3 VFD via the FAPL. A pointer + * to an instance of this structure is a parameter to H5Pset_fapl_ros3() + * and H5Pget_fapl_ros3(). + * + * + * + * `version` (int32_t) + * + * Version number of the H5FD_ros3_fapl_t structure. Any instance passed + * to the above calls must have a recognized version number, or an error + * will be flagged. + * + * This field should be set to H5FD__CURR_ROS3_FAPL_T_VERSION. + * + * `authenticate` (hbool_t) + * + * Flag TRUE or FALSE whether or not requests are to be authenticated + * with the AWS4 algorithm. + * If TRUE, `aws_region`, `secret_id`, and `secret_key` must be populated. + * If FALSE, those three components are unused. + * + * `aws_region` (char[]) + * + * String: name of the AWS "region" of the host, e.g. "us-east-1". + * + * `secret_id` (char[]) + * + * String: "Access ID" for the resource. + * + * `secret_key` (char[]) + * + * String: "Secret Access Key" associated with the ID and resource. + * + * + * + * Programmer: John Mainzer + * + * Changes: + * + * - Add documentation of fields (except `version`) + * --- Jacob Smith 2017-12-04 + * + ****************************************************************************/ + +#define H5FD__CURR_ROS3_FAPL_T_VERSION 1 + +#define H5FD__ROS3_MAX_REGION_LEN 32 +#define H5FD__ROS3_MAX_SECRET_ID_LEN 128 +#define H5FD__ROS3_MAX_SECRET_KEY_LEN 128 + +typedef struct H5FD_ros3_fapl_t { + int32_t version; + hbool_t authenticate; + char aws_region[H5FD__ROS3_MAX_REGION_LEN + 1]; + char secret_id[H5FD__ROS3_MAX_SECRET_ID_LEN + 1]; + char secret_key[H5FD__ROS3_MAX_SECRET_KEY_LEN + 1]; +} H5FD_ros3_fapl_t; + +H5_DLL hid_t H5FD_ros3_init(void); +H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa_out); +H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa); + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef H5FDros3_H */ + + diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c new file mode 100644 index 0000000..7caeacb --- /dev/null +++ b/src/H5FDs3comms.c @@ -0,0 +1,3770 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/***************************************************************************** + * Source for S3 Communications module + * + * ***NOT A FILE DRIVER*** + * + * Provide functions and structures required for interfacing with Amazon + * Simple Storage Service (S3). + * + * Provide S3 object access as if it were a local file. + * + * Connect to remote host, send and receive HTTP requests and responses + * as part of the AWS REST API, authenticating requests as appropriate. + * + * Programmer: Jacob Smith + * 2017-11-30 + * + *****************************************************************************/ + +/****************/ +/* Module Setup */ +/****************/ + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* generic functions */ +#include "H5Eprivate.h" /* error handling */ +#include "H5MMprivate.h" /* memory management */ +#include "H5FDs3comms.h" /* S3 Communications */ + +/****************/ +/* Local Macros */ +/****************/ + +/* toggle debugging (enable with 1) + */ +#define S3COMMS_DEBUG 0 + +/* manipulate verbosity of CURL output + * operates separately from S3COMMS_DEBUG + * + * 0 -> no explicit curl output + * 1 -> on error, print failure info to stderr + * 2 -> in addition to above, print information for all performs; sets all + * curl handles with CURLOPT_VERBOSE + */ +#define S3COMMS_CURL_VERBOSITY 0 + +/* size to allocate for "bytes=[-]" HTTP Range value + */ +#define S3COMMS_MAX_RANGE_STRING_SIZE 128 + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Structures */ +/********************/ + +/* struct s3r_datastruct + * Structure passed to curl write callback + * pointer to data region and record of bytes written (offset) + */ +struct s3r_datastruct { + unsigned long magic; + char *data; + size_t size; +}; +#define S3COMMS_CALLBACK_DATASTRUCT_MAGIC 0x28c2b2ul + +/********************/ +/* Local Prototypes */ +/********************/ + +size_t curlwritecallback(char *ptr, + size_t size, + size_t nmemb, + void *userdata); + +herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/*************/ +/* Functions */ +/*************/ + + +/*---------------------------------------------------------------------------- + * + * Function: curlwritecallback() + * + * Purpose: + * + * Function called by CURL to write received data. + * + * Writes bytes to `userdata`. + * + * Internally manages number of bytes processed. + * + * Return: + * + * - Number of bytes processed. + * - Should equal number of bytes passed to callback. + * - Failure will result in curl error: CURLE_WRITE_ERROR. + * + * Programmer: Jacob Smith + * 2017-08-17 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +size_t +curlwritecallback(char *ptr, + size_t size, + size_t nmemb, + void *userdata) +{ + struct s3r_datastruct *sds = (struct s3r_datastruct *)userdata; + size_t product = (size * nmemb); + size_t written = 0; + + if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) + return written; + + if (size > 0) { + HDmemcpy(&(sds->data[sds->size]), ptr, product); + sds->size += product; + written = product; + } + + return written; + +} /* curlwritecallback */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_hrb_node_set() + * + * Purpose: + * + * Create, insert, modify, and remove elements in a field node list. + * + * `name` cannot be null; will return FAIL and list will be unaltered. + * + * Entries are accessed via the lowercase representation of their name: + * "Host", "host", and "hOSt" would all access the same node, + * but name's case is relevant in HTTP request output. + * + * List pointer `L` must always point to either of : + * - header node with lowest alphabetical order (by lowername) + * - NULL, if list is empty + * + * Types of operations: + * + * - CREATE + * - If `L` is NULL and `name` and `value` are not NULL, + * a new node is created at `L`, starting a list. + * - MODIFY + * - If a node is found with a matching lowercase name and `value` + * is not NULL, the existing name, value, and cat values are released + * and replaced with the new data. + * - No modifications are made to the list pointers. + * - REMOVE + * - If `value` is NULL, will attempt to remove node with matching + * lowercase name. + * - If no match found, returns FAIL and list is not modified. + * - When removing a node, all its resources is released. + * - If removing the last node in the list, list pointer is set to NULL. + * - INSERT + * - If no nodes exists with matching lowercase name and `value` + * is not NULL, a new node is created, inserted into list + * alphabetically by lowercase name. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - List was successfully modified + * - FAILURE: `FAIL` + * - Unable to perform operation + * - Forbidden (attempting to remove absent node, e.g.) + * - Internal error + * + * Programmer: Jacob Smith + * 2017-09-22 + * + * Changes: + * + * - Change return value to herr_t + * - Change list pointer to pointer-to-pointer-to-node + * - Change to use singly-linked list (from twin doubly-linked lists) + * with modification to hrb_node_t + * --- Jake Smith 2017-01-17 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_hrb_node_set(hrb_node_t **L, + const char *name, + const char *value) +{ + size_t i = 0; + char *valuecpy = NULL; + char *namecpy = NULL; + size_t namelen = 0; + char *lowername = NULL; + char *nvcat = NULL; + hrb_node_t *node_ptr = NULL; + hrb_node_t *new_node = NULL; + hbool_t is_looking = TRUE; + herr_t ret_value = SUCCEED; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set.\n"); + HDprintf("NAME: %s\n", name); + HDprintf("VALUE: %s\n", value); + HDprintf("LIST:\n->"); + for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) + HDfprintf(stdout, "{%s}\n->", node_ptr->cat); + HDprintf("(null)\n"); + fflush(stdout); + node_ptr = NULL; +#endif + + if (name == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to operate on null name.\n"); + } + namelen = HDstrlen(name); + + /*********************** + * PREPARE ALL STRINGS * + **********************/ + + /* copy and lowercase name + */ + lowername = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); + if (lowername == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "cannot make space for lowercase name copy.\n"); + } + for (i = 0; i < namelen; i++) { + lowername[i] = (char)tolower((int)name[i]); + } + lowername[namelen] = 0; + + /* If value supplied, copy name, value, and concatenated "name: value". + * If NULL, we will be removing a node or doing nothing, so no need for + * copies + */ + if (value != NULL) { + size_t valuelen = HDstrlen(value); + size_t catlen = namelen + valuelen + 2; /* HDstrlen(": ") -> +2 */ + int sprint_ret = 0; + + namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); + if (namecpy == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "cannot make space for name copy.\n"); + } + HDmemcpy(namecpy, name, namelen + 1); + + valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1)); + if (valuecpy == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "cannot make space for value copy.\n"); + } + HDmemcpy(valuecpy, value, valuelen + 1); + + nvcat = (char *)H5MM_malloc(sizeof(char) * (catlen + 1)); + if (nvcat == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "cannot make space for concatenated string.\n"); + } + sprint_ret = HDsnprintf(nvcat, (catlen + 1), "%s: %s", name, value); + if (sprint_ret <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while concatenating `%s: %s", name, value); + HDassert( catlen == (size_t)sprint_ret ); + + /* create new_node, should we need it + */ + new_node = (hrb_node_t *)H5MM_malloc(sizeof(hrb_node_t)); + if (new_node == NULL) { + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "cannot make space for new set.\n"); + } + + new_node->magic = S3COMMS_HRB_NODE_MAGIC; + new_node->name = NULL; + new_node->value = NULL; + new_node->cat = NULL; + new_node->lowername = NULL; + new_node->next = NULL; + } + + /*************** + * ACT ON LIST * + ***************/ + + if (*L == NULL) { + if (value == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "trying to remove node from empty list"); + } else { +#if S3COMMS_DEBUG +HDprintf("CREATE NEW\n"); fflush(stdout); +#endif + /******************* + * CREATE NEW LIST * + *******************/ + + new_node->cat = nvcat; + new_node->name = namecpy; + new_node->lowername = lowername; + new_node->value = valuecpy; + + *L = new_node; + goto done; /* bypass further seeking */ + } + } + + /* sanity-check pointer passed in + */ + HDassert( (*L) != NULL ); + HDassert( (*L)->magic == S3COMMS_HRB_NODE_MAGIC ); + node_ptr = (*L); + + /* Check whether to modify/remove first node in list + */ + if (strcmp(lowername, node_ptr->lowername) == 0) { + + is_looking = FALSE; + + if (value == NULL) { +#if S3COMMS_DEBUG +HDprintf("REMOVE HEAD\n"); fflush(stdout); +#endif + /*************** + * REMOVE HEAD * + ***************/ + + *L = node_ptr->next; + +#if S3COMMS_DEBUG +HDprintf("FREEING CAT (node)\n"); fflush(stdout); +#endif + H5MM_xfree(node_ptr->cat); +#if S3COMMS_DEBUG +HDprintf("FREEING LOWERNAME (node)\n"); fflush(stdout); +#endif + H5MM_xfree(node_ptr->lowername); +#if S3COMMS_DEBUG +HDprintf("FREEING NAME (node)\n"); fflush(stdout); +#endif + H5MM_xfree(node_ptr->name); +#if S3COMMS_DEBUG +HDprintf("FREEING VALUE (node)\n"); fflush(stdout); +#endif + H5MM_xfree(node_ptr->value); +#if S3COMMS_DEBUG +HDprintf("MAGIC OK? %s\n", + (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); +fflush(stdout); +#endif + HDassert( node_ptr->magic == S3COMMS_HRB_NODE_MAGIC ); + node_ptr->magic += 1ul; +#if S3COMMS_DEBUG +HDprintf("FREEING POINTER\n"); fflush(stdout); +#endif + H5MM_xfree(node_ptr); + +#if S3COMMS_DEBUG +HDprintf("FREEING WORKING LOWERNAME\n"); fflush(stdout); +#endif + H5MM_xfree(lowername); lowername = NULL; + } else { +#if S3COMMS_DEBUG +HDprintf("MODIFY HEAD\n"); fflush(stdout); +#endif + /*************** + * MODIFY HEAD * + ***************/ + + H5MM_xfree(node_ptr->cat); + H5MM_xfree(node_ptr->name); + H5MM_xfree(node_ptr->value); + + node_ptr->name = namecpy; + node_ptr->value = valuecpy; + node_ptr->cat = nvcat; + + H5MM_xfree(lowername); + lowername = NULL; + new_node->magic += 1ul; + H5MM_xfree(new_node); + new_node = NULL; + } + } else if (strcmp(lowername, node_ptr->lowername) < 0) { + + is_looking = FALSE; + + if (value == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "trying to remove a node 'before' head"); + } else { +#if S3COMMS_DEBUG +HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); +#endif + /******************* + * INSERT NEW HEAD * + *******************/ + + new_node->name = namecpy; + new_node->value = valuecpy; + new_node->lowername = lowername; + new_node->cat = nvcat; + new_node->next = node_ptr; + *L = new_node; + } + } + + /*************** + * SEARCH LIST * + ***************/ + + while (is_looking) { + if (node_ptr->next == NULL) { + + is_looking = FALSE; + + if (value == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "trying to remove absent node"); + } else { +#if S3COMMS_DEBUG +HDprintf("APPEND A NODE\n"); fflush(stdout); +#endif + /******************* + * APPEND NEW NODE * + *******************/ + + HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + new_node->name = namecpy; + new_node->value = valuecpy; + new_node->lowername = lowername; + new_node->cat = nvcat; + node_ptr->next = new_node; + } + } else if (strcmp(lowername, node_ptr->next->lowername) < 0) { + + is_looking = FALSE; + + if (value == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "trying to remove absent node"); + } else { +#if S3COMMS_DEBUG +HDprintf("INSERT A NODE\n"); fflush(stdout); +#endif + /******************* + * INSERT NEW NODE * + *******************/ + + HDassert( strcmp(lowername, node_ptr->lowername) > 0 ); + new_node->name = namecpy; + new_node->value = valuecpy; + new_node->lowername = lowername; + new_node->cat = nvcat; + new_node->next = node_ptr->next; + node_ptr->next = new_node; + } + } else if (strcmp(lowername, node_ptr->next->lowername) == 0) { + + is_looking = FALSE; + + if (value == NULL) { + /***************** + * REMOVE A NODE * + *****************/ + + hrb_node_t *tmp = node_ptr->next; + node_ptr->next = tmp->next; + +#if S3COMMS_DEBUG +HDprintf("REMOVE A NODE\n"); fflush(stdout); +#endif + H5MM_xfree(tmp->cat); + H5MM_xfree(tmp->lowername); + H5MM_xfree(tmp->name); + H5MM_xfree(tmp->value); + + HDassert( tmp->magic == S3COMMS_HRB_NODE_MAGIC ); + tmp->magic += 1ul; + H5MM_xfree(tmp); + + H5MM_xfree(lowername); + lowername = NULL; + } else { +#if S3COMMS_DEBUG +HDprintf("MODIFY A NODE\n"); fflush(stdout); +#endif + /***************** + * MODIFY A NODE * + *****************/ + + node_ptr = node_ptr->next; + H5MM_xfree(node_ptr->name); + H5MM_xfree(node_ptr->value); + H5MM_xfree(node_ptr->cat); + + HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC ); + new_node->magic += 1ul; + H5MM_xfree(new_node); + H5MM_xfree(lowername); + new_node = NULL; + lowername = NULL; + + node_ptr->name = namecpy; + node_ptr->value = valuecpy; + node_ptr->cat = nvcat; + } + } else { + /**************** + * KEEP LOOKING * + ****************/ + + node_ptr = node_ptr->next; + } + } + +done: + if (ret_value == FAIL) { + /* clean up + */ + if (nvcat != NULL) H5MM_xfree(nvcat); + if (namecpy != NULL) H5MM_xfree(namecpy); + if (lowername != NULL) H5MM_xfree(lowername); + if (valuecpy != NULL) H5MM_xfree(valuecpy); + if (new_node != NULL) { + HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC ); + new_node->magic += 1ul; + H5MM_xfree(new_node); + } + } + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_hrb_node_set */ + + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_hrb_destroy() + * + * Purpose: + * + * Destroy and free resources _directly_ associated with an HTTP Buffer. + * + * Takes a pointer to pointer to the buffer structure. + * This allows for the pointer itself to be NULLed from within the call. + * + * If buffer or buffer pointer is NULL, there is no effect. + * + * Headers list at `first_header` is not touched. + * + * - Programmer should re-use or destroy `first_header` pointer + * (hrb_node_t *) as suits their purposes. + * - Recommend fetching prior to destroy() + * e.g., `reuse_node = hrb_to_die->first_header; destroy(hrb_to_die);` + * or maintaining an external reference. + * - Destroy node/list separately as appropriate + * - Failure to account for this will result in a memory leak. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - successfully released buffer resources + * - if `buf` is NULL or `*buf` is NULL, no effect + * - FAILURE: `FAIL` + * - `buf->magic != S3COMMS_HRB_MAGIC` + * + * Programmer: Jacob Smith + * 2017-07-21 + * + * Changes: + * + * - Conditional free() of `hrb_node_t` pointer properties based on + * `which_free` property. + * --- Jacob Smith 2017-08-08 + * + * - Integrate with HDF5. + * - Returns herr_t instead of nothing. + * --- Jacob Smith 2017-09-21 + * + * - Change argument to from *buf to **buf, to null pointer within call + * --- Jacob Smith 2017-20-05 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_hrb_destroy(hrb_t **_buf) +{ + hrb_t *buf = NULL; + herr_t ret_value = SUCCEED; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); +#endif + + if (_buf != NULL && *_buf != NULL) { + buf = *_buf; + if (buf->magic != S3COMMS_HRB_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "pointer's magic does not match.\n"); + } + + H5MM_xfree(buf->verb); + H5MM_xfree(buf->version); + H5MM_xfree(buf->resource); + buf->magic += 1ul; + H5MM_xfree(buf); + *_buf = NULL; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_hrb_destroy */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_hrb_init_request() + * + * Purpose: + * + * Create a new HTTP Request Buffer + * + * All non-null arguments should be null-terminated strings. + * + * If `verb` is NULL, defaults to "GET". + * If `http_version` is NULL, defaults to "HTTP/1.1". + * + * `resource` cannot be NULL; should be string beginning with slash + * character ('/'). + * + * All strings are copied into the structure, making them safe from + * modification in source strings. + * + * Return: + * + * - SUCCESS: pointer to new `hrb_t` + * - FAILURE: `NULL` + * + * Programmer: Jacob Smith + * 2017-07-21 + * + * Changes: + * + * - Update struct membership for newer 'generic' `hrb_t` format. + * --- Jacob Smith, 2017-07-24 + * + * - Rename from `hrb_new()` to `hrb_request()` + * --- Jacob Smith, 2017-07-25 + * + * - Integrate with HDF5. + * - Rename from 'hrb_request()` to `H5FD_s3comms_hrb_init_request()`. + * - Remove `host` from input parameters. + * - Host, as with all other fields, must now be added through the + * add-field functions. + * - Add `version` (HTTP version string, e.g. "HTTP/1.1") to parameters. + * --- Jacob Smith 2017-09-20 + * + * - Update to use linked-list `hrb_node_t` headers in structure. + * --- Jacob Smith 2017-10-05 + * + *---------------------------------------------------------------------------- + */ +hrb_t * +H5FD_s3comms_hrb_init_request(const char *_verb, + const char *_resource, + const char *_http_version) +{ + hrb_t *request = NULL; + char *res = NULL; + size_t reslen = 0; + hrb_t *ret_value = NULL; + char *verb = NULL; + size_t verblen = 0; + char *vrsn = NULL; + size_t vrsnlen = 0; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); +#endif + + if (_resource == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "resource string cannot be null.\n"); + } + + /* populate valid NULLs with defaults + */ + if (_verb == NULL) + _verb = "GET"; + + if (_http_version == NULL) + _http_version = "HTTP/1.1"; + + /* malloc space for and prepare structure + */ + request = (hrb_t *)H5MM_malloc(sizeof(hrb_t)); + if (request == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, + "no space for request structure"); + } + request->magic = S3COMMS_HRB_MAGIC; + request->body = NULL; + request->body_len = 0; + request->first_header = NULL; + + + + /* malloc and copy strings for the structure + */ + if (_resource[0] == '/') { + reslen = HDstrlen(_resource) + 1; + res = (char *)H5MM_malloc(sizeof(char) * reslen); + if (res == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, + "no space for resource string"); + } + HDstrncpy(res, _resource, reslen); + } else { + int sprint_ret = 0; + reslen = HDstrlen(_resource) + 2; + res = (char *)H5MM_malloc(sizeof(char) * reslen); + if (res == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, + "no space for resource string"); + } + sprint_ret = HDsnprintf(res, reslen, "/%s", _resource); + if (sprint_ret <= 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "errro while appending resource string %s", _resource); + HDassert( (reslen - 1) == (size_t)sprint_ret ); + } /* start resource string with '/' */ + + verblen = HDstrlen(_verb) + 1; + verb = (char *)H5MM_malloc(sizeof(char) * verblen); + if (verb == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "no space for verb string"); + } + HDstrncpy(verb, _verb, verblen); + + vrsnlen = HDstrlen(_http_version) + 1; + vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen); + if (vrsn == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "no space for http-version string"); + } + HDstrncpy(vrsn, _http_version, vrsnlen); + + + + /* place new copies into structure + */ + request->resource = res; + request->verb = verb; + request->version = vrsn; + + ret_value = request; + +done: + + /* if there is an error, clean up after ourselves + */ + if (ret_value == NULL) { + if (request != NULL) H5MM_xfree(request); + if (vrsn != NULL) H5MM_xfree(vrsn); + if (verb != NULL) H5MM_xfree(verb); + if (res != NULL) H5MM_xfree(res); + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_hrb_init_request */ + + + +/**************************************************************************** + * S3R FUNCTIONS + ****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_s3r_close() + * + * Purpose: + * + * Close communications through given S3 Request Handle (`s3r_t`) + * and clean up associated resources. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - fails if handle is null or has invalid magic number + * + * + * Programmer: Jacob Smith + * 2017-08-31 + * + * Changes: + * + * - Remove all messiness related to the now-gone "setopt" utility + * as it no longer exists in the handle. + * - Return type to `void`. + * --- Jacob Smith 2017-09-01 + * + * - Incorporate into HDF environment. + * - Rename from `s3r_close()` to `H5FD_s3comms_s3r_close()`. + * --- Jacob Smith 2017-10-06 + * + * - Change separate host, resource, port info to `parsed_url_t` struct ptr. + * --- Jacob Smith 2017-11-01 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_s3r_close(s3r_t *handle) +{ + herr_t ret_value = SUCCEED; + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); +#endif + + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle cannot be null.\n"); + } + if (handle->magic != S3COMMS_S3R_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has invalid magic.\n"); + } + + curl_easy_cleanup(handle->curlhandle); + + H5MM_xfree(handle->secret_id); + H5MM_xfree(handle->region); + H5MM_xfree(handle->signing_key); + + HDassert( handle->httpverb != NULL ); + H5MM_xfree(handle->httpverb); + + if (FAIL == H5FD_s3comms_free_purl(handle->purl)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to release parsed url structure") + } + + H5MM_xfree(handle); + +#endif /* H5_HAVE_ROS3_VFD */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_s3r_close */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_s3r_get_filesize() + * + * Purpose: + * + * Retrieve the filesize of an open request handle. + * + * Wrapper "getter" to hide implementation details. + * + * + * Return: + * + * - SUCCESS: size of file, in bytes, if handle is valid. + * - FAILURE: 0, if handle is NULL or undefined. + * + * Programmer: Jacob Smith 2017-01-14 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +size_t +H5FD_s3comms_s3r_get_filesize(s3r_t *handle) { + + size_t ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#ifdef H5_HAVE_ROS3_VFD + if (handle != NULL) + ret_value = handle->filesize; +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_s3r_get_filesize */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_s3r_getsize() + * + * Purpose: + * + * Get the number of bytes of handle's target resource. + * + * Sets handle and curlhandle with to enact an HTTP HEAD request on file, + * and parses received headers to extract "Content-Length" from response + * headers, storing file size at `handle->filesize`. + * + * Critical step in opening (initiating) an `s3r_t` handle. + * + * Wraps `s3r_read()`. + * Sets curlhandle to write headers to a temporary buffer (using extant + * write callback) and provides no buffer for body. + * + * Upon exit, unsets HTTP HEAD settings from curl handle, returning to + * initial state. In event of error, curl handle state is undefined and is + * not to be trusted. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * + * Programmer: Jacob Smith + * 2017-08-23 + * + * Changes: + * + * - Update to revised `s3r_t` format and life cycle. + * --- Jacob Smith 2017-09-01 + * + * - Conditional change to static header buffer and structure. + * --- Jacob Smith 2017-09-05 + * + * - Incorporate into HDF environment. + * - Rename from `s3r_getsize()` to `H5FD_s3comms_s3r_getsize()`. + * --- Jacob Smith 2017-10-06 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_s3r_getsize(s3r_t *handle) +{ +#ifdef H5_HAVE_ROS3_VFD + unsigned long int content_length = 0; + CURL *curlh = NULL; + char *end = NULL; + char *headerresponse = NULL; + herr_t ret_value = SUCCEED; + struct s3r_datastruct sds = { + S3COMMS_CALLBACK_DATASTRUCT_MAGIC, + NULL, + 0 }; + char *start = NULL; +#else + herr_t ret_value = FAIL; +#endif /* H5_HAVE_ROS3_VFD */ + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); +#endif + + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle cannot be null.\n"); + } + if (handle->magic != S3COMMS_S3R_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has invalid magic.\n"); + } + if (handle->curlhandle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has bad (null) curlhandle.\n") + } + + /******************** + * PREPARE FOR HEAD * + ********************/ + + curlh = handle->curlhandle; + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_NOBODY, + 1L) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while setting CURL option (CURLOPT_NOBODY). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_HEADERDATA, + &sds) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while setting CURL option (CURLOPT_HEADERDATA). " + "(placeholder flags)"); + } + + HDassert( handle->httpverb == NULL ); + handle->httpverb = (char *)H5MM_malloc(sizeof(char) * 16); + if (handle->httpverb == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "unable to allocate space for S3 request HTTP verb"); + } + HDmemcpy(handle->httpverb, "HEAD", 5); + + headerresponse = (char *)H5MM_malloc(sizeof(char) * CURL_MAX_HTTP_HEADER); + if (headerresponse == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "unable to allocate space for curl header response"); + } + sds.data = headerresponse; + + /******************* + * PERFORM REQUEST * + *******************/ + + /* these parameters fetch the entire file, + * but, with a NULL destination and NOBODY and HEADERDATA supplied above, + * only http metadata will be sent by server and recorded by s3comms + */ + if (FAIL == + H5FD_s3comms_s3r_read(handle, 0, 0, NULL) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem in reading during getsize.\n"); + } + + if (sds.size > CURL_MAX_HTTP_HEADER) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "HTTP metadata buffer overrun\n"); + } else if (sds.size == 0) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "No HTTP metadata\n"); +#if S3COMMS_DEBUG + } else { + HDfprintf(stderr, "GETSIZE: OK\n"); +#endif + } + + + /****************** + * PARSE RESPONSE * + ******************/ + + start = strstr(headerresponse, + "\r\nContent-Length: "); + if (start == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not find \"Content-Length\" in response.\n"); + } + + /* move "start" to beginning of value in line; find end of line + */ + start = start + HDstrlen("\r\nContent-Length: "); + end = strstr(start, "\r\n"); + if (end == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not find end of content length line"); + } + + /* place null terminator at end of numbers + */ + *end = '\0'; + + content_length = strtoul((const char *)start, + NULL, + 0); + if (content_length == 0 || + content_length == ULONG_MAX || + errno == ERANGE) /* errno set by strtoul */ + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not convert found \"Content-Length\" response (\"%s\")", + start); /* range is null-terminated, remember */ + } + + handle->filesize = (size_t)content_length; + + /********************** + * UNDO HEAD SETTINGS * + **********************/ + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_NOBODY, + 0) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while setting CURL option (CURLOPT_NOBODY). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_HEADERDATA, + 0) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while setting CURL option (CURLOPT_HEADERDATA). " + "(placeholder flags)"); + } + +done: + H5MM_xfree(headerresponse); + sds.magic += 1; /* set to bad magic */ + +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_s3r_getsize */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_s3r_open() + * + * Purpose: + * + * Logically 'open' a file hosted on S3. + * + * - create new Request Handle + * - copy supplied url + * - copy authentication info if supplied + * - create CURL handle + * - fetch size of file + * - connect with server and execute HEAD request + * - return request handle ready for reads + * + * To use 'default' port to connect, `port` should be 0. + * + * To prevent AWS4 authentication, pass null pointer to `region`, `id`, + * and `signing_key`. + * + * Uses `H5FD_s3comms_parse_url()` to validate and parse url input. + * + * Return: + * + * - SUCCESS: Pointer to new request handle. + * - FAILURE: NULL + * - occurs if: + * - authentication strings are inconsistent + * - must _all_ be null, or have at least `region` and `id` + * - url is NULL (no filename) + * - unable to parse url (malformed?) + * - error while performing `getsize()` + * + * Programmer: Jacob Smith + * 2017-09-01 + * + * Changes: + * + * - Incorporate into HDF environment. + * - Rename from `s3r_open()` to `H5FD_s3comms_s3r_open()`. + * --- Jacob Smith 2017-10-06 + * + * - Remove port number from signature. + * - Name (`url`) must be complete url with http scheme and optional port + * number in string. + * - e.g., "http://bucket.aws.com:9000/myfile.dat?query=param" + * - Internal storage of host, resource, and port information moved into + * `parsed_url_t` struct pointer. + * --- Jacob Smith 2017-11-01 + * + *---------------------------------------------------------------------------- + */ +s3r_t * +H5FD_s3comms_s3r_open(const char *url, + const char *region, + const char *id, + const unsigned char *signing_key) +{ +#ifdef H5_HAVE_ROS3_VFD + size_t tmplen = 0; + CURL *curlh = NULL; + s3r_t *handle = NULL; + parsed_url_t *purl = NULL; +#endif + s3r_t *ret_value = NULL; + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); +#endif + + + + if (url == NULL || url[0] == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "url cannot be null.\n"); + } + + if (FAIL == H5FD_s3comms_parse_url(url, &purl)) { + /* probably a malformed url, but could be internal error */ + HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, + "unable to create parsed url structure"); + } + HDassert( purl != NULL ); /* if above passes, this must be true */ + HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); + + handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t)); + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, + "could not malloc space for handle.\n"); + } + + handle->magic = S3COMMS_S3R_MAGIC; + handle->purl = purl; + handle->filesize = 0; + handle->region = NULL; + handle->secret_id = NULL; + handle->signing_key = NULL; + handle->httpverb = NULL; + + /************************************* + * RECORD AUTHENTICATION INFORMATION * + *************************************/ + + if ((region != NULL && *region != '\0') || + (id != NULL && *id != '\0') || + (signing_key != NULL && *signing_key != '\0')) + { + /* if one exists, all three must exist + */ + if (region == NULL || region[0] == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "region cannot be null.\n"); + } + if (id == NULL || id[0] == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "secret id cannot be null.\n"); + } + if (signing_key == NULL || signing_key[0] == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "signing key cannot be null.\n"); + } + + /* copy strings + */ + tmplen = HDstrlen(region) + 1; + handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen); + if (handle->region == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "could not malloc space for handle region copy.\n"); + } + HDmemcpy(handle->region, region, tmplen); + + tmplen = HDstrlen(id) + 1; + handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen); + if (handle->secret_id == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "could not malloc space for handle ID copy.\n"); + } + HDmemcpy(handle->secret_id, id, tmplen); + + tmplen = SHA256_DIGEST_LENGTH; + handle->signing_key = + (unsigned char *)H5MM_malloc(sizeof(unsigned char) * tmplen); + if (handle->signing_key == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "could not malloc space for handle key copy.\n"); + } + HDmemcpy(handle->signing_key, signing_key, tmplen); + } /* if authentication information provided */ + + /************************ + * INITIATE CURL HANDLE * + ************************/ + + curlh = curl_easy_init(); + + if (curlh == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "problem creating curl easy handle!\n"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_HTTPGET, + 1L) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "error while setting CURL option (CURLOPT_HTTPGET). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_HTTP_VERSION, + CURL_HTTP_VERSION_1_1) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "error while setting CURL option (CURLOPT_HTTP_VERSION). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_FAILONERROR, + 1L) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "error while setting CURL option (CURLOPT_FAILONERROR). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_WRITEFUNCTION, + curlwritecallback) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "error while setting CURL option (CURLOPT_WRITEFUNCTION). " + "(placeholder flags)"); + } + + if ( CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_URL, + url) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "error while setting CURL option (CURLOPT_URL). " + "(placeholder flags)"); + } + +#if S3COMMS_CURL_VERBOSITY > 1 + /* CURL will print (to stdout) information for each operation + */ + curl_easy_setopt(curlh, CURLOPT_VERBOSE, 1L); +#endif + + handle->curlhandle = curlh; + + /******************* + * OPEN CONNECTION * + * * * * * * * * * * + * GET FILE SIZE * + *******************/ + + if (FAIL == + H5FD_s3comms_s3r_getsize(handle) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "problem in H5FD_s3comms_s3r_getsize.\n"); + } + + /********************* + * FINAL PREPARATION * + *********************/ + + HDassert( handle->httpverb != NULL ); + HDmemcpy(handle->httpverb, "GET", 4); + + ret_value = handle; +#endif /* H5_HAVE_ROS3_VFD */ + +done: + if (ret_value == NULL) { +#ifdef H5_HAVE_ROS3_VFD + if (curlh != NULL) { + curl_easy_cleanup(curlh); + } + if (FAIL == H5FD_s3comms_free_purl(purl)) { + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "unable to free parsed url structure") + } + if (handle != NULL) { + H5MM_xfree(handle->region); + H5MM_xfree(handle->secret_id); + H5MM_xfree(handle->signing_key); + if (handle->httpverb != NULL) { + H5MM_xfree(handle->httpverb); + } + H5MM_xfree(handle); + } +#endif /* H5_HAVE_ROS3_VFD */ + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_s3r_open */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_s3r_read() + * + * Purpose: + * + * Read file pointed to by request handle, writing specified + * `offset` .. `offset + len` bytes to buffer `dest`. + * + * If `len` is 0, reads entirety of file starting at `offset`. + * If `offset` and `len` are both 0, reads entire file. + * + * If `offset` or `offset+len` is greater than the file size, read is + * aborted and returns `FAIL`. + * + * Uses configured "curl easy handle" to perform request. + * + * In event of error, buffer should remain unaltered. + * + * If handle is set to authorize a request, creates a new (temporary) + * HTTP Request object (hrb_t) for generating requisite headers, + * which is then translated to a `curl slist` and set in the curl handle + * for the request. + * + * `dest` _may_ be NULL, but no body data will be recorded. + * + * - In general practice, NULL should never be passed in as `dest`. + * - NULL `dest` passed in by internal function `s3r_getsize()`, in + * conjunction with CURLOPT_NOBODY to preempt transmission of file data + * from server. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * + * Programmer: Jacob Smith + * 2017-08-22 + * + * Changes: + * + * - Revise structure to prevent unnecessary hrb_t element creation. + * - Rename tmprstr -> rangebytesstr to reflect purpose. + * - Insert needed `free()`s, particularly for `sds`. + * --- Jacob Smith 2017-08-23 + * + * - Revise heavily to accept buffer, range as parameters. + * - Utilize modified s3r_t format. + * --- Jacob Smith 2017-08-31 + * + * - Incorporate into HDF library. + * - Rename from `s3r_read()` to `H5FD_s3comms_s3r_read()`. + * - Return `herr_t` succeed/fail instead of S3code. + * - Update to use revised `hrb_t` and `hrb_node_t` structures. + * --- Jacob Smith 2017-10-06 + * + * - Update to use `parsed_url_t *purl` in handle. + * --- Jacob Smith 2017-11-01 + * + * - Better define behavior upon read past EOF + * --- Jacob Smith 2017-01-19 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_s3r_read(s3r_t *handle, + haddr_t offset, + size_t len, + void *dest) +{ +#ifdef H5_HAVE_ROS3_VFD + CURL *curlh = NULL; + CURLcode p_status = CURLE_OK; + struct curl_slist *curlheaders = NULL; + hrb_node_t *headers = NULL; + hrb_node_t *node = NULL; + struct tm *now = NULL; + char *rangebytesstr = NULL; + hrb_t *request = NULL; + int ret = 0; /* working variable to check */ + /* return value of HDsnprintf */ + struct s3r_datastruct *sds = NULL; + herr_t ret_value = SUCCEED; +#else + herr_t ret_value = FAIL; +#endif /* H5_HAVE_ROS3_VFD */ + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_s3r_read.\n"); +#endif + + /************************************** + * ABSOLUTELY NECESSARY SANITY-CHECKS * + **************************************/ + + if (handle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle cannot be null.\n"); + } + if (handle->magic != S3COMMS_S3R_MAGIC) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has invalid magic.\n"); + } + if (handle->curlhandle == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has bad (null) curlhandle.\n") + } + if (handle->purl == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle has bad (null) url.\n") + } + HDassert( handle->purl->magic == S3COMMS_PARSED_URL_MAGIC ); + if (offset > handle->filesize || (len + offset) > handle->filesize) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to read past EoF") + } + + curlh = handle->curlhandle; + + /********************* + * PREPARE WRITEDATA * + *********************/ + + if (dest != NULL) { + sds = (struct s3r_datastruct *)H5MM_malloc( + sizeof(struct s3r_datastruct)); + if (sds == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "could not malloc destination datastructure.\n"); + } + + sds->magic = S3COMMS_CALLBACK_DATASTRUCT_MAGIC; + sds->data = (char *)dest; + sds->size = 0; + if (CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_WRITEDATA, + sds) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, + "error while setting CURL option (CURLOPT_WRITEDATA). " + "(placeholder flags)"); + } + } + + /********************* + * FORMAT HTTP RANGE * + *********************/ + + if (len > 0) { + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ + S3COMMS_MAX_RANGE_STRING_SIZE ); + if (rangebytesstr == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "could not malloc range format string.\n"); + } + ret = HDsnprintf(rangebytesstr, + (S3COMMS_MAX_RANGE_STRING_SIZE), + "bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT, + offset, + offset + len - 1); + if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to format HTTP Range value"); + } else if (offset > 0) { + rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ + S3COMMS_MAX_RANGE_STRING_SIZE); + if (rangebytesstr == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "could not malloc range format string.\n"); + } + ret = HDsnprintf(rangebytesstr, + (S3COMMS_MAX_RANGE_STRING_SIZE), + "bytes="H5_PRINTF_HADDR_FMT"-", + offset); + if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to format HTTP Range value"); + } + + /******************* + * COMPILE REQUEST * + *******************/ + + if (handle->signing_key == NULL) { + /* Do not authenticate. + */ + if (rangebytesstr != NULL) { + /* Pass in range directly + */ + char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ + + bytesrange_ptr = strchr(rangebytesstr, '='); + HDassert( bytesrange_ptr != NULL ); + bytesrange_ptr++; /* move to first char past '=' */ + HDassert( *bytesrange_ptr != '\0' ); + + if (CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_RANGE, + bytesrange_ptr) ) + { + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, + "error while setting CURL option (CURLOPT_RANGE). "); + } + } + } else { + /* authenticate request + */ + char authorization[512]; + /* 512 := approximate max length... + * 67 + * + 8 + * + 64 + * + 128 + * + 20 + * + 128 + */ + char buffer1[512]; /* -> Canonical Request -> Signature */ + char buffer2[256]; /* -> String To Sign -> Credential */ + char iso8601now[ISO8601_SIZE]; + char signed_headers[48]; + /* should be large enough for nominal listing: + * "host;range;x-amz-content-sha256;x-amz-date" + * + '\0', with "range;" possibly absent + */ + + /* zero start of strings */ + authorization[0] = 0; + buffer1[0] = 0; + buffer2[0] = 0; + iso8601now[0] = 0; + signed_headers[0] = 0; + + /**** VERIFY INFORMATION EXISTS ****/ + + if (handle->region == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null region.\n"); + } + if (handle->secret_id == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null secret_id.\n"); + } + if (handle->signing_key == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null signing_key.\n"); + } + if (handle->httpverb == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null httpverb.\n"); + } + if (handle->purl->host == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null host.\n"); + } + if (handle->purl->path == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "handle must have non-null resource.\n"); + } + + /**** CREATE HTTP REQUEST STRUCTURE (hrb_t) ****/ + + request = H5FD_s3comms_hrb_init_request( + (const char *)handle->httpverb, + (const char *)handle->purl->path, + "HTTP/1.1"); + if (request == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not allocate hrb_t request.\n"); + } + HDassert( request->magic == S3COMMS_HRB_MAGIC ); + + now = gmnow(); + if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not format ISO8601 time.\n"); + } + + if (FAIL == + H5FD_s3comms_hrb_node_set( + &headers, + "x-amz-date", + (const char *)iso8601now) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to set x-amz-date header") + } + if (headers == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem building headers list. " + "(placeholder flags)\n"); + } + HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); + + if (FAIL == + H5FD_s3comms_hrb_node_set( + &headers, + "x-amz-content-sha256", + (const char *)EMPTY_SHA256) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to set x-amz-content-sha256 header") + } + if (headers == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem building headers list. " + "(placeholder flags)\n"); + } + HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); + + if (rangebytesstr != NULL) { + if (FAIL == + H5FD_s3comms_hrb_node_set( + &headers, + "Range", + (const char *)rangebytesstr) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to set range header") + } + if (headers == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem building headers list. " + "(placeholder flags)\n"); + } + HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); + } + + if (FAIL == + H5FD_s3comms_hrb_node_set( + &headers, + "Host", + (const char *)handle->purl->host) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to set host header") + } + if (headers == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem building headers list. " + "(placeholder flags)\n"); + } + HDassert( headers->magic == S3COMMS_HRB_NODE_MAGIC ); + + request->first_header = headers; + + /**** COMPUTE AUTHORIZATION ****/ + + if (FAIL == /* buffer1 -> canonical request */ + H5FD_s3comms_aws_canonical_request(buffer1, + signed_headers, + request) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "(placeholder flags)\n"); + } + if ( FAIL == /* buffer2->string-to-sign */ + H5FD_s3comms_tostringtosign(buffer2, + buffer1, + iso8601now, + handle->region) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "(placeholder flags)\n"); + } + if (FAIL == /* buffer1 -> signature */ + H5FD_s3comms_HMAC_SHA256(handle->signing_key, + SHA256_DIGEST_LENGTH, + buffer2, + HDstrlen(buffer2), + buffer1) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "(placeholder flags)\n"); + } + + iso8601now[8] = 0; /* trim to yyyyMMDD */ + ret = S3COMMS_FORMAT_CREDENTIAL(buffer2, + handle->secret_id, + iso8601now, + handle->region, + "s3"); + if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to format aws4 credential string"); + + ret = HDsnprintf(authorization, + 512, + "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", + buffer2, + signed_headers, + buffer1); + if (ret == 0 || ret >= 512) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to format aws4 authorization string"); + + /* append authorization header to http request buffer + */ + if (FAIL == + H5FD_s3comms_hrb_node_set( + &headers, + "Authorization", + (const char *)authorization) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to set Authorization header") + } + if (headers == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem building headers list. " + "(placeholder flags)\n"); + } + + /* update hrb's "first header" pointer + */ + request->first_header = headers; + + /**** SET CURLHANDLE HTTP HEADERS FROM GENERATED DATA ****/ + + node = request->first_header; + while (node != NULL) { + HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC ); + curlheaders = curl_slist_append(curlheaders, + (const char *)node->cat); + if (curlheaders == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not append header to curl slist. " + "(placeholder flags)\n"); + } + node = node->next; + } + + /* sanity-check + */ + if (curlheaders == NULL) { + /* above loop was probably never run */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "curlheaders was never populated.\n"); + } + + /* finally, set http headers in curl handle + */ + if (CURLE_OK != + curl_easy_setopt(curlh, + CURLOPT_HTTPHEADER, + curlheaders) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "error while setting CURL option " + "(CURLOPT_HTTPHEADER). (placeholder flags)"); + } + + } /* if should authenticate (info provided) */ + + /******************* + * PERFORM REQUEST * + *******************/ + +#if S3COMMS_CURL_VERBOSITY > 0 + /* In event of error, print detailed information to stderr + * This is not the default behavior. + */ + { + long int httpcode = 0; + char curlerrbuf[CURL_ERROR_SIZE]; + curlerrbuf[0] = '\0'; + + if (CURLE_OK != + curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem setting error buffer") + } + + p_status = curl_easy_perform(curlh); + + if (p_status != CURLE_OK) { + if (CURLE_OK != + curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem getting response code") + } + HDfprintf(stderr, "CURL ERROR CODE: %d\nHTTP CODE: %d\n", + p_status, httpcode); + HDfprintf(stderr, "%s\n", curl_easy_strerror(p_status)); + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, + "problem while performing request.\n"); + } + if (CURLE_OK != + curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL) ) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem unsetting error buffer") + } + } /* verbose error reporting */ +#else + p_status = curl_easy_perform(curlh); + + if (p_status != CURLE_OK) { + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, + "curl cannot perform request\n") + } +#endif + +#if S3COMMS_DEBUG + if (dest != NULL) { + HDfprintf(stderr, "len: %d\n", (int)len); + HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); + if (sds == NULL) { + HDfprintf(stderr, "sds is NULL!\n"); + } else { + HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); + HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); + if (len > sds->size) { + HDfprintf(stderr, "buffer overwrite\n"); + } + } + } else { + HDfprintf(stderr, "performed on entire file\n"); + } +#endif + +done: + /* clean any malloc'd resources + */ + if (curlheaders != NULL) { + curl_slist_free_all(curlheaders); + curlheaders = NULL; + } + if (rangebytesstr != NULL) { + H5MM_xfree(rangebytesstr); + rangebytesstr = NULL; + } + if (sds != NULL) { + H5MM_xfree(sds); + sds = NULL; + } + if (request != NULL) { + while (headers != NULL) + if (FAIL == + H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) + { + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot release header node") + } + HDassert( NULL == headers ); + if (FAIL == H5FD_s3comms_hrb_destroy(&request)) { + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot release header request structure") + } + HDassert( NULL == request ); + } + + if (curlh != NULL) { + /* clear any Range */ + if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot unset CURLOPT_RANGE") + + /* clear headers */ + if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot unset CURLOPT_HTTPHEADER") + } + +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_s3r_read */ + + + +/**************************************************************************** + * MISCELLANEOUS FUNCTIONS + ****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * Function: gmnow() + * + * Purpose: + * + * Get the output of `time.h`'s `gmtime()` call while minimizing setup + * clutter where important. + * + * Return: + * + * Pointer to resulting `struct tm`,as created by gmtime(time_t * T). + * + * Programmer: Jacob Smith + * 2017-07-12 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +struct tm * +gmnow(void) +{ + time_t now; + time_t *now_ptr = &now; + struct tm *ret_value = NULL; + + /* Doctor assert, checks against error in time() */ + if ( (time_t)(-1) != time(now_ptr) ) + ret_value = gmtime(now_ptr); + + HDassert( ret_value != NULL ); + + return ret_value; + +} /* gmnow */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_aws_canonical_request() + * + * Purpose: + * + * Compose AWS "Canonical Request" (and signed headers string) + * as defined in the REST API documentation. + * + * Both destination strings are null-terminated. + * + * Destination string arguments must be provided with adequate space. + * + * Canonical Request format: + * + * "\n" + * "\n" + * "\n" + * "\n" (`lowercase(name)`":"`trim(value)`) + * "\n" + * ... (headers sorted by name) + * "\n" + * "\n" + * "\n" (`lowercase(header 1 name)`";"`header 2 name`;...) + * ("e3b0c4429...", e.g.) + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - writes canonical request to respective `...dest` strings + * - FAILURE: `FAIL` + * - one or more input argument was NULL + * - internal error + * + * Programmer: Jacob Smith + * 2017-10-04 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, + char *signed_headers_dest, + hrb_t *http_request) +{ + hrb_node_t *node = NULL; + const char *query_params = ""; /* unused at present */ + herr_t ret_value = SUCCEED; + int ret = 0; /* return value of HDsnprintf */ + size_t len = 0; /* working string length variable */ + char tmpstr[256]; + + /* "query params" refers to the optional element in the URL, e.g. + * http://bucket.aws.com/myfile.txt?max-keys=2&prefix=J + * ^-----------------^ + * + * Not handled/implemented as of 2017-10-xx. + * Element introduced as empty placeholder and reminder. + * Further research to be done if this is ever relevant for the + * VFD use-cases. + */ + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); +#endif + + if (http_request == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "hrb object cannot be null.\n"); + } + HDassert( http_request->magic == S3COMMS_HRB_MAGIC ); + + if (canonical_request_dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "canonical request destination cannot be null.\n"); + } + + if (signed_headers_dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "signed headers destination cannot be null.\n"); + } + + /* HTTP verb, resource path, and query string lines + */ + len = (HDstrlen(http_request->verb) + + HDstrlen(http_request->resource) + + HDstrlen(query_params) + + 3 ); + ret = HDsnprintf(canonical_request_dest, + len + 1, + "%s\n%s\n%s\n", + http_request->verb, + http_request->resource, + query_params); + if (ret == 0 || (size_t)ret > len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to compose canonical request first line"); + + /* write in canonical headers, building signed headers concurrently + */ + node = http_request->first_header; /* assumed at first sorted */ + while (node != NULL) { + size_t join_len = 0; /* string len of joined header-value */ + + HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC ); + + len = HDstrlen(node->lowername); + join_len = HDstrlen(node->value) + len + 2; /* +2 <- ":\n" */ + ret = HDsnprintf(tmpstr, + join_len + 1, /* +1 for null terminator */ + "%s:%s\n", + node->lowername, + node->value); + if (ret == 0 || (size_t)ret > join_len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to concatenate HTTP header %s:%s", + node->lowername, + node->value); + strcat(canonical_request_dest, tmpstr); + + len += 1; /* semicolon */ + ret = HDsnprintf(tmpstr, + len + 1, + "%s;", + node->lowername); + if (ret == 0 || (size_t)ret > len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to append signed header %s", + node->lowername); + strcat(signed_headers_dest, tmpstr); + + node = node->next; + } + + /* remove tailing ';' from signed headers sequence + */ + signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0'; + + /* append signed headers and payload hash + * NOTE: at present, no HTTP body is handled, per the nature of + * requests/range-gets + */ + strcat(canonical_request_dest, "\n"); + strcat(canonical_request_dest, signed_headers_dest); + strcat(canonical_request_dest, "\n"); + strcat(canonical_request_dest, EMPTY_SHA256); + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_aws_canonical_request */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_bytes_to_hex() + * + * Purpose: + * + * Produce human-readable hex string [0-9A-F] from sequence of bytes. + * + * For each byte (char), writes two-character hexadecimal representation. + * + * No null-terminator appended. + * + * Assumes `dest` is allocated to enough size (msg_len * 2). + * + * Fails if either `dest` or `msg` are null. + * + * `msg_len` message length of 0 has no effect. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - hex string written to `dest` (not null-terminated) + * - FAILURE: `FAIL` + * - `dest == NULL` + * - `msg == NULL` + * + * Programmer: Jacob Smith + * 2017-07-12 + * + * Changes: + * + * - Integrate into HDF. + * - Rename from hex() to H5FD_s3comms_bytes_to_hex. + * - Change return type from `void` to `herr_t`. + * --- Jacob Smtih 2017-09-14 + * + * - Add bool parameter `lowercase` to configure upper/lowercase output + * of a-f hex characters. + * --- Jacob Smith 2017-09-19 + * + * - Change bool type to `hbool_t` + * --- Jacob Smtih 2017-10-11 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_bytes_to_hex(char *dest, + const unsigned char *msg, + size_t msg_len, + hbool_t lowercase) +{ + size_t i = 0; + herr_t ret_value = SUCCEED; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); +#endif + + if (dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "hex destination cannot be null.\n") + } + if (msg == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "bytes sequence cannot be null.\n") + } + + for (i = 0; i < msg_len; i++) { + int chars_written = + HDsnprintf(&(dest[i * 2]), + 3, /* 'X', 'X', '\n' */ + (lowercase == TRUE) ? "%02x" + : "%02X", + msg[i]); + if (chars_written != 2) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem while writing hex chars for %c", + msg[i]); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_bytes_to_hex */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_free_purl() + * + * Purpose: + * + * Release resources from a parsed_url_t pointer. + * + * If pointer is null, nothing happens. + * + * Return: + * + * `SUCCEED` (never fails) + * + * Programmer: Jacob Smith + * 2017-11-01 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_free_purl(parsed_url_t *purl) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + +#if S3COMMS_DEBUG + HDprintf("called H5FD_s3comms_free_purl.\n"); +#endif + + if (purl != NULL) { + HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); + if (purl->scheme != NULL) H5MM_xfree(purl->scheme); + if (purl->host != NULL) H5MM_xfree(purl->host); + if (purl->port != NULL) H5MM_xfree(purl->port); + if (purl->path != NULL) H5MM_xfree(purl->path); + if (purl->query != NULL) H5MM_xfree(purl->query); + purl->magic += 1ul; + H5MM_xfree(purl); + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5FD_s3comms_free_purl */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_HMAC_SHA256() + * + * Purpose: + * + * Generate Hash-based Message Authentication Checksum using the SHA-256 + * hashing algorithm. + * + * Given a key, message, and respective lengths (to accommodate null + * characters in either), generate _hex string_ of authentication checksum + * and write to `dest`. + * + * `dest` must be at least `SHA256_DIGEST_LENGTH * 2` characters in size. + * Not enforceable by this function. + * `dest` will _not_ be null-terminated by this function. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - hex string written to `dest` (not null-terminated) + * - FAILURE: `FAIL` + * - `dest == NULL` + * - error while generating hex string output + * + * Programmer: Jacob Smith + * 2017-07-?? + * + * Changes: + * + * - Integrate with HDF5. + * - Rename from `HMAC_SHA256` to `H5FD_s3comms_HMAC_SHA256`. + * - Rename output parameter from `md` to `dest`. + * - Return `herr_t` type instead of `void`. + * - Call `H5FD_s3comms_bytes_to_hex` to generate hex cleartext for output. + * --- Jacob Smith 2017-09-19 + * + * - Use static char array instead of malloc'ing `md` + * --- Jacob Smith 2017-10-10 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_HMAC_SHA256(const unsigned char *key, + size_t key_len, + const char *msg, + size_t msg_len, + char *dest) +{ +#ifdef H5_HAVE_ROS3_VFD + unsigned char md[SHA256_DIGEST_LENGTH]; + unsigned int md_len = SHA256_DIGEST_LENGTH; + herr_t ret_value = SUCCEED; +#else + herr_t ret_value = FAIL; +#endif /* H5_HAVE_ROS3_VFD */ + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); +#endif + + if (dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "destination cannot be null."); + } + + HMAC(EVP_sha256(), + key, + (int)key_len, + (const unsigned char *)msg, + msg_len, + md, + &md_len); + + if (FAIL == + H5FD_s3comms_bytes_to_hex(dest, + (const unsigned char *)md, + (size_t)md_len, + true)) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not convert to hex string."); + } + +#endif /* H5_HAVE_ROS3_VFD */ + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_HMAC_SHA256 */ + + +/*----------------------------------------------------------------------------- + * + * Function: H5FD__s3comms_load_aws_creds_from_file() + * + * Purpose: + * + * Extract AWS configuration information from a target file. + * + * Given a file and a profile name, e.g. "ros3_vfd_test", attempt to locate + * that region in the file. If not found, returns in error and output + * pointers are not modified. + * + * If the profile label is found, attempts to locate and parse configuration + * data, stopping at the first line where: + * + reached end of file + * + line does not start with a recognized setting name + * + * Following AWS documentation, looks for any of: + * + aws_access_key_id + * + aws_secret_access_key + * + region + * + * To be valid, the setting must begin the line with one of the keywords, + * followed immediately by an equals sign '=', and have some data before + * newline at end of line. + * + `spam=eggs` would be INVALID because name is unrecognized + * + `region = us-east-2` would be INVALID because of spaces + * + `region=` would be INVALID because no data. + * + * Upon successful parsing of a setting line, will store the result in the + * corresponding output pointer. If the output pointer is NULL, will skip + * any matching setting line while parsing -- useful to prevent overwrite + * when reading from multiple files. + * + * Return: + * + * + SUCCESS: `SUCCEED` + * + no error. settings may or may not have been loaded. + * + FAILURE: `FAIL` + * + internal error occurred. + * + -1 :: unable to format profile label + * + -2 :: profile name/label not found in file + * + -3 :: some other error + * + * Programmer: Jacob Smith + * 2018-02-27 + * + * Changes: None + * + *----------------------------------------------------------------------------- + */ +static herr_t +H5FD__s3comms_load_aws_creds_from_file( + FILE *file, + const char *profile_name, + char *key_id, + char *access_key, + char *aws_region) +{ + char profile_line[32]; + char buffer[128]; + const char *setting_names[] = { + "region", + "aws_access_key_id", + "aws_secret_access_key", + }; + char * const setting_pointers[] = { + aws_region, + key_id, + access_key, + }; + unsigned setting_count = 3; + herr_t ret_value = SUCCEED; + unsigned buffer_i = 0; + unsigned setting_i = 0; + int found_setting = 0; + char *line_buffer = &(buffer[0]); + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called load_aws_creds_from_file.\n"); +#endif + + /* format target line for start of profile */ + if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to format profile label") + + /* look for start of profile */ + do { + /* clear buffer */ + for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; + + line_buffer = fgets(line_buffer, 128, file); + if (line_buffer == NULL) /* reached end of file */ + goto done; + } while (strncmp(line_buffer, profile_line, HDstrlen(profile_line))); + + /* extract credentials from lines */ + do { + size_t setting_name_len = 0; + const char *setting_name = NULL; + char line_prefix[128]; + + /* clear buffer */ + for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; + + /* collect a line from file */ + line_buffer = fgets(line_buffer, 128, file); + if (line_buffer == NULL) + goto done; /* end of file */ + + /* loop over names to see if line looks like assignment */ + for (setting_i = 0; setting_i < setting_count; setting_i++) { + setting_name = setting_names[setting_i]; + setting_name_len = HDstrlen(setting_name); + if (128 < HDsnprintf( + line_prefix, + setting_name_len+2, + "%s=", + setting_name)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to format line prefix") + + /* found a matching name? */ + if (!strncmp(line_buffer, line_prefix, setting_name_len + 1)) { + found_setting = 1; + + /* skip NULL destination buffer */ + if (setting_pointers[setting_i] == NULL) + break; + + /* advance to end fo name in string */ + do { + line_buffer++; + } while (*line_buffer != 0 && *line_buffer != '='); + + if (*line_buffer == 0 || *(line_buffer+1) == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "incomplete assignment in file") + line_buffer++; /* was pointing at '='; advance */ + + /* copy line buffer into out pointer */ + strcpy(setting_pointers[setting_i], (const char *)line_buffer); + + /* "trim" tailing whitespace by replacing with null terminator*/ + buffer_i = 0; + while (!isspace(setting_pointers[setting_i][buffer_i])) + buffer_i++; + setting_pointers[setting_i][buffer_i] = '\0'; + + break; /* have read setting; don't compare with others */ + } + } + } while (found_setting); + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD__s3comms_load_aws_creds_from_file */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_load_aws_profile() + * + * Purpose : + * + * Read aws profile elements from standard location on system and store + * settings in memory. + * + * Looks for both `~/.aws/config` and `~/.aws/credentials`, the standard + * files for AWS tools. If a file exists (can be opened), looks for the + * given profile name and reads the settings into the relevant buffer. + * + * Any setting duplicated in both files will be set to that from + * `credentials`. + * + * Settings are stored in the supplied buffers as null-terminated strings. + * + * Return: + * + * + SUCCESS: `SUCCEED` (0) + * + no error occurred and all settings were populated + * + FAILURE: `FAIL` (-1) + * + internal error occurred + * + unable to locate profile + * + region, key id, and secret key were not all found and set + * + * Programmer: Jacob Smith + * 2018-02-27 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_load_aws_profile(const char *profile_name, + char *key_id_out, + char *secret_access_key_out, + char *aws_region_out) +{ + herr_t ret_value = SUCCEED; + FILE *credfile = NULL; + char awspath[117]; + char filepath[128]; + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); +#endif + + /* TODO: Windows and other path gotchas */ + if (117 < HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME"))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to format home-aws path") + if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "credentials")) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to format credentials path") + + credfile = fopen(filepath, "r"); + if (credfile != NULL) { + if (FAIL == H5FD__s3comms_load_aws_creds_from_file( + credfile, + profile_name, + key_id_out, + secret_access_key_out, + aws_region_out)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to load from aws credentials") + if (EOF == fclose(credfile)) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, + "unable to close credentials file") + credfile = NULL; + } + + if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "config")) + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to format config path") + credfile = fopen(filepath, "r"); + if (credfile != NULL) { + if (FAIL == H5FD__s3comms_load_aws_creds_from_file( + credfile, + profile_name, + (*key_id_out == 0) ? key_id_out : NULL, + (*secret_access_key_out == 0) ? secret_access_key_out : NULL, + (*aws_region_out == 0) ? aws_region_out : NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to load from aws config") + if (EOF == fclose(credfile)) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, + "unable to close config file") + credfile = NULL; + } + + /* fail if not all three settings were loaded */ + if (*key_id_out == 0 || + *secret_access_key_out == 0 || + *aws_region_out == 0) + { + ret_value = FAIL; + } + +done: + if (credfile != NULL) { + if (EOF == fclose(credfile)) + HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, + "problem error-closing aws configuration file") + } + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_load_aws_profile */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_nlowercase() + * + * Purpose: + * + * From string starting at `s`, write `len` characters to `dest`, + * converting all to lowercase. + * + * Behavior is undefined if `s` is NULL or `len` overruns the allocated + * space of either `s` or `dest`. + * + * Provided as convenience. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - upon completion, `dest` is populated + * - FAILURE: `FAIL` + * - `dest == NULL` + * + * Programmer: Jacob Smith + * 2017-09-18 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_nlowercase(char *dest, + const char *s, + size_t len) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); +#endif + + if (dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "destination cannot be null.\n"); + } + + if (len > 0) { + HDmemcpy(dest, s, len); + do { + len--; + dest[len] = (char)tolower( (int)dest[len] ); + } while (len > 0); + } + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_nlowercase */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_parse_url() + * + * Purpose: + * + * Parse URL-like string and stuff URL components into + * `parsed_url` structure, if possible. + * + * Expects null-terminated string of format: + * SCHEME "://" HOST [":" PORT ] ["/" [ PATH ] ] ["?" QUERY] + * where SCHEME :: "[a-zA-Z/.-]+" + * PORT :: "[0-9]" + * + * Stores resulting structure in argument pointer `purl`, if successful, + * creating and populating new `parsed_url_t` structure pointer. + * Empty or absent elements are NULL in new purl structure. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - `purl` pointer is populated + * - FAILURE: `FAIL` + * - unable to parse + * - `purl` is unaltered (probably NULL) + * + * Programmer: Jacob Smith + * 2017-10-30 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_parse_url(const char *str, + parsed_url_t **_purl) +{ + parsed_url_t *purl = NULL; /* pointer to new structure */ + const char *tmpstr = NULL; /* working pointer in string */ + const char *curstr = str; /* "start" pointer in string */ + long int len = 0; /* substring length */ + long int urllen = 0; /* length of passed-in url string */ + unsigned int i = 0; + herr_t ret_value = FAIL; + + + + FUNC_ENTER_NOAPI_NOINIT; + +#if S3COMMS_DEBUG + HDprintf("called H5FD_s3comms_parse_url.\n"); +#endif + + if (str == NULL || *str == '\0') { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid url string"); + } + + urllen = (long int)HDstrlen(str); + + purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t)); + if (purl == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for parsed_url_t"); + } + purl->magic = S3COMMS_PARSED_URL_MAGIC; + purl->scheme = NULL; + purl->host = NULL; + purl->port = NULL; + purl->path = NULL; + purl->query = NULL; + + /*************** + * READ SCHEME * + ***************/ + + tmpstr = strchr(curstr, ':'); + if (tmpstr == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid SCHEME construction: probably not URL"); + } + len = tmpstr - curstr; + HDassert( (0 <= len) && (len < urllen) ); + + /* check for restrictions + */ + for (i = 0; i < len; i++) { + /* scheme = [a-zA-Z+-.]+ (terminated by ":") */ + if (!isalpha(curstr[i]) && + '+' != curstr[i] && + '-' != curstr[i] && + '.' != curstr[i]) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid SCHEME construction"); + } + } + /* copy lowercased scheme to structure + */ + purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); + if (purl->scheme == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for SCHEME"); + } + (void)HDstrncpy(purl->scheme, curstr, (size_t)len); + purl->scheme[len] = '\0'; + for ( i = 0; i < len; i++ ) { + purl->scheme[i] = (char)tolower(purl->scheme[i]); + } + + /* Skip "://" */ + tmpstr += 3; + curstr = tmpstr; + + /************* + * READ HOST * + *************/ + + if (*curstr == '[') { + /* IPv6 */ + while (']' != *tmpstr) { + if (tmpstr == 0) { /* end of string reached! */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "reached end of URL: incomplete IPv6 HOST"); + } + tmpstr++; + } + tmpstr++; + } else { + while (0 != *tmpstr) { + if (':' == *tmpstr || + '/' == *tmpstr || + '?' == *tmpstr) + { + break; + } + tmpstr++; + } + } /* if IPv4 or IPv6 */ + len = tmpstr - curstr; + if (len == 0) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "HOST substring cannot be empty"); + } else if (len > urllen) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem with length of HOST substring"); + } + + /* copy host + */ + purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); + if (purl->host == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for HOST"); + } + (void)HDstrncpy(purl->host, curstr, (size_t)len); + purl->host[len] = 0; + + /************* + * READ PORT * + *************/ + + if (':' == *tmpstr) { + tmpstr += 1; /* advance past ':' */ + curstr = tmpstr; + while ((0 != *tmpstr) && ('/' != *tmpstr) && ('?' != *tmpstr)) { + tmpstr++; + } + len = tmpstr - curstr; + if (len == 0) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "PORT element cannot be empty"); + } else if (len > urllen) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem with length of PORT substring"); + } + for (i = 0; i < len; i ++) { + if (!isdigit(curstr[i])) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "PORT is not a decimal string"); + } + } + + /* copy port + */ + purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); + if (purl->port == NULL) { /* cannot malloc */ + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for PORT"); + } + (void)HDstrncpy(purl->port, curstr, (size_t)len); + purl->port[len] = 0; + } /* if PORT element */ + + /************* + * READ PATH * + *************/ + + if ('/' == *tmpstr) { + /* advance past '/' */ + tmpstr += 1; + curstr = tmpstr; + + /* seek end of PATH + */ + while ((0 != *tmpstr) && ('?' != *tmpstr)) { + tmpstr++; + } + len = tmpstr - curstr; + if (len > urllen) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem with length of PATH substring"); + } + if (len > 0) { + purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); + if (purl->path == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for PATH"); + } /* cannot malloc path pointer */ + (void)HDstrncpy(purl->path, curstr, (size_t)len); + purl->path[len] = 0; + } + } /* if PATH element */ + + /************** + * READ QUERY * + **************/ + + if ('?' == *tmpstr) { + tmpstr += 1; + curstr = tmpstr; + while (0 != *tmpstr) { + tmpstr++; + } + len = tmpstr - curstr; + if (len == 0) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "QUERY cannot be empty"); + } else if (len > urllen) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem with length of QUERY substring"); + } + purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); + if (purl->query == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for QUERY"); + } /* cannot malloc path pointer */ + (void)HDstrncpy(purl->query, curstr, (size_t)len); + purl->query[len] = 0; + } /* if QUERY exists */ + + + + *_purl = purl; + ret_value = SUCCEED; + +done: + if (ret_value == FAIL) { + H5FD_s3comms_free_purl(purl); + } + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_parse_url */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_percent_encode_char() + * + * Purpose: + * + * "Percent-encode" utf-8 character `c`, e.g., + * '$' -> "%24" + * '¢' -> "%C2%A2" + * + * `c` cannot be null. + * + * Does not (currently) accept multi-byte characters... + * limit to (?) u+00ff, well below upper bound for two-byte utf-8 encoding + * (u+0080..u+07ff). + * + * Writes output to `repr`. + * `repr` cannot be null. + * Assumes adequate space i `repr`... + * >>> char[4] or [7] for most characters, + * >>> [13] as theoretical maximum. + * + * Representation `repr` is null-terminated. + * + * Stores length of representation (without null terminator) at pointer + * `repr_len`. + * + * Return : SUCCEED/FAIL + * + * - SUCCESS: `SUCCEED` + * - percent-encoded representation written to `repr` + * - 'repr' is null-terminated + * - FAILURE: `FAIL` + * - `c` or `repr` was NULL + * + * Programmer: Jacob Smith + * + * Changes: + * + * - Integrate into HDF. + * - Rename from `hexutf8` to `H5FD_s3comms_percent_encode_char`. + * --- Jacob Smith 2017-09-15 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_percent_encode_char(char *repr, + const unsigned char c, + size_t *repr_len) +{ + unsigned int acc = 0; + unsigned int i = 0; + unsigned int k = 0; + unsigned int stack[4] = {0, 0, 0, 0}; + unsigned int stack_size = 0; + int chars_written = 0; + herr_t ret_value = SUCCEED; +#if S3COMMS_DEBUG + unsigned char s[2] = {c, 0}; + unsigned char hex[3] = {0, 0, 0}; +#endif + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); +#endif + + if (repr == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.\n") + } + +#if S3COMMS_DEBUG + H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, FALSE); + HDfprintf(stdout, " CHAR: \'%s\'\n", s); + HDfprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); +#endif + + if (c <= (unsigned char)0x7f) { + /* character represented in a single "byte" + * and single percent-code + */ +#if S3COMMS_DEBUG + HDfprintf(stdout, " SINGLE-BYTE\n"); +#endif + *repr_len = 3; + chars_written = HDsnprintf(repr, 4, "%%%02X", c); + if (chars_written != 3) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot write char %c", + c); + } else { + /* multi-byte, multi-percent representation + */ +#if S3COMMS_DEBUG + HDfprintf(stdout, " MULTI-BYTE\n"); +#endif + stack_size = 0; + k = (unsigned int)c; + *repr_len = 0; + do { + /* push number onto stack in six-bit slices + */ + acc = k; + acc >>= 6; /* cull least */ + acc <<= 6; /* six bits */ + stack[stack_size++] = k - acc; /* max six-bit number */ + k = acc >> 6; + } while (k > 0); + + /* now have "stack" of two to four six-bit numbers + * to be put into UTF-8 byte fields + */ + +#if S3COMMS_DEBUG + HDfprintf(stdout, " STACK:\n {\n"); + for (i = 0; i < stack_size; i++) { + H5FD_s3comms_bytes_to_hex((char *)hex, + (unsigned char *)(&stack[i]), + 1, + FALSE); + hex[2] = 0; + HDfprintf(stdout, " %s,\n", hex); + } + HDfprintf(stdout, " }\n"); +#endif + + /**************** + * leading byte * + ****************/ + + /* prepend 11[1[1]]0 to first byte */ + /* 110xxxxx, 1110xxxx, or 11110xxx */ + acc = 0xC0; /* 2^7 + 2^6 -> 11000000 */ + acc += (stack_size > 2) ? 0x20 : 0; + acc += (stack_size > 3) ? 0x10 : 0; + stack_size -= 1; + chars_written = HDsnprintf(repr, 4, "%%%02X", acc + stack[stack_size]); + if (chars_written != 3) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot write char %c", + c); + *repr_len += 3; + + /************************ + * continuation byte(s) * + ************************/ + + /* 10xxxxxx */ + for (i = 0; i < stack_size; i++) { + chars_written = HDsnprintf(&repr[i*3 + 3], + 4, + "%%%02X", + 128 + stack[stack_size - 1 - i]); + if (chars_written != 3) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "cannot write char %c", + c); + *repr_len += 3; + } + } + *(repr + *repr_len) = '\0'; + +done: + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_percent_encode_char */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_signing_key() + * + * Purpose: + * + * Create AWS4 "Signing Key" from secret key, AWS region, and timestamp. + * + * Sequentially runs HMAC_SHA256 on strings in specified order, + * generating re-usable checksum (according to documentation, valid for + * 7 days from time given). + * + * `secret` is `access key id` for targeted service/bucket/resource. + * + * `iso8601now` must conform to format, yyyyMMDD'T'hhmmss'Z' + * e.g. "19690720T201740Z". + * + * `region` should be one of AWS service region names, e.g. "us-east-1". + * + * Hard-coded "service" algorithm requirement to "s3". + * + * Inputs must be null-terminated strings. + * + * Writes to `md` the raw byte data, length of `SHA256_DIGEST_LENGTH`. + * Programmer must ensure that `md` is appropriately allocated. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - raw byte data of signing key written to `md` + * - FAILURE: `FAIL` + * - if any input arguments was NULL + * + * Programmer: Jacob Smith + * 2017-07-13 + * + * Changes: + * + * - Integrate into HDF5. + * - Return herr_t type. + * --- Jacob Smith 2017-09-18 + * + * - NULL check and fail of input parameters. + * --- Jacob Smith 2017-10-10 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_signing_key(unsigned char *md, + const char *secret, + const char *region, + const char *iso8601now) +{ +#ifdef H5_HAVE_ROS3_VFD + char *AWS4_secret = NULL; + size_t AWS4_secret_len = 0; + unsigned char datekey[SHA256_DIGEST_LENGTH]; + unsigned char dateregionkey[SHA256_DIGEST_LENGTH]; + unsigned char dateregionservicekey[SHA256_DIGEST_LENGTH]; + int ret = 0; /* return value of HDsnprintf */ + herr_t ret_value = SUCCEED; +#else + herr_t ret_value = SUCCEED; +#endif /* H5_HAVE_ROS3_VFD */ + + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n"); +#endif + + if (md == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Destination `md` cannot be NULL.\n") + } + if (secret == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "`secret` cannot be NULL.\n") + } + if (region == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "`region` cannot be NULL.\n") + } + if (iso8601now == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "`iso8601now` cannot be NULL.\n") + } + + AWS4_secret_len = 4 + HDstrlen(secret) + 1; + AWS4_secret = (char*)H5MM_malloc(sizeof(char *) * AWS4_secret_len); + if (AWS4_secret == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Could not allocate space.\n") + } + + /* prepend "AWS4" to start of the secret key + */ + ret = HDsnprintf(AWS4_secret, AWS4_secret_len,"%s%s", "AWS4", secret); + if ((size_t)ret != (AWS4_secret_len - 1)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem writing AWS4+secret `%s`", + secret); + + /* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest + * we know digest length, so ignore via NULL + */ + HMAC(EVP_sha256(), + (const unsigned char *)AWS4_secret, + (int)HDstrlen(AWS4_secret), + (const unsigned char*)iso8601now, + 8, /* 8 --> length of 8 --> "yyyyMMDD" */ + datekey, + NULL); + HMAC(EVP_sha256(), + (const unsigned char *)datekey, + SHA256_DIGEST_LENGTH, + (const unsigned char *)region, + HDstrlen(region), + dateregionkey, + NULL); + HMAC(EVP_sha256(), + (const unsigned char *)dateregionkey, + SHA256_DIGEST_LENGTH, + (const unsigned char *)"s3", + 2, + dateregionservicekey, + NULL); + HMAC(EVP_sha256(), + (const unsigned char *)dateregionservicekey, + SHA256_DIGEST_LENGTH, + (const unsigned char *)"aws4_request", + 12, + md, + NULL); + +done: + H5MM_xfree(AWS4_secret); + +#endif /* H5_HAVE_ROS3_VFD */ + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD_s3comms_signing_key */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_tostringtosign() + * + * Purpose: + * + * Get AWS "String to Sign" from Canonical Request, timestamp, + * and AWS "region". + * + * Common between single request and "chunked upload", + * conforms to: + * "AWS4-HMAC-SHA256\n" + + * + "\n" + // yyyyMMDD'T'hhmmss'Z' + * + "/" + + "/s3/aws4-request\n" + + * hex(SHA256()) + * + * Inputs `creq` (canonical request string), `now` (ISO8601 format), + * and `region` (s3 region designator string) must all be + * null-terminated strings. + * + * Result is written to `dest` with null-terminator. + * It is left to programmer to ensure `dest` has adequate space. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - "string to sign" written to `dest` and null-terminated + * - FAILURE: `FAIL` + * - if any of the inputs are NULL + * - if an error is encountered while computing checksum + * + * Programmer: Jacob Smith + * 2017-07-?? + * + * Changes: + * + * - Integrate with HDF5. + * - Rename from `tostringtosign` to `H5FD_s3comms_tostringtosign`. + * - Return `herr_t` instead of characters written. + * - Use HDF-friendly bytes-to-hex function (`H5FD_s3comms_bytes_to_hex`) + * instead of general-purpose, deprecated `hex()`. + * - Adjust casts to openssl's `SHA256`. + * - Input strings are now `const`. + * --- Jacob Smith 2017-09-19 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_tostringtosign(char *dest, + const char *req, + const char *now, + const char *region) +{ +#ifdef H5_HAVE_ROS3_VFD + unsigned char checksum[SHA256_DIGEST_LENGTH * 2 + 1]; + size_t d = 0; + char day[9]; + char hexsum[SHA256_DIGEST_LENGTH * 2 + 1]; + size_t i = 0; + int ret = 0; /* HDsnprintf return value */ + herr_t ret_value = SUCCEED; + char tmp[128]; +#else + herr_t ret_value = FAIL; +#endif /* H5_HAVE_ROS3_VFD */ + + + FUNC_ENTER_NOAPI_NOINIT + +#ifdef H5_HAVE_ROS3_VFD + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); +#endif + + if (dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "destination buffer cannot be null.\n") + } + if (req == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "canonical request cannot be null.\n") + } + if (now == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Timestring cannot be NULL.\n") + } + if (region == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "Region cannot be NULL.\n") + } + + + + for (i = 0; i < 128; i++) { + tmp[i] = '\0'; + } + for (i = 0; i < SHA256_DIGEST_LENGTH * 2 + 1; i++) { + checksum[i] = '\0'; + hexsum[i] = '\0'; + } + HDstrncpy(day, now, 8); + day[8] = '\0'; + ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); + if (ret <= 0 || ret >= 127) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "problem adding day and region to string") + + + + HDmemcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); + d = 17; + + HDmemcpy((dest+d), now, HDstrlen(now)); + d += HDstrlen(now); + dest[d++] = '\n'; + + HDmemcpy((dest + d), tmp, HDstrlen(tmp)); + d += HDstrlen(tmp); + dest[d++] = '\n'; + + SHA256((const unsigned char *)req, + HDstrlen(req), + checksum); + + if (FAIL == + H5FD_s3comms_bytes_to_hex(hexsum, + (const unsigned char *)checksum, + SHA256_DIGEST_LENGTH, + true)) + { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "could not create hex string"); + } + + for (i = 0; i < SHA256_DIGEST_LENGTH * 2; i++) { + dest[d++] = hexsum[i]; + } + + dest[d] = '\0'; + +#endif /* H5_HAVE_ROS3_VFD */ + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5ros3_tostringtosign */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_trim() + * + * Purpose: + * + * Remove all whitespace characters from start and end of a string `s` + * of length `s_len`, writing trimmed string copy to `dest`. + * Stores number of characters remaining at `n_written`. + * + * Destination for trimmed copy `dest` cannot be null. + * `dest` must have adequate space allocated for trimmed copy. + * If inadequate space, behavior is undefined, possibly resulting + * in segfault or overwrite of other data. + * + * If `s` is NULL or all whitespace, `dest` is untouched and `n_written` + * is set to 0. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - `dest == NULL` + * + * Programmer: Jacob Smith + * 2017-09-18 + * + * Changes: + * + * - Rename from `trim()` to `H5FD_s3comms_trim()`. + * - Incorporate into HDF5. + * - Returns `herr_t` type. + * --- Jacob Smith 2017-??-?? + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_trim(char *dest, + char *s, + size_t s_len, + size_t *n_written) +{ + herr_t ret_value = SUCCEED; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "called H5FD_s3comms_trim.\n"); +#endif + + if (dest == NULL) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "destination cannot be null.") + } + if (s == NULL) { + s_len = 0; + } + + + + if (s_len > 0) { + /* Find first non-whitespace character from start; + * reduce total length per character. + */ + while ((s_len > 0) && + isspace((unsigned char)s[0]) && s_len > 0) + { + s++; + s_len--; + } + + /* Find first non-whitespace character from tail; + * reduce length per-character. + * If length is 0 already, there is no non-whitespace character. + */ + if (s_len > 0) { + do { + s_len--; + } while( isspace((unsigned char)s[s_len]) ); + s_len++; + + /* write output into dest + */ + HDmemcpy(dest, s, s_len); + } + } + + *n_written = s_len; + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_trim */ + + +/*---------------------------------------------------------------------------- + * + * Function: H5FD_s3comms_uriencode() + * + * Purpose: + * + * URIencode (percent-encode) every byte except "[a-zA-Z0-9]-._~". + * + * For each character in source string `_s` from `s[0]` to `s[s_len-1]`, + * writes to `dest` either the raw character or its percent-encoded + * equivalent. + * + * See `H5FD_s3comms_bytes_to_hex` for information on percent-encoding. + * + * Space (' ') character encoded as "%20" (not "+") + * + * Forward-slash ('/') encoded as "%2F" only when `encode_slash == true`. + * + * Records number of characters written at `n_written`. + * + * Assumes that `dest` has been allocated with enough space. + * + * Neither `dest` nor `s` can be NULL. + * + * `s_len == 0` will have no effect. + * + * Return: + * + * - SUCCESS: `SUCCEED` + * - FAILURE: `FAIL` + * - source strings `s` or destination `dest` are NULL + * - error while attempting to percent-encode a character + * + * Programmer: Jacob Smith + * 2017-07-?? + * + * Changes: + * + * - Integrate to HDF environment. + * - Rename from `uriencode` to `H5FD_s3comms_uriencode`. + * - Change return from characters written to herr_t; + * move to i/o parameter `n_written`. + * - No longer append null-terminator to string; + * programmer may append or not as appropriate upon return. + * --- Jacob Smith 2017-09-15 + * + *---------------------------------------------------------------------------- + */ +herr_t +H5FD_s3comms_uriencode(char *dest, + const char *s, + size_t s_len, + hbool_t encode_slash, + size_t *n_written) +{ + char c = 0; + size_t dest_off = 0; + char hex_buffer[13]; + size_t hex_off = 0; + size_t hex_len = 0; + herr_t ret_value = SUCCEED; + size_t s_off = 0; + + + + FUNC_ENTER_NOAPI_NOINIT + +#if S3COMMS_DEBUG + HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n"); +#endif + + if (s == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "source string cannot be NULL"); + if (dest == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "destination cannot be NULL"); + + /* Write characters to destination, converting to percent-encoded + * "hex-utf-8" strings if necessary. + * e.g., '$' -> "%24" + */ + for (s_off = 0; s_off < s_len; s_off++) { + c = s[s_off]; + if (isalnum(c) || + c == '.' || + c == '-' || + c == '_' || + c == '~' || + (c == '/' && encode_slash == FALSE)) + { + dest[dest_off++] = c; + } else { + hex_off = 0; + if (FAIL == + H5FD_s3comms_percent_encode_char(hex_buffer, + (const unsigned char)c, + &hex_len)) + { + hex_buffer[0] = c; + hex_buffer[1] = 0; + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "unable to percent-encode character \'%s\' " + "at %d in \"%s\"", hex_buffer, (int)s_off, s); + } + + for (hex_off = 0; hex_off < hex_len; hex_off++) { + dest[dest_off++] = hex_buffer[hex_off]; + } + } + } + + if (dest_off < s_len) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "buffer overflow"); + + *n_written = dest_off; + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_s3comms_uriencode */ + + diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h new file mode 100644 index 0000000..0524c46 --- /dev/null +++ b/src/H5FDs3comms.h @@ -0,0 +1,634 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/***************************************************************************** + * + * This is the header for the S3 Communications module + * + * ***NOT A FILE DRIVER*** + * + * Purpose: + * + * - Provide structures and functions related to communicating with + * Amazon S3 (Simple Storage Service). + * - Abstract away the REST API (HTTP, + * networked communications) behind a series of uniform function calls. + * - Handle AWS4 authentication, if appropriate. + * - Fail predictably in event of errors. + * - Eventually, support more S3 operations, such as creating, writing to, + * and removing Objects remotely. + * + * translates: + * `read(some_file, bytes_offset, bytes_length, &dest_buffer);` + * to: + * ``` + * GET myfile HTTP/1.1 + * Host: somewhere.me + * Range: bytes=4096-5115 + * ``` + * and places received bytes from HTTP response... + * ``` + * HTTP/1.1 206 Partial-Content + * Content-Range: 4096-5115/63239 + * + * + * ``` + * ...in destination buffer. + * + * TODO: put documentation in a consistent place and point to it from here. + * + * Programmer: Jacob Smith + * 2017-11-30 + * + *****************************************************************************/ + +#include +#include +#include +#include +#include + +#ifdef H5_HAVE_ROS3_VFD +#include +#include +#include +#include +#endif /* ifdef H5_HAVE_ROS3_VFD */ + +/***************** + * PUBLIC MACROS * + *****************/ + +/* hexadecimal string of pre-computed sha256 checksum of the empty string + * hex(sha256sum("")) + */ +#define EMPTY_SHA256 \ +"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + +/* string length (plus null terminator) + * example ISO8601-format string: "20170713T145903Z" (YYYYmmdd'T'HHMMSS'_') + */ +#define ISO8601_SIZE 17 + +/* string length (plus null terminator) + * example RFC7231-format string: "Fri, 30 Jun 2017 20:41:55 GMT" + */ +#define RFC7231_SIZE 30 + +/*--------------------------------------------------------------------------- + * + * Macro: ISO8601NOW() + * + * Purpose: + * + * write "YYYYmmdd'T'HHMMSS'Z'" (less single-quotes) to dest + * e.g., "20170630T204155Z" + * + * wrapper for strftime() + * + * It is left to the programmer to check return value of + * ISO8601NOW (should equal ISO8601_SIZE - 1). + * + * Programmer: Jacob Smith + * 2017-07-?? + * + *--------------------------------------------------------------------------- + */ +#define ISO8601NOW(dest, now_gm) \ +strftime((dest), ISO8601_SIZE, "%Y%m%dT%H%M%SZ", (now_gm)) + +/*--------------------------------------------------------------------------- + * + * Macro: RFC7231NOW() + * + * Purpose: + * + * write "Day, dd Mmm YYYY HH:MM:SS GMT" to dest + * e.g., "Fri, 30 Jun 2017 20:41:55 GMT" + * + * wrapper for strftime() + * + * It is left to the programmer to check return value of + * RFC7231NOW (should equal RFC7231_SIZE - 1). + * + * Programmer: Jacob Smith + * 2017-07-?? + * + *--------------------------------------------------------------------------- + */ +#define RFC7231NOW(dest, now_gm) \ +strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm)) + + +/* Reasonable maximum length of a credential string. + * Provided for error-checking S3COMMS_FORMAT_CREDENTIAL (below). + * 17 <- "////aws4_request\0" + * 2 < "s3" (service) + * 8 <- "YYYYmmdd" (date) + * 128 <- (access_id) + * 155 :: sum + */ +#define S3COMMS_MAX_CREDENTIAL_SIZE 155 + + +/*--------------------------------------------------------------------------- + * + * Macro: H5FD_S3COMMS_FORMAT_CREDENTIAL() + * + * Purpose: + * + * Format "S3 Credential" string from inputs, for AWS4. + * + * Wrapper for HDsnprintf(). + * + * _HAS NO ERROR-CHECKING FACILITIES_ + * It is left to programmer to ensure that return value confers success. + * e.g., + * ``` + * assert( S3COMMS_MAX_CREDENTIAL_SIZE >= + * S3COMMS_FORMAT_CREDENTIAL(...) ); + * ``` + * + * "////aws4_request" + * assuming that `dest` has adequate space. + * + * ALL inputs must be null-terminated strings. + * + * `access` should be the user's access key ID. + * `date` must be of format "YYYYmmdd". + * `region` should be relevant AWS region, i.e. "us-east-1". + * `service` should be "s3". + * + * Programmer: Jacob Smith + * 2017-09-19 + * + * Changes: None. + * + *--------------------------------------------------------------------------- + */ +#define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \ +HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, \ + "%s/%s/%s/%s/aws4_request", \ + (access), (iso8601_date), (region), (service)) + +/********************* + * PUBLIC STRUCTURES * + *********************/ + + +/*---------------------------------------------------------------------------- + * + * Structure: hrb_node_t + * + * HTTP Header Field Node + * + * + * + * Maintain a ordered (linked) list of HTTP Header fields. + * + * Provides efficient access and manipulation of a logical sequence of + * HTTP header fields, of particular use when composing an + * "S3 Canonical Request" for authentication. + * + * - The creation of a Canoncial Request involves: + * - convert field names to lower case + * - sort by this lower-case name + * - convert ": " name-value separator in HTTP string to ":" + * - get sorted lowercase names without field or separator + * + * As HTTP headers allow headers in any order (excepting the case of multiple + * headers with the same name), the list ordering can be optimized for Canonical + * Request creation, suggesting alphabtical order. For more expedient insertion + * and removal of elements in the list, linked list seems preferable to a + * dynamically-expanding array. The usually-smaller number of entries (5 or + * fewer) makes performance overhead of traversing the list trivial. + * + * The above requirements of creating at Canonical Request suggests a reasonable + * trade-off of speed for space with the option to compute elements as needed + * or to have the various elements prepared and stored in the structure + * (e.g. name, value, lowername, concatenated name:value) + * The structure currently is implemented to pre-compute. + * + * At all times, the "first" node of the list should be the least, + * alphabetically. For all nodes, the `next` node should be either NULL or + * of greater alphabetical value. + * + * Each node contains its own header field information, plus a pointer to the + * next node. + * + * It is not allowed to have multiple nodes with the same _lowercase_ `name`s + * in the same list + * (i.e., name is case-insensitive for access and modification.) + * + * All data (`name`, `value`, `lowername`, and `cat`) are null-terminated + * strings allocated specifically for their node. + * + * + * + * `magic` (unsigned long) + * + * "unique" idenfier number for the structure type + * + * `name` (char *) + * + * Case-meaningful name of the HTTP field. + * Given case is how it is supplied to networking code. + * e.g., "Range" + * + * `lowername` (char *) + * + * Lowercase copy of name. + * e.g., "range" + * + * `value` (char *) + * + * Case-meaningful value of HTTP field. + * e.g., "bytes=0-9" + * + * `cat` (char *) + * + * Concatenated, null-terminated string of HTTP header line, + * as the field would appear in an HTTP request. + * e.g., "Range: bytes=0-9" + * + * `next` (hrb_node_t *) + * + * Pointers to next node in the list, or NULL sentinel as end of list. + * Next node must have a greater `lowername` as determined by strcmp(). + * + * + * + * Programmer: Jacob Smith + * 2017-09-22 + * + * Changes: + * + * - Change from twin doubly-linked lists to singly-linked list. + * --- Jake Smith 2017-01-17 + * + *---------------------------------------------------------------------------- + */ +typedef struct hrb_node_t { + unsigned long magic; + char *name; + char *value; + char *cat; + char *lowername; + struct hrb_node_t *next; +} hrb_node_t; +#define S3COMMS_HRB_NODE_MAGIC 0x7F5757UL + + +/*---------------------------------------------------------------------------- + * + * Structure: hrb_t + * + * HTTP Request Buffer structure + * + * + * + * Logically represent an HTTP request + * + * GET /myplace/myfile.h5 HTTP/1.1 + * Host: over.rainbow.oz + * Date: Fri, 01 Dec 2017 12:35:04 CST + * + * + * + * ...with fast, efficient access to and modification of primary and field + * elements. + * + * Structure for building HTTP requests while hiding much of the string + * processing required "under the hood." + * + * Information about the request target -- the first line -- and the body text, + * if any, are managed directly with this structure. All header fields, e.g., + * "Host" and "Date" above, are created with a linked list of `hrb_node_t` and + * included in the request by a pointer to the head of the list. + * + * + * + * `magic` (unsigned long) + * + * "Magic" number confirming that this is an hrb_t structure and + * what operations are valid for it. + * + * Must be S3COMMS_HRB_MAGIC to be valid. + * + * `body` (char *) : + * + * Pointer to start of HTTP body. + * + * Can be NULL, in which case it is treated as the empty string, "". + * + * `body_len` (size_t) : + * + * Number of bytes (characters) in `body`. 0 if empty or NULL `body`. + * + * `first_header` (hrb_node_t *) : + * + * Pointer to first SORTED header node, if any. + * It is left to the programmer to ensure that this node and associated + * list is destroyed when done. + * + * `resource` (char *) : + * + * Pointer to resource URL string, e.g., "/folder/page.xhtml". + * + * `verb` (char *) : + * + * Pointer to HTTP verb string, e.g., "GET". + * + * `version` (char *) : + * + * Pointer to HTTP version string, e.g., "HTTP/1.1". + * + * + * + * Programmer: Jacob Smith + * + *---------------------------------------------------------------------------- + */ +typedef struct { + unsigned long magic; + char *body; + size_t body_len; + hrb_node_t *first_header; + char *resource; + char *verb; + char *version; +} hrb_t; +#define S3COMMS_HRB_MAGIC 0x6DCC84UL + + +/*---------------------------------------------------------------------------- + * + * Structure: parsed_url_t + * + * + * Represent a URL with easily-accessed pointers to logical elements within. + * These elements (components) are stored as null-terminated strings (or just + * NULLs). These components should be allocated for the structure, making the + * data as safe as possible from modification. If a component is NULL, it is + * either implicit in or absent from the URL. + * + * "http://mybucket.s3.amazonaws.com:8080/somefile.h5?param=value&arg=value" + * ^--^ ^-----------------------^ ^--^ ^---------^ ^-------------------^ + * Scheme Host Port Resource Query/-ies + * + * + * + * `magic` (unsigned long) + * + * Structure identification and validation identifier. + * Identifies as `parsed_url_t` type. + * + * `scheme` (char *) + * + * String representing which protocol is to be expected. + * _Must_ be present. + * "http", "https", "ftp", e.g. + * + * `host` (char *) + * + * String of host, either domain name, IPv4, or IPv6 format. + * _Must_ be present. + * "over.rainbow.oz", "192.168.0.1", "[0000:0000:0000:0001]" + * + * `port` (char *) + * + * String representation of specified port. Must resolve to a valid unsigned + * integer. + * "9000", "80" + * + * `path` (char *) + * + * Path to resource on host. If not specified, assumes root "/". + * "lollipop_guild.wav", "characters/witches/white.dat" + * + * `query` (char *) + * + * Single string of all query parameters in url (if any). + * "arg1=value1&arg2=value2" + * + * + * + * Programmer: Jacob Smith + * + *---------------------------------------------------------------------------- + */ +typedef struct { + unsigned long magic; + char *scheme; /* required */ + char *host; /* required */ + char *port; + char *path; + char *query; +} parsed_url_t; +#define S3COMMS_PARSED_URL_MAGIC 0x21D0DFUL + + +/*---------------------------------------------------------------------------- + * + * Structure: s3r_t + * + * + * + * S3 request structure "handle". + * + * Holds persistent information for Amazon S3 requests. + * + * Instantiated through `H5FD_s3comms_s3r_open()`, copies data into self. + * + * Intended to be re-used for operations on a remote object. + * + * Cleaned up through `H5FD_s3comms_s3r_close()`. + * + * _DO NOT_ share handle between threads: curl easy handle `curlhandle` has + * undefined behavior if called to perform in multiple threads. + * + * + * + * `magic` (unsigned long) + * + * "magic" number identifying this structure as unique type. + * MUST equal `S3R_MAGIC` to be valid. + * + * `curlhandle` (CURL) + * + * Pointer to the curl_easy handle generated for the request. + * + * `httpverb` (char *) + * + * Pointer to NULL-terminated string. HTTP verb, + * e.g. "GET", "HEAD", "PUT", etc. + * + * Default is NULL, resulting in a "GET" request. + * + * `purl` (parsed_url_t *) + * + * Pointer to structure holding the elements of URL for file open. + * + * e.g., "http://bucket.aws.com:8080/myfile.dat?q1=v1&q2=v2" + * parsed into... + * { scheme: "http" + * host: "bucket.aws.com" + * port: "8080" + * path: "myfile.dat" + * query: "q1=v1&q2=v2" + * } + * + * Cannot be NULL. + * + * `region` (char *) + * + * Pointer to NULL-terminated string, specifying S3 "region", + * e.g., "us-east-1". + * + * Required to authenticate. + * + * `secret_id` (char *) + * + * Pointer to NULL-terminated string for "secret" access id to S3 resource. + * + * Requred to authenticate. + * + * `signing_key` (unsigned char *) + * + * Pointer to `SHA256_DIGEST_LENGTH`-long string for "re-usable" signing + * key, generated via + * `HMAC-SHA256(HMAC-SHA256(HMAC-SHA256(HMAC-SHA256("AWS4", + * ""), ""), "aws4_request")` + * which may be re-used for several (up to seven (7)) days from creation? + * Computed once upon file open. + * + * Requred to authenticate. + * + * + * + * Programmer: Jacob Smith + * + *---------------------------------------------------------------------------- + */ +typedef struct { + unsigned long magic; +#ifdef H5_HAVE_ROS3_VFD + CURL *curlhandle; + size_t filesize; + char *httpverb; + parsed_url_t *purl; + char *region; + char *secret_id; + unsigned char *signing_key; +#endif /* ifdef H5_HAVE_ROS3_VFD */ +} s3r_t; +#define S3COMMS_S3R_MAGIC 0x44d8d79 + +/******************************************* + * DECLARATION OF HTTP FIELD LIST ROUTINES * + *******************************************/ + +herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, + const char *name, + const char *value); + +/*********************************************** + * DECLARATION OF HTTP REQUEST BUFFER ROUTINES * + ***********************************************/ + +herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf); + +hrb_t * H5FD_s3comms_hrb_init_request(const char *verb, + const char *resource, + const char *host); + +/************************************* + * DECLARATION OF S3REQUEST ROUTINES * + *************************************/ + +H5_DLL herr_t H5FD_s3comms_s3r_close(s3r_t *handle); + +H5_DLL size_t H5FD_s3comms_s3r_get_filesize(s3r_t *handle); + +H5_DLL s3r_t * H5FD_s3comms_s3r_open(const char url[], + const char region[], + const char id[], + const unsigned char signing_key[]); + +H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, + haddr_t offset, + size_t len, + void *dest); + +/********************************* + * DECLARATION OF OTHER ROUTINES * + *********************************/ + +H5_DLL struct tm * gmnow(void); + +herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, + char *signed_headers_dest, + hrb_t *http_request); + +H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest, + const unsigned char *msg, + size_t msg_len, + hbool_t lowercase); + +herr_t H5FD_s3comms_free_purl(parsed_url_t *purl); + +herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, + size_t key_len, + const char *msg, + size_t msg_len, + char *dest); + +herr_t H5FD_s3comms_load_aws_profile(const char *name, + char *key_id_out, + char *secret_access_key_out, + char *aws_region_out); + +herr_t H5FD_s3comms_nlowercase(char *dest, + const char *s, + size_t len); + +herr_t H5FD_s3comms_parse_url(const char *str, + parsed_url_t **purl); + +herr_t H5FD_s3comms_percent_encode_char(char *repr, + const unsigned char c, + size_t *repr_len); + +H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, + const char *secret, + const char *region, + const char *iso8601now); + +herr_t H5FD_s3comms_tostringtosign(char *dest, + const char *req_str, + const char *now, + const char *region); + +H5_DLL herr_t H5FD_s3comms_trim(char *dest, + char *s, + size_t s_len, + size_t *n_written); + +H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, + const char *s, + size_t s_len, + hbool_t encode_slash, + size_t *n_written); + + diff --git a/src/Makefile.am b/src/Makefile.am index 0eaae1a..f737d5d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -63,8 +63,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAint.c H5FAstat.c H5FAtest.c \ H5FD.c H5FDcore.c \ - H5FDfamily.c H5FDint.c H5FDlog.c \ - H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ + H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c H5FDs3comms.c \ + H5FDmulti.c H5FDros3.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ @@ -138,8 +138,8 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5ESpublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h \ - H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ - H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \ + H5FDfamily.h H5FDhdfs.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ + H5FDmulti.h H5FDros3.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ diff --git a/src/hdf5.h b/src/hdf5.h index c12037f..2201e9e 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -40,16 +40,18 @@ #include "H5Zpublic.h" /* Data filters */ /* Predefined file drivers */ -#include "H5FDcore.h" /* Files stored entirely in memory */ -#include "H5FDdirect.h" /* Linux direct I/O */ -#include "H5FDfamily.h" /* File families */ +#include "H5FDcore.h" /* Files stored entirely in memory */ +#include "H5FDdirect.h" /* Linux direct I/O */ +#include "H5FDfamily.h" /* File families */ +#include "H5FDhdfs.h" /* Hadoop HDFS */ #include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5FDmulti.h" /* Usage-partitioned file family */ -#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5FDmulti.h" /* Usage-partitioned file family */ +#include "H5FDros3.h" /* R/O S3 "file" I/O */ +#include "H5FDsec2.h" /* POSIX unbuffered file I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Win32 I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif /* Virtual object layer (VOL) connectors */ diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index f856ebc..baa99ea 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -79,6 +79,8 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @MPE@ Direct VFD: @DIRECT_VFD@ + (Read-Only) S3 VFD: @ROS3_VFD@ + (Read-Only) HDFS VFD: @HAVE_LIBHDFS@ dmalloc: @HAVE_DMALLOC@ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ API tracing: @TRACE_API@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8333c78..cbd1901 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -267,6 +267,9 @@ set (H5_TESTS enc_dec_plist_cross_platform getname vfd + ros3 + s3comms + hdfs ntypes dangle dtransform diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 2767bdc..7f661a5 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -18,6 +18,7 @@ # included from CMakeTEsts.cmake set (VFD_LIST + hdfs sec2 stdio core diff --git a/test/Makefile.am b/test/Makefile.am index 1b82aa4..dbee9c2 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -59,11 +59,11 @@ TEST_PROG= testhdf5 \ stab gheap evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ - objcopy links unlink twriteorder big mtime fillval mount \ - flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ - enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \ - reserved cross_read freespace mf vds file_image unregister \ - cache_logging cork swmr vol + objcopy links unlink twriteorder big mtime fillval mount flush1 \ + flush2 app_ref enum set_extent ttsafe enc_dec_plist \ + enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ + dangle dtransform reserved cross_read freespace mf vds file_image \ + unregister cache_logging cork swmr vol # List programs to be built when testing here. # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. @@ -145,7 +145,7 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c cache_image_SOURCES=cache_image.c genall5.c -VFD_LIST = sec2 stdio core core_paged split multi family +VFD_LIST = hdfs sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif @@ -201,8 +201,8 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ unlink_chunked.h5 btree2.h5 btree2_tmp.h5 objcopy_src.h5 objcopy_dst.h5 \ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 farray_tmp.h5 \ - earray.h5 earray_tmp.h5 efc[0-5].h5 log_vfd_out.log \ - new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ + earray.h5 earray_tmp.h5 efc[0-5].h5 log_vfd_out.log log_ros3_out.log \ + log_s3comms_out.log new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \ vds_virt.h5 vds_dapl.h5 vds_src_[0-1].h5 \ diff --git a/test/hdfs.c b/test/hdfs.c new file mode 100644 index 0000000..11b9918 --- /dev/null +++ b/test/hdfs.c @@ -0,0 +1,1836 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only HDFS Virtual File Driver (VFD) * + * Copyright (c) 2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: + * + * Verify behavior for Read-Only HDFS VFD. + * + * Demonstrates basic use cases and fapl interaction. + * + * Programmer: Jacob Smith + * 2018-04-23 + */ + +#include "h5test.h" /* testing utilities */ +#include "H5FDhdfs.h" /* this file driver's utilities */ + + +#define HDFS_TEST_DEBUG 0 +#define HDFS_TEST_MAX_BUF_SIZE 256 +#if 0 +#define S3_TEST_MAX_URL_SIZE 256 +#endif /* s3comms relic */ + +/***************************************************************************** + * + * FILE-LOCAL TESTING MACROS + * + * Purpose: + * + * 1) Upon test failure, goto-jump to single-location teardown in test + * function. E.g., `error:` (consistency with HDF corpus) or + * `failed:` (reflects purpose). + * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. + * 2) Increase clarity and reduce overhead found with `TEST_ERROR`. + * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" + * requires reading of entire line to know whether this if/call is + * part of the test setup, test operation, or a test unto itself. + * 3) Provide testing macros with optional user-supplied failure message; + * if not supplied (NULL), generate comparison output in the spirit of + * test-driven development. E.g., "expected 5 but was -3" + * User messages clarify test's purpose in code, encouraging description + * without relying on comments. + * 4) Configurable expected-actual order in generated comparison strings. + * Some prefer `VERIFY(expected, actual)`, others + * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch + * to satifsy both parties, assuming one paradigm per test file. + * (One could #undef and redefine the flag through the file as desired, + * but _why_.) + * + * Provided as courtesy, per consideration for inclusion in the library + * proper. + * + * Macros: + * + * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order + * FAIL_IF() - check condition + * FAIL_UNLESS() - check _not_ condition + * JSVERIFY() - long-int equality check; prints reason/comparison + * JSVERIFY_NOT() - long-int inequality check; prints + * JSVERIFY_STR() - string equality check; prints + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * ifdef flag: JSVERIFY_EXP_ACT + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_EXP_ACT 1L + + +/*---------------------------------------------------------------------------- + * + * Macro: JSFAILED_AT() + * + * Purpose: + * + * Preface a test failure by printing "*FAILED*" and location to stdout + * Similar to `H5_FAILED(); AT();` from h5test.h + * + * *FAILED* at somefile.c:12 in function_name()... + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSFAILED_AT() { \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_IF() + * + * Purpose: + * + * Make tests more accessible and less cluttered than + * `if (thing == otherthing()) TEST_ERROR` + * paradigm. + * + * The following lines are roughly equivalent: + * + * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) + * `FAIL_IF(myfunc() < 0)` + * + * Prints a generic "FAILED AT" line to stdout and jumps to `error`, + * similar to `TEST_ERROR` in h5test.h + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_IF(condition) \ +if (condition) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_UNLESS() + * + * Purpose: + * + * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", + * e.g., "a != b". + * + * Opposite of FAIL_IF; fails if the given condition is _not_ true. + * + * `FAIL_IF( 5 != my_op() )` + * is equivalent to + * `FAIL_UNLESS( 5 == my_op() )` + * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. + * (see JSVERIFY) + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#if 0 /* UNUSED */ +#define FAIL_UNLESS(condition) \ +if (!(condition)) { \ + JSFAILED_AT() \ + goto error; \ +} +#endif /* UNUSED */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_LONG() + * + * Purpose: + * + * Print an failure message for long-int arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:488 in somefunc()... + * forest must be made of trees. + * + * or + * + * *FAILED* at myfile.c:488 in somefunc()... + * ! Expected 425 + * ! Actual 3 + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_LONG(expected, actual, reason) { \ + JSFAILED_AT() \ + if (reason!= NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ + (long)(expected), (long)(actual)); \ + } \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_STR() + * + * Purpose: + * + * Print an failure message for string arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:421 in myfunc()... + * Blue and Red strings don't match! + * + * or + * + * *FAILED* at myfile.c:421 in myfunc()... + * !!! Expected: + * this is my expected + * string + * !!! Actual: + * not what I expected at all + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_STR(expected, actual, reason) { \ + JSFAILED_AT() \ + if ((reason) != NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ + (expected), (actual)); \ + } \ +} + + + +#ifdef JSVERIFY_EXP_ACT + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY() + * + * Purpose: + * + * Verify that two long integers are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(expected, actual, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_NOT() + * + * Purpose: + * + * Verify that two long integers are _not_ equal. + * If equal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(expected, actual, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_STR() + * + * Purpose: + * + * Verify that two strings are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(expected, actual, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + + +#else +/* JSVERIFY_EXP_ACT not defined + * + * Repeats macros above, but with actual/expected parameters reversed. + */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY() + * See: JSVERIFY documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(actual, expected, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_NOT() + * See: JSVERIFY_NOT documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(actual, expected, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_STR() + * See: JSVERIFY_STR documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(actual, expected, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + +#endif /* ifdef/else JSVERIFY_EXP_ACT */ + +/******************************** + * OTHER MACROS AND DEFINITIONS * + ********************************/ + +/* copied from src/hdfs.c + */ +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#define MAX_HDFS_NAMENODE_NAME 128 + +/******************************* + * FILE-LOCAL GLOBAL VARIABLES * + *******************************/ +static const char filename_missing[] = "/tmp/missing.txt"; +static const char filename_bard[] = "/tmp/t8.shakespeare.txt"; +static const char filename_raven[] = "/tmp/Poe_Raven.txt"; +static const char filename_example_h5[] = "/tmp/t.h5"; +static H5FD_hdfs_fapl_t default_fa = { + 1, /* fa version */ + "localhost", /* namenode name */ + 0, /* namenode port */ + "", /* user name */ + "", /* kerberos path */ + 1024, /* buffer size */ +}; + +/****************** + * TEST FUNCTIONS * + ******************/ + + +/*--------------------------------------------------------------------------- + * + * Function: test_fapl_config_validation() + * + * Purpose: + * + * Test data consistency of fapl configuration. + * Tests `H5FD_hdfs_validate_config` indirectly through `H5Pset_fapl_hdfs`. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2018-04-25 + * + * Changes: None. + * + *--------------------------------------------------------------------------- + */ +static int +test_fapl_config_validation(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char *msg; + herr_t expected; + H5FD_hdfs_fapl_t config; + }; + + /************************ + * test-local variables * + ************************/ + + hid_t fapl_id = -1; /* file access property list ID */ + H5FD_hdfs_fapl_t config; + H5FD_hdfs_fapl_t fa_fetch; + herr_t success = SUCCEED; + unsigned int i = 0; + unsigned int ncases = 6; /* should equal number of cases */ + struct testcase *case_ptr = NULL; /* dumb work-around for possible */ + /* dynamic cases creation because */ + /* of compiler warnings Wlarger-than */ + struct testcase cases_arr[] = { + { "default config fapl", + SUCCEED, + { 1, /* version */ + "localhost", /* namenode_name */ + 0, /* namenode_port number */ + "some_user", /* user_name */ + "", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + { "invalid version number (2)", + FAIL, + { 2, /* version */ + "localhost", /* namenode_name */ + 0, /* namenode_port number */ + "some_user", /* user_name */ + "", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + { "invalid version number (0)", + FAIL, + { 0, /* version */ + "localhost", /* namenode_name */ + 0, /* namenode_port number */ + "some_user", /* user_name */ + "", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + { "nonsense kerberos path still ok?", + SUCCEED, + { 1, /* version */ + "localhost", /* namenode_name */ + 0, /* namenode_port number */ + "some_user", /* user_name */ + "pathToSomewhere", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + { "namenode port number too high", + FAIL, + { 1, /* version */ + "localhost", /* namenode_name */ + 88000, /* namenode_port number */ + "some_user", /* user_name */ + "", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + { "negative namenode port number", + FAIL, + { 1, /* version */ + "localhost", /* namenode_name */ + -1, /* namenode_port number */ + "some_user", /* user_name */ + "", /* kerberos_ticket_cache path */ + -1, /* stream_buffer_size */ + }, + }, + }; + + TESTING("HDFS fapl configuration validation"); + + /********* + * TESTS * + *********/ + + for (i = 0; i < ncases; i++) { + + /*--------------- + * per-test setup + *--------------- + */ + case_ptr = &cases_arr[i]; + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) /* sanity-check */ + + /*----------------------------------- + * Actually test -- set fapl. + * Mute stack trace in failure cases. + *----------------------------------- + */ + H5E_BEGIN_TRY { + /* `H5FD_hdfs_validate_config(...)` is static/private + * to src/hdfs.c and cannot (and should not?) be tested directly? + * Instead, validate config through public api. + */ + success = H5Pset_fapl_hdfs(fapl_id, &case_ptr->config); + } H5E_END_TRY; + + JSVERIFY( case_ptr->expected, success, case_ptr->msg ) + + /* Make sure we can get back what we put in. + * Only valid if the fapl configuration does not result in error. + */ + if (success == SUCCEED) { + config = case_ptr->config; + JSVERIFY( SUCCEED, + H5Pget_fapl_hdfs(fapl_id, &fa_fetch), + "unable to get fapl" ) + JSVERIFY( H5FD__CURR_HDFS_FAPL_T_VERSION, + fa_fetch.version, + "invalid version number" ) + JSVERIFY( config.version, + fa_fetch.version, + "version number mismatch" ) + JSVERIFY( config.namenode_port, + fa_fetch.namenode_port, + "namenode port mismatch" ) + JSVERIFY( config.stream_buffer_size, + fa_fetch.stream_buffer_size, + "streambuffer size mismatch" ) + JSVERIFY_STR( config.namenode_name, + fa_fetch.namenode_name, + NULL ) + JSVERIFY_STR( config.user_name, + fa_fetch.user_name, + NULL ) + JSVERIFY_STR( config.kerberos_ticket_cache, + fa_fetch.kerberos_ticket_cache, + NULL ) + } + + /*----------------------------- + * per-test sanitation/teardown + *----------------------------- + */ + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + } /* for each test case */ + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fapl_id < 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + return 1; + +} /* test_fapl_config_validation */ + + +/*------------------------------------------------------------------------- + * + * Function: test_hdfs_fapl() + * + * Purpose: Tests the file handle interface for the HDFS driver. + * + * For now, test only fapl & flags. Extend as the + * work on the VFD continues. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Jacob Smith + * 2018-04-25 + * + * Changes: None. + * + *------------------------------------------------------------------------- + */ +static int +test_hdfs_fapl(void) +{ + /************************ + * test-local variables * + ************************/ + + hid_t fapl_id = -1; /* file access property list ID */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + H5FD_hdfs_fapl_t hdfs_fa_0 = { + 1, /* version*/ + "", /* node name */ + 9000, /* node port */ + "", /* username */ + "", /* kerb cache path */ + 1024, /* stream buffer size */ + }; + + TESTING("HDFS fapl "); + + /* Set property list and file name for HDFS driver. + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &hdfs_fa_0) ) + + driver_id = H5Pget_driver(fapl_id); + FAIL_IF( driver_id < 0 ) + + /**************** + * Check that the VFD feature flags are correct + * SPEC MAY CHANGE + ******************/ + + FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 ) + + JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE), + "bit(s) in `driver_flags` must align with " + "H5FD_FEAT_DATA_SIEVE" ) + + JSVERIFY( H5FD_FEAT_DATA_SIEVE, driver_flags, + "H5FD_FEAT_DATA_SIEVE should be the only supported flag") + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + + return 1; + +} /* test_hdfs_fapl() */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_vfd_open() + * + * Purpose: + * + * Demonstrate/specify VFD-level "Open" failure cases + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2018-06-07 + * + *--------------------------------------------------------------------------- + */ +static int +test_vfd_open(void) +{ + /********************* + * test-local macros * + *********************/ + +/* selectors for which fapl to use in testcase */ +#define FAPL_H5P_DEFAULT -2 +#define FAPL_UNCONFIGURED -3 /* H5P_FILE_ACCESS */ +#define FAPL_HDFS -4 + +#ifdef H5_HAVE_LIBHDFS + /************************* + * test-local structures * + *************************/ + + struct test_condition { + const char *message; + const char *url; + unsigned flags; + int which_fapl; + haddr_t maxaddr; + hbool_t might_use_other_driver; + }; + + /************************ + * test-local variables * + ************************/ + + struct test_condition failing_conditions[] = { + { "default property list (H5P_DEFAULT) is invalid", + filename_bard, + H5F_ACC_RDONLY, + FAPL_H5P_DEFAULT, + MAXADDR, + TRUE, + }, + { "generic file access property list is invalid", + filename_bard, + H5F_ACC_RDONLY, + FAPL_UNCONFIGURED, + MAXADDR, + TRUE, + }, + { "filename cannot be null", + NULL, + H5F_ACC_RDONLY, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "filename cannot be empty", + "", + H5F_ACC_RDONLY, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "file at filename must exist", + filename_missing, + H5F_ACC_RDONLY, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "read-write flag not supported", + filename_bard, + H5F_ACC_RDWR, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "truncate flag not supported", + filename_bard, + H5F_ACC_TRUNC, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "create flag not supported", + filename_bard, + H5F_ACC_CREAT, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "EXCL flag not supported", + filename_bard, + H5F_ACC_EXCL, + FAPL_HDFS, + MAXADDR, + FALSE, + }, + { "maxaddr cannot be 0 (caught in `H5FD_open()`)", + filename_bard, + H5F_ACC_RDONLY, + FAPL_HDFS, + 0, + FALSE, + }, + }; +#endif /* H5_HAVE_LIBHDFS */ + H5FD_t *fd = NULL; + hid_t fapl_hdfs = -1; + hid_t fapl_unconfigured = -1; + unsigned i = 0; + unsigned failing_conditions_count = 10; + + TESTING("HDFS VFD-level open"); + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_unconfigured < 0 ) + + fapl_hdfs = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_hdfs < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_hdfs, &default_fa) ) + + /********* + * TESTS * + *********/ + + /* all the test cases that will _not_ open + */ + for (i = 0; i < failing_conditions_count; i++) { + struct test_condition T = failing_conditions[i]; + hid_t fapl_id = H5P_DEFAULT; + + fd = NULL; + + if (T.which_fapl == FAPL_UNCONFIGURED) + fapl_id = fapl_unconfigured; + else if (T.which_fapl == FAPL_HDFS) + fapl_id = fapl_hdfs; + +#if HDFS_TEST_DEBUG + HDfprintf(stderr, "testing: %s\n", T.message); +#endif /* HDFS_TEST_DEBUG */ + + H5E_BEGIN_TRY { + fd = H5FDopen(T.url, T.flags, fapl_id, T.maxaddr); + } H5E_END_TRY; + if (NULL != fd) { + if (TRUE == T.might_use_other_driver && + H5FD_HDFS != fd->driver_id) + { + HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \ + " Successful open of file on local system " \ + "with non-HDFS VFD.\n"); + JSVERIFY(SUCCEED, H5FDclose(fd), + "unable to close errant open"); + fd = NULL; + } else { + JSVERIFY(1, 0, T.message); /* print message and fail */ + } + } + } + + FAIL_IF( NULL != fd ) /* sanity check */ + +#if HDFS_TEST_DEBUG + HDfprintf(stderr, "nominal open\n"); +#endif /* HDFS_TEST_DEBUG */ + + /* finally, show that a file can be opened + */ + fd = H5FDopen( + filename_bard, + H5F_ACC_RDONLY, + fapl_hdfs, + MAXADDR); + FAIL_IF( NULL == fd ) + + /************ + * TEARDOWN * + ************/ + +#if HDFS_TEST_DEBUG + HDfprintf(stderr, "teardown...\n"); +#endif /* HDFS_TEST_DEBUG */ + + FAIL_IF( FAIL == H5FDclose(fd) ) + fd = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_hdfs) ) + fapl_hdfs = -1; + + FAIL_IF( FAIL == H5Pclose(fapl_unconfigured) ) + fapl_unconfigured = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd) + (void)H5FDclose(fd); + H5E_BEGIN_TRY { + if (fapl_hdfs >= 0) + (void)H5Pclose(fapl_hdfs); + if (fapl_unconfigured >= 0) + (void)H5Pclose(fapl_unconfigured); + } H5E_END_TRY; + + return 1; + +#undef FAPL_H5P_DEFAULT +#undef FAPL_UNCONFIGURED +#undef FAPL_HDFS + +} /* test_vfd_open */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_eof_eoa() + * + * Purpose: + * + * Demonstrate behavior of get_eof, get_eoa, and set_eoa. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2018-06-07 + * + *--------------------------------------------------------------------------- + */ +static int +test_eof_eoa(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + + H5FD_t *fd_shakespeare = NULL; + hid_t fapl_id = -1; + + TESTING("HDFS eof/eoa gets and sets"); + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + /********* + * SETUP * + *********/ + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) + + fd_shakespeare = H5FDopen( + filename_bard, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_shakespeare ) + + /********* + * TESTS * + *********/ + + /* verify as found + */ + JSVERIFY( 5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL ) + JSVERIFY( H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW), + "mismatch between DEFAULT and RAW memory types" ) + JSVERIFY( 0, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA should be unset by H5FDopen" ) + + /* set EoA below EoF + */ + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), + "unable to set EoA (lower)" ) + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoF changed" ) + JSVERIFY( 44442202, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA unchanged" ) + + /* set EoA above EoF + */ + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), + "unable to set EoA (higher)" ) + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoF changed" ) + JSVERIFY( 6789012, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA unchanged" ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(fd_shakespeare) ) + fd_shakespeare = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd_shakespeare != NULL) { + (void)H5FDclose(fd_shakespeare); + } + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; + +} /* test_eof_eoa */ + + +/*----------------------------------------------------------------------------- + * + * Function: test_H5FDread_without_eoa_set_fails() + * + * Purpose: + * + * Demonstrate a not-obvious constraint by the library, preventing + * file read before EoA is set + * + * Programmer: Jacob Smith + * 2018-06-08 + * + *----------------------------------------------------------------------------- + */ +static int +test_H5FDread_without_eoa_set_fails(void) +{ +#ifdef H5_HAVE_LIBHDFS + char buffer[HDFS_TEST_MAX_BUF_SIZE]; + unsigned int i = 0; +#endif /* H5_HAVE_LIBHDFS */ + H5FD_t *file_shakespeare = NULL; + hid_t fapl_id = -1; + + TESTING("HDFS VFD read-eoa temporal coupling library limitation"); + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + /********* + * SETUP * + *********/ + + /* create HDFS fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) + + file_shakespeare = H5FDopen( + filename_bard, + H5F_ACC_RDONLY, + fapl_id, + MAXADDR); + FAIL_IF( NULL == file_shakespeare ) + + JSVERIFY( 0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), + "EoA should remain unset by H5FDopen" ) + + /* zero buffer contents */ + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + buffer[i] = 0; + } + + /******** + * TEST * + ********/ + + H5E_BEGIN_TRY { /* mute stack trace on expected failure */ + JSVERIFY( FAIL, + H5FDread(file_shakespeare, + H5FD_MEM_DRAW, + H5P_DEFAULT, + 1200699, + 102, + buffer), + "cannot read before eoa is set" ) + } H5E_END_TRY; + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + JSVERIFY( 0, (unsigned)buffer[i], "buffer was modified by write!" ) + } + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file_shakespeare) ) + file_shakespeare = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + + if (file_shakespeare) { + (void)H5FDclose(file_shakespeare); + } + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; + +} /* test_H5FDread_without_eoa_set_fails */ + + + +/*--------------------------------------------------------------------------- + * + * Function: test_read() + * + * Purpose: + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2018-06-08 + * + *--------------------------------------------------------------------------- + */ +static int +test_read(void) +{ + /********************* + * test-local macros * + *********************/ + +#ifdef H5_HAVE_LIBHDFS + /************************* + * test-local structures * + *************************/ + struct testcase { + const char *message; /* purpose of test case */ + haddr_t eoa_set; /* set file EOA to this prior to read */ + size_t addr; /* offset of read in file */ + size_t len; /* length of read in file */ + herr_t success; /* expected return value of read function */ + const char *expected; /* expected contents of buffer; failure ignores */ + }; + + /************************ + * test-local variables * + ************************/ + struct testcase cases[] = { + { "successful range-get", + 6464, + 5691, + 32, /* fancy quotes are three bytes each(?) */ + SUCCEED, + "Quoth the Raven “Nevermore.”", + }, + { "read past EOA fails (EOA < EOF < addr)", + 3000, + 4000, + 100, + FAIL, + NULL, + }, + { "read overlapping EOA fails (EOA < addr < EOF < (addr+len))", + 3000, + 8000, + 100, + FAIL, + NULL, + }, + { "read past EOA/EOF fails ((EOA==EOF) < addr)", + 6464, + 7000, + 100, + FAIL, + NULL, + }, + { "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))", + 6464, + 6400, + 100, + FAIL, + NULL, + }, + { "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)", + 8000, + 7000, + 100, + FAIL, + NULL, + }, + }; + unsigned testcase_count = 6; + unsigned test_i = 0; + struct testcase test; + herr_t open_return = FAIL; + char buffer[HDFS_TEST_MAX_BUF_SIZE]; + unsigned int i = 0; +#endif /* H5_HAVE_LIBHDFS */ + H5FD_t *file_raven = NULL; + hid_t fapl_id = -1; + + TESTING("HDFS VFD read/range-gets"); + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + /********* + * SETUP * + *********/ + + /* create HDFS fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) + + /* zero buffer contents */ + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + buffer[i] = 0; + } + + /* open file + */ + file_raven = H5FDopen( + filename_raven, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); /* Demonstrate success with "automatic" value */ + FAIL_IF( NULL == file_raven ) + + JSVERIFY( 6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL ) + + /********* + * TESTS * + *********/ + + for (test_i = 0; test_i < testcase_count; test_i++) { + + /* -------------- * + * per-test setup * + * -------------- */ + + test = cases[test_i]; + open_return = FAIL; + + FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */ + + FAIL_IF( FAIL == + H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) ) + + /* zero buffer contents */ + for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { + buffer[i] = 0; + } + + /* ------------ * + * conduct test * + * ------------ */ + + H5E_BEGIN_TRY { + open_return = H5FDread( + file_raven, + H5FD_MEM_DRAW, + H5P_DEFAULT, + test.addr, + test.len, + buffer); + } H5E_END_TRY; + + JSVERIFY( test.success, + open_return, + test.message ) + + if (open_return == SUCCEED) { + JSVERIFY_STR( test.expected, buffer, NULL ) + } + + } /* for each testcase */ + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file_raven) ) + file_raven = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + + if (file_raven != 0) + (void)H5FDclose(file_raven); + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; + +} /* test_read */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_noops_and_autofails() + * + * Purpose: + * + * Demonstrate the unavailable and do-nothing routines unique to + * Read-Only VFD. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + * Changes: + * + modify from S3VFD codebase to HDFS; Minor changes, mostly. + * + Jacob Smith 2018-06-08 + * + *--------------------------------------------------------------------------- + */ +static int +test_noops_and_autofails(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + + hid_t fapl_id = -1; + H5FD_t *file = NULL; + const char data[36] = "The Force shall be with you, always"; + + TESTING("HDFS VFD always-fail and no-op routines"); + + /********* + * SETUP * + *********/ + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + /* create HDFS fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) + + /* open file + */ + file = H5FDopen( + filename_bard, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == file ) + + /********* + * TESTS * + *********/ + + /* auto-fail calls to write and truncate + */ + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), + "write must fail" ) + } H5E_END_TRY; + + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDtruncate(file, H5P_DEFAULT, FALSE), + "truncate must fail" ) + } H5E_END_TRY; + + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDtruncate(file, H5P_DEFAULT, TRUE), + "truncate must fail (closing)" ) + } H5E_END_TRY; + + /* no-op calls to `lock()` and `unlock()` + */ + JSVERIFY( SUCCEED, + H5FDlock(file, TRUE), + "lock always succeeds; has no effect" ) + JSVERIFY( SUCCEED, + H5FDlock(file, FALSE), + NULL ) + JSVERIFY( SUCCEED, + H5FDunlock(file), + NULL ) + /* Lock/unlock with null file or similar error crashes tests. + * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()` + */ + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file) ) + file = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + if (file != NULL) { + (void)H5FDclose(file); + } + + return 1; + +} /* test_noops_and_autofails*/ + + +/*--------------------------------------------------------------------------- + * + * Function: test_cmp() + * + * Purpose: + * + * Verify "file comparison" behavior. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + *--------------------------------------------------------------------------- + */ +static int +test_cmp(void) +{ +#if 0 + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + + H5FD_t *fd_raven = NULL; + H5FD_t *fd_shakes = NULL; + H5FD_t *fd_raven_2 = NULL; + hbool_t curl_ready = FALSE; + hid_t fapl_id = -1; + + + + TESTING("HDFS cmp (comparison)"); + + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) + curl_ready = TRUE; + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + JSVERIFY( SUCCEED, H5Pset_fapl_hdfs(fapl_id, &restricted_access_fa), NULL ) + + fd_raven = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_raven ) + + fd_shakes = H5FDopen( + url_text_restricted, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_shakes ) + + fd_raven_2 = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_raven_2 ) + + /********* + * TESTS * + *********/ + + JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL ) + JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL ) + JSVERIFY( 1, H5FDcmp(fd_shakes, fd_raven_2), NULL ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(fd_raven) ) + fd_raven = NULL; + FAIL_IF( FAIL == H5FDclose(fd_shakes) ) + fd_shakes = NULL; + FAIL_IF( FAIL == H5FDclose(fd_raven_2) ) + fd_raven_2 = NULL; + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd_raven != NULL) (void)H5FDclose(fd_raven); + if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2); + if (fd_shakes != NULL) (void)H5FDclose(fd_shakes); + if (TRUE == curl_ready) curl_global_cleanup(); + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + +#else + /* + JSFAILED_AT() + HDprintf("TODO\n"); + return 1; + */ + + TESTING("HDFS cmp (comparison)"); + SKIPPED(); + HDfprintf( + stderr, + " TODO: Distinct valid fapls to open the same file.\n"); + + return 0; +#endif /* s3comms relic */ + +} /* test_cmp */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_H5F_integration() + * + * Purpose: + * + * Demonstrate H5F (File interface) behavior with files on HDFS. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-07 + * + * Changes: + * + modify from S3VFD codebase to HDFS; Minor changes, mostly. + * + Jacob Smith 2018-06-08 + * + *--------------------------------------------------------------------------- + */ +static int +test_H5F_integration(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + + hid_t file = -1; + hid_t fapl_id = -1; + + TESTING("HDFS file access through HD5F library (H5F API)"); + + /********* + * SETUP * + *********/ + +#ifndef H5_HAVE_LIBHDFS + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; +#else + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) + + /********* + * TESTS * + *********/ + + /* Read-Write Open access is not allowed with this file driver. + */ + H5E_BEGIN_TRY { + FAIL_IF( 0 <= H5Fopen( + filename_example_h5, + H5F_ACC_RDWR, + fapl_id) ) + } H5E_END_TRY; + + /* H5Fcreate() is not allowed with this file driver. + */ + H5E_BEGIN_TRY { + FAIL_IF( 0 <= H5Fcreate( + filename_missing, + H5F_ACC_RDONLY, + H5P_DEFAULT, + fapl_id) ) + } H5E_END_TRY; + + /* Successful open. + */ + file = H5Fopen( + filename_example_h5, + H5F_ACC_RDONLY, + fapl_id); + FAIL_IF( file < 0 ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5Fclose(file) ) + file = -1; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; +#endif /* H5_HAVE_LIBHDFS */ + +error: + /*********** + * CLEANUP * + ***********/ + +#if HDFS_TEST_DEBUG + HDprintf("\nerror!"); fflush(stdout); +#endif /* HDFS_TEST_DEBUG */ + + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + if (file > 0) { + (void)H5Fclose(file); + } + + return 1; + +} /* test_H5F_integration */ + + +/*------------------------------------------------------------------------- + * + * Function: main + * + * Purpose: Tests the basic features of Virtual File Drivers + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + + /****************** + * commence tests * + ******************/ + + static char hdfs_namenode_name[MAX_HDFS_NAMENODE_NAME] = ""; + const char *hdfs_namenode_name_env = NULL; + + hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME"); + if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') { + HDstrncpy(hdfs_namenode_name, "localhost", 9); + } else { + HDstrncpy(default_fa.namenode_name, hdfs_namenode_name_env, MAX_HDFS_NAMENODE_NAME); + } + + h5_reset(); + + HDprintf("Testing hdfs VFD functionality.\n"); + + nerrors += test_fapl_config_validation(); + nerrors += test_hdfs_fapl(); + nerrors += test_vfd_open(); + nerrors += test_eof_eoa(); + nerrors += test_H5FDread_without_eoa_set_fails(); + nerrors += test_read(); + nerrors += test_noops_and_autofails(); + nerrors += test_cmp(); + nerrors += test_H5F_integration(); + + if (nerrors > 0) { + HDprintf("***** %d hdfs TEST%s FAILED! *****\n", + nerrors, + nerrors > 1 ? "S" : ""); + nerrors = 1; + } else { + HDprintf("All hdfs tests passed.\n"); + } + return nerrors; /* 0 if no errors, 1 if any errors */ + +} /* main() */ + + diff --git a/test/ros3.c b/test/ros3.c new file mode 100644 index 0000000..51c1a89 --- /dev/null +++ b/test/ros3.c @@ -0,0 +1,2020 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: + * + * Verify behavior for Read-Only S3 VFD + * at the VFL (virtual file layer) level. + * + * Demonstrates basic use cases and fapl/dxpl interaction. + * + * Programmer: Jacob Smith + * 2017-10-11 + */ + +#include "h5test.h" + +#include "H5FDprivate.h" /* Virtual File Driver utilities */ +#include "H5FDros3.h" /* this file driver's utilities */ +#include "H5FDs3comms.h" /* for loading of credentials */ + + + +/***************************************************************************** + * + * FILE-LOCAL TESTING MACROS + * + * Purpose: + * + * 1) Upon test failure, goto-jump to single-location teardown in test + * function. E.g., `error:` (consistency with HDF corpus) or + * `failed:` (reflects purpose). + * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. + * 2) Increase clarity and reduce overhead found with `TEST_ERROR`. + * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" + * requires reading of entire line to know whether this if/call is + * part of the test setup, test operation, or a test unto itself. + * 3) Provide testing macros with optional user-supplied failure message; + * if not supplied (NULL), generate comparison output in the spirit of + * test-driven development. E.g., "expected 5 but was -3" + * User messages clarify test's purpose in code, encouraging description + * without relying on comments. + * 4) Configurable expected-actual order in generated comparison strings. + * Some prefer `VERIFY(expected, actual)`, others + * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch + * to satifsy both parties, assuming one paradigm per test file. + * (One could #undef and redefine the flag through the file as desired, + * but _why_.) + * + * Provided as courtesy, per consideration for inclusion in the library + * proper. + * + * Macros: + * + * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order + * FAIL_IF() - check condition + * FAIL_UNLESS() - check _not_ condition + * JSVERIFY() - long-int equality check; prints reason/comparison + * JSVERIFY_NOT() - long-int inequality check; prints + * JSVERIFY_STR() - string equality check; prints + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * ifdef flag: JSVERIFY_EXP_ACT + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_EXP_ACT 1L + + +/*---------------------------------------------------------------------------- + * + * Macro: JSFAILED_AT() + * + * Purpose: + * + * Preface a test failure by printing "*FAILED*" and location to stdout + * Similar to `H5_FAILED(); AT();` from h5test.h + * + * *FAILED* at somefile.c:12 in function_name()... + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSFAILED_AT() { \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_IF() + * + * Purpose: + * + * Make tests more accessible and less cluttered than + * `if (thing == otherthing()) TEST_ERROR` + * paradigm. + * + * The following lines are roughly equivalent: + * + * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) + * `FAIL_IF(myfunc() < 0)` + * + * Prints a generic "FAILED AT" line to stdout and jumps to `error`, + * similar to `TEST_ERROR` in h5test.h + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_IF(condition) \ +if (condition) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_UNLESS() + * + * Purpose: + * + * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", + * e.g., "a != b". + * + * Opposite of FAIL_IF; fails if the given condition is _not_ true. + * + * `FAIL_IF( 5 != my_op() )` + * is equivalent to + * `FAIL_UNLESS( 5 == my_op() )` + * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. + * (see JSVERIFY) + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#if 0 /* UNUSED */ +#define FAIL_UNLESS(condition) \ +if (!(condition)) { \ + JSFAILED_AT() \ + goto error; \ +} +#endif + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_LONG() + * + * Purpose: + * + * Print an failure message for long-int arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:488 in somefunc()... + * forest must be made of trees. + * + * or + * + * *FAILED* at myfile.c:488 in somefunc()... + * ! Expected 425 + * ! Actual 3 + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_LONG(expected, actual, reason) { \ + JSFAILED_AT() \ + if (reason!= NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ + (long)(expected), (long)(actual)); \ + } \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_STR() + * + * Purpose: + * + * Print an failure message for string arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:421 in myfunc()... + * Blue and Red strings don't match! + * + * or + * + * *FAILED* at myfile.c:421 in myfunc()... + * !!! Expected: + * this is my expected + * string + * !!! Actual: + * not what I expected at all + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_STR(expected, actual, reason) { \ + JSFAILED_AT() \ + if ((reason) != NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ + (expected), (actual)); \ + } \ +} + + + +#ifdef JSVERIFY_EXP_ACT + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY() + * + * Purpose: + * + * Verify that two long integers are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(expected, actual, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_NOT() + * + * Purpose: + * + * Verify that two long integers are _not_ equal. + * If equal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(expected, actual, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_STR() + * + * Purpose: + * + * Verify that two strings are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(expected, actual, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + + +#else +/* JSVERIFY_EXP_ACT not defined + * + * Repeats macros above, but with actual/expected parameters reversed. + */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY() + * See: JSVERIFY documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(actual, expected, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_NOT() + * See: JSVERIFY_NOT documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(actual, expected, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_STR() + * See: JSVERIFY_STR documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(actual, expected, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + +#endif /* ifdef/else JSVERIFY_EXP_ACT */ + +/******************************** + * OTHER MACROS AND DEFINITIONS * + ********************************/ + +/* copied from src/ros3.c + */ +#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) + +#ifdef H5_HAVE_ROS3_VFD +#define S3_TEST_PROFILE_NAME "ros3_vfd_test" + +#define S3_TEST_MAX_URL_SIZE 256 + +#define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt" +#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt" +#define S3_TEST_RESOURCE_H5_PUBLIC "GMODO-SVM01.h5" +#define S3_TEST_RESOURCE_MISSING "missing.csv" + +static char url_text_restricted[S3_TEST_MAX_URL_SIZE] = ""; +static char url_text_public[S3_TEST_MAX_URL_SIZE] = ""; +static char url_h5_public[S3_TEST_MAX_URL_SIZE] = ""; +static char url_missing[S3_TEST_MAX_URL_SIZE] = ""; +static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = ""; +static hbool_t s3_test_bucket_defined = FALSE; + +/* Global variables for aws test profile. + * An attempt is made to read ~/.aws/credentials and ~/.aws/config upon test + * startup -- if unable to open either file or cannot load region, id, and key, + * tests connecting with S3 will not be run + */ +static int s3_test_credentials_loaded = 0; +static char s3_test_aws_region[16]; +static char s3_test_aws_access_key_id[64]; +static char s3_test_aws_secret_access_key[128]; + +H5FD_ros3_fapl_t restricted_access_fa = { + H5FD__CURR_ROS3_FAPL_T_VERSION, /* fapl version */ + TRUE, /* authenticate */ + "", /* aws region */ + "", /* access key id */ + ""}; /* secret access key */ + +H5FD_ros3_fapl_t anonymous_fa = { + H5FD__CURR_ROS3_FAPL_T_VERSION, + FALSE, "", "", "" }; +#endif /* H5_HAVE_ROS3_VFD */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_fapl_config_validation() + * + * Purpose: + * + * Test data consistency of fapl configuration. + * Tests `H5FD_ros3_validate_config` indirectly through `H5Pset_fapl_ros3`. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-10-23 + * + * Changes: None. + * + *--------------------------------------------------------------------------- + */ +static int +test_fapl_config_validation(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char *msg; + herr_t expected; + H5FD_ros3_fapl_t config; + }; + + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + hid_t fapl_id = -1; /* file access property list ID */ + H5FD_ros3_fapl_t config; + H5FD_ros3_fapl_t fa_fetch; + herr_t success = SUCCEED; + unsigned int i = 0; + unsigned int ncases = 8; /* should equal number of cases */ + struct testcase *case_ptr = NULL; /* dumb work-around for possible */ + /* dynamic cases creation because */ + /* of compiler warnings Wlarger-than */ + struct testcase cases_arr[] = { + { "non-authenticating config allows empties.\n", + SUCCEED, + { H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + FALSE, /* authenticate */ + "", /* aws_region */ + "", /* secret_id */ + "", /* secret_key */ + }, + }, + { "authenticating config asks for populated strings.\n", + FAIL, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + TRUE, + "", + "", + "", + }, + }, + { "populated strings; key is the empty string?\n", + SUCCEED, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + TRUE, + "region", + "me", + "", + }, + }, + { "id cannot be empty.\n", + FAIL, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + TRUE, + "", + "me", + "", + }, + }, + { "region cannot be empty.\n", + FAIL, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + TRUE, + "where", + "", + "", + }, + }, + { "all strings populated.\n", + SUCCEED, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + TRUE, + "where", + "who", + "thisIsA GREAT seeeecrit", + }, + }, + { "incorrect version should fail\n", + FAIL, + { 12345, + FALSE, + "", + "", + "", + }, + }, + { "non-authenticating config cares not for (de)population" + "of strings.\n", + SUCCEED, + { H5FD__CURR_ROS3_FAPL_T_VERSION, + FALSE, + "someregion", + "someid", + "somekey", + }, + }, + }; + +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 fapl configuration validation"); + + /********* + * TESTS * + *********/ + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + for (i = 0; i < ncases; i++) { + + /*--------------- + * per-test setup + *--------------- + */ + case_ptr = &cases_arr[i]; + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) /* sanity-check */ + + /*----------------------------------- + * Actually test. + * Mute stack trace in failure cases. + *----------------------------------- + */ + H5E_BEGIN_TRY { + /* `H5FD_ros3_validate_config(...)` is static/private + * to src/ros3.c and cannot (and should not?) be tested directly? + * Instead, validate config through public api. + */ + success = H5Pset_fapl_ros3(fapl_id, &case_ptr->config); + } H5E_END_TRY; + + JSVERIFY( case_ptr->expected, success, case_ptr->msg ) + + /* Make sure we can get back what we put in. + * Only valid if the fapl configuration does not result in error. + */ + if (success == SUCCEED) { + config = case_ptr->config; + JSVERIFY( SUCCEED, + H5Pget_fapl_ros3(fapl_id, &fa_fetch), + "unable to get fapl" ) + + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, + fa_fetch.version, + "invalid version number" ) + JSVERIFY( config.version, + fa_fetch.version, + "version number mismatch" ) + JSVERIFY( config.authenticate, + fa_fetch.authenticate, + "authentication flag mismatch" ) + JSVERIFY_STR( config.aws_region, + fa_fetch.aws_region, + NULL ) + JSVERIFY_STR( config.secret_id, + fa_fetch.secret_id, + NULL ) + JSVERIFY_STR( config.secret_key, + fa_fetch.secret_key, + NULL ) + } + + /*----------------------------- + * per-test sanitation/teardown + *----------------------------- + */ + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + } /* for each test case */ + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fapl_id < 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + return 1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_fapl_config_validation */ + + +/*------------------------------------------------------------------------- + * + * Function: test_ros3_fapl() + * + * Purpose: Tests the file handle interface for the ROS3 driver + * + * As the ROS3 driver is 1) read only, 2) requires access + * to an S3 server (minio for now), this test is quite + * different from the other tests. + * + * For now, test only fapl & flags. Extend as the + * work on the VFD continues. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: John Mainzer + * 7/12/17 + * + * Changes: Test only fapl and flags. + * Jacob Smith 2017 + * + *------------------------------------------------------------------------- + */ +static int +test_ros3_fapl(void) +{ + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + hid_t fapl_id = -1; /* file access property list ID */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + H5FD_ros3_fapl_t ros3_fa_0 = { + H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + FALSE, /* authenticate */ + "", /* aws_region */ + "", /* secret_id */ + "plugh", /* secret_key */ + }; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 fapl "); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + /* Set property list and file name for ROS3 driver. + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) ) + + driver_id = H5Pget_driver(fapl_id); + FAIL_IF( driver_id < 0 ) + + /**************** + * Check that the VFD feature flags are correct + * SPEC MAY CHANGE + ******************/ + + FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 ) + + JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE), + "bit(s) in `driver_flags` must align with " + "H5FD_FEAT_DATA_SIEVE" ) + + JSVERIFY( H5FD_FEAT_DATA_SIEVE, driver_flags, + "H5FD_FEAT_DATA_SIEVE should be the only supported flag") + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + + return 1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_ros3_fapl() */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_vfd_open() + * + * Purpose: + * + * Demonstrate/specify VFD-level "Open" failure cases + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 1027-11-03 + * + *--------------------------------------------------------------------------- + */ +static int +test_vfd_open(void) +{ + /********************* + * test-local macros * + *********************/ + +#ifdef H5_HAVE_ROS3_VFD + +#define FAPL_H5P_DEFAULT -2 +#define FAPL_FILE_ACCESS -3 +#define FAPL_ROS3_ANON -4 + + /************************* + * test-local structures * + *************************/ + + struct test_condition { + const char *message; + const char *url; + unsigned flags; + int which_fapl; + haddr_t maxaddr; + }; + + /************************ + * test-local variables * + ************************/ + + struct test_condition tests[] = { + { "default property list (H5P_DEFAULT) is invalid", + url_text_public, + H5F_ACC_RDONLY, + FAPL_H5P_DEFAULT, + MAXADDR, + }, + { "generic file access property list is invalid", + url_text_public, + H5F_ACC_RDONLY, + FAPL_FILE_ACCESS, + MAXADDR, + }, + { "filename cannot be null", + NULL, + H5F_ACC_RDONLY, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "filename cannot be empty", + "", + H5F_ACC_RDONLY, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "filename must exist", + url_missing, + H5F_ACC_RDONLY, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "read-write flag not supported", + url_text_public, + H5F_ACC_RDWR, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "truncate flag not supported", + url_text_public, + H5F_ACC_TRUNC, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "create flag not supported", + url_text_public, + H5F_ACC_CREAT, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "EXCL flag not supported", + url_text_public, + H5F_ACC_EXCL, + FAPL_ROS3_ANON, + MAXADDR, + }, + { "maxaddr cannot be 0 (caught in `H5FD_open()`)", + url_text_public, + H5F_ACC_RDONLY, + FAPL_ROS3_ANON, + 0, + }, + }; + H5FD_t *fd = NULL; + hbool_t curl_ready = FALSE; + hid_t fapl_id = -1; + hid_t fapl_file_access = -1; + unsigned i = 0; + unsigned tests_count = 10; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 VFD-level open"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) + curl_ready = TRUE; + + fapl_file_access = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_file_access < 0 ) + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &anonymous_fa) ) + + /********* + * TESTS * + *********/ + + /* all the test cases that will _not_ open + */ + for (i = 0; i < tests_count; i++) { + struct test_condition T = tests[i]; + hid_t _fapl_id = H5P_DEFAULT; + + fd = NULL; + + if (T.which_fapl == FAPL_FILE_ACCESS) + _fapl_id = fapl_file_access; + else if (T.which_fapl == FAPL_ROS3_ANON) + _fapl_id = fapl_id; + + H5E_BEGIN_TRY { + fd = H5FDopen(T.url, T.flags, _fapl_id, T.maxaddr); + } H5E_END_TRY; + if (NULL != fd) + JSVERIFY(1, 0, T.message); /* wrapper to print message and fail */ + } + + FAIL_IF( NULL != fd ) + + /* finally, show that a file can be opened + */ + fd = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + MAXADDR); + FAIL_IF( NULL == fd ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(fd) ) + fd = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + FAIL_IF( FAIL == H5Pclose(fapl_file_access) ) + fapl_file_access = -1; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd) { + (void)H5FDclose(fd); + } + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + if (fapl_file_access >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_file_access); + } H5E_END_TRY; + } + if (curl_ready == TRUE) { + curl_global_cleanup(); + } + + return 1; + +#undef FAPL_FILE_ACCESS +#undef FAPL_H5P_DEFAULT +#undef FAPL_ROS3_ANON + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_vfd_open */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_eof_eoa() + * + * Purpose: + * + * Demonstrate behavior of get_eof, get_eoa, and set_eoa. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-08 + * + *--------------------------------------------------------------------------- + */ +static int +test_eof_eoa(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + H5FD_t *fd_shakespeare = NULL; + hbool_t curl_ready = FALSE; + hid_t fapl_id = -1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 eof/eoa gets and sets"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) + curl_ready = TRUE; + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) ) + + fd_shakespeare = H5FDopen( + url_text_restricted, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_shakespeare ) + + /********* + * TESTS * + *********/ + + /* verify as found + */ + JSVERIFY( 5458199, H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), NULL ) + JSVERIFY( H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW), + "mismatch between DEFAULT and RAW memory types" ) + JSVERIFY( 0, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA should be unset by H5FDopen" ) + + /* set EoA below EoF + */ + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), + "unable to set EoA (lower)" ) + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoF changed" ) + JSVERIFY( 44442202, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA unchanged" ) + + /* set EoA above EoF + */ + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), + "unable to set EoA (higher)" ) + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoF changed" ) + JSVERIFY( 6789012, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + "EoA unchanged" ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(fd_shakespeare) ) + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd_shakespeare) (void)H5FDclose(fd_shakespeare); + if (TRUE == curl_ready) curl_global_cleanup(); + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_eof_eoa */ + + +/*----------------------------------------------------------------------------- + * + * Function: test_H5FDread_without_eoa_set_fails() + * + * Purpose: + * + * Demonstrate a not-obvious constraint by the library, preventing + * file read before EoA is set + * + * Programmer: Jacob Smith + * 2018-01-26 + * + *----------------------------------------------------------------------------- + */ +static int +test_H5FDread_without_eoa_set_fails(void) +{ +#ifdef H5_HAVE_ROS3_VFD + char buffer[256]; + unsigned int i = 0; + H5FD_t *file_shakespeare = NULL; + hid_t fapl_id = -1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 VFD read-eoa temporal coupling library limitation "); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + /* create ROS3 fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) ) + + file_shakespeare = H5FDopen( + url_text_restricted, + H5F_ACC_RDONLY, + fapl_id, + MAXADDR); + FAIL_IF( NULL == file_shakespeare ) + + JSVERIFY( 0, H5FDget_eoa(file_shakespeare, H5FD_MEM_DEFAULT), + "EoA should remain unset by H5FDopen" ) + + for (i = 0; i < 256; i++) + buffer[i] = 0; /* zero buffer contents */ + + /******** + * TEST * + ********/ + + H5E_BEGIN_TRY { /* mute stack trace on expected failure */ + JSVERIFY( FAIL, + H5FDread(file_shakespeare, + H5FD_MEM_DRAW, + H5P_DEFAULT, + 1200699, + 102, + buffer), + "cannot read before eoa is set" ) + } H5E_END_TRY; + JSVERIFY_STR( "", buffer, "buffer should remain untouched" ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file_shakespeare) ) + file_shakespeare = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (file_shakespeare) { (void)H5FDclose(file_shakespeare); } + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_H5FDread_without_eoa_set_fails */ + + + +/*--------------------------------------------------------------------------- + * + * Function: test_read() + * + * Purpose: + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + *--------------------------------------------------------------------------- + */ +static int +test_read(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + struct testcase { + const char *message; /* purpose of test case */ + haddr_t eoa_set; /* set file EOA to this prior to read */ + size_t addr; /* offset of read in file */ + size_t len; /* length of read in file */ + herr_t success; /* expected return value of read function */ + const char *expected; /* expected contents of buffer; failure ignores */ + }; + + /************************ + * test-local variables * + ************************/ +#ifdef H5_HAVE_ROS3_VFD + struct testcase cases[] = { + { "successful range-get", + 6464, + 5691, + 32, /* fancy quotes are three bytes each(?) */ + SUCCEED, + "Quoth the Raven “Nevermore.”", + }, + { "read past EOA fails (EOA < EOF < addr)", + 3000, + 4000, + 100, + FAIL, + NULL, + }, + { "read overlapping EOA fails (EOA < addr < EOF < (addr+len))", + 3000, + 8000, + 100, + FAIL, + NULL, + }, + { "read past EOA/EOF fails ((EOA==EOF) < addr)", + 6464, + 7000, + 100, + FAIL, + NULL, + }, + { "read overlapping EOA/EOF fails (addr < (EOA==EOF) < (addr+len))", + 6464, + 6400, + 100, + FAIL, + NULL, + }, + { "read between EOF and EOA fails (EOF < addr < (addr+len) < EOA)", + 8000, + 7000, + 100, + FAIL, + NULL, + }, + }; + unsigned testcase_count = 6; + unsigned test_i = 0; + struct testcase test; + herr_t open_return = FAIL; + char buffer[S3_TEST_MAX_URL_SIZE]; + unsigned int i = 0; + H5FD_t *file_raven = NULL; + hid_t fapl_id = -1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 VFD read/range-gets"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + /* create ROS3 fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) ) + + /* open file + */ + file_raven = H5FDopen( /* will open with "authenticating" fapl */ + url_text_public, /* TODO: check return state: anon access of restricted says OK? (not NULL) */ + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); /* Demonstrate success with "automatic" value */ + FAIL_IF( NULL == file_raven ) + + JSVERIFY( 6464, H5FDget_eof(file_raven, H5FD_MEM_DEFAULT), NULL ) + + /********* + * TESTS * + *********/ + + for (test_i = 0; test_i < testcase_count; test_i++) { + + /* -------------- * + * per-test setup * + * -------------- */ + + test = cases[test_i]; + open_return = FAIL; + + FAIL_IF( S3_TEST_MAX_URL_SIZE < test.len ) /* buffer too small! */ + + FAIL_IF( FAIL == + H5FD_set_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) ) + + for (i = 0; i < S3_TEST_MAX_URL_SIZE; i++) /* zero buffer contents */ + buffer[i] = 0; + + /* ------------ * + * conduct test * + * ------------ */ + + H5E_BEGIN_TRY { + open_return = H5FDread( + file_raven, + H5FD_MEM_DRAW, + H5P_DEFAULT, + test.addr, + test.len, + buffer); + } H5E_END_TRY; + + JSVERIFY( test.success, + open_return, + test.message ) + if (open_return == SUCCEED) + JSVERIFY_STR( test.expected, buffer, NULL ) + + } /* for each testcase */ + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file_raven) ) + file_raven = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (file_raven) + (void)H5FDclose(file_raven); + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_read */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_noops_and_autofails() + * + * Purpose: + * + * Demonstrate the unavailable and do-nothing routines unique to + * Read-Only VFD. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + *--------------------------------------------------------------------------- + */ +static int +test_noops_and_autofails(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + hbool_t curl_ready = FALSE; + hid_t fapl_id = -1; + H5FD_t *file = NULL; + const char data[36] = "The Force shall be with you, always"; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 VFD always-fail and no-op routines"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) + curl_ready = TRUE; + + /* create ROS3 fapl + */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + JSVERIFY( SUCCEED, H5Pset_fapl_ros3(fapl_id, &anonymous_fa), NULL ) + + /* open file + */ + file = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == file ) + + /********* + * TESTS * + *********/ + + /* auto-fail calls to write and truncate + */ + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), + "write must fail" ) + } H5E_END_TRY; + + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDtruncate(file, H5P_DEFAULT, FALSE), + "truncate must fail" ) + } H5E_END_TRY; + + H5E_BEGIN_TRY { + JSVERIFY( FAIL, + H5FDtruncate(file, H5P_DEFAULT, TRUE), + "truncate must fail (closing)" ) + } H5E_END_TRY; + + /* no-op calls to `lock()` and `unlock()` + */ + JSVERIFY( SUCCEED, + H5FDlock(file, TRUE), + "lock always succeeds; has no effect" ) + JSVERIFY( SUCCEED, + H5FDlock(file, FALSE), + NULL ) + JSVERIFY( SUCCEED, + H5FDunlock(file), + NULL ) + /* Lock/unlock with null file or similar error crashes tests. + * HDassert in calling heirarchy, `H5FD[un]lock()` and `H5FD_[un]lock()` + */ + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(file) ) + file = NULL; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + if (file) { (void)H5FDclose(file); } + if (curl_ready == TRUE) { curl_global_cleanup(); } + + return 1; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_noops_and_autofails*/ + + +/*--------------------------------------------------------------------------- + * + * Function: test_cmp() + * + * Purpose: + * + * Verify "file comparison" behavior. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-06 + * + *--------------------------------------------------------------------------- + */ +static int +test_cmp(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + H5FD_t *fd_raven = NULL; + H5FD_t *fd_shakes = NULL; + H5FD_t *fd_raven_2 = NULL; + hbool_t curl_ready = FALSE; + hid_t fapl_id = -1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("ROS3 cmp (comparison)"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) + curl_ready = TRUE; + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + JSVERIFY( SUCCEED, H5Pset_fapl_ros3(fapl_id, &restricted_access_fa), NULL ) + + fd_raven = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_raven ) + + fd_shakes = H5FDopen( + url_text_restricted, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_shakes ) + + fd_raven_2 = H5FDopen( + url_text_public, + H5F_ACC_RDONLY, + fapl_id, + HADDR_UNDEF); + FAIL_IF( NULL == fd_raven_2 ) + + /********* + * TESTS * + *********/ + + JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL ) + JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL ) + JSVERIFY( -1, H5FDcmp(fd_shakes, fd_raven_2), NULL ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5FDclose(fd_raven) ) + fd_raven = NULL; + FAIL_IF( FAIL == H5FDclose(fd_shakes) ) + fd_shakes = NULL; + FAIL_IF( FAIL == H5FDclose(fd_raven_2) ) + fd_raven_2 = NULL; + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (fd_raven != NULL) (void)H5FDclose(fd_raven); + if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2); + if (fd_shakes != NULL) (void)H5FDclose(fd_shakes); + if (TRUE == curl_ready) curl_global_cleanup(); + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + + return 1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_cmp */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_H5F_integration() + * + * Purpose: + * + * Demonstrate S3 file-open through H5F API. + * + * Return: + * + * PASSED : 0 + * FAILED : 1 + * + * Programmer: Jacob Smith + * 2017-11-07 + * + *--------------------------------------------------------------------------- + */ +static int +test_H5F_integration(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + hid_t file = -1; + hid_t fapl_id = -1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("S3 file access through HD5F library (H5F API)"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /********* + * SETUP * + *********/ + + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( 0 > fapl_id ) + FAIL_IF( FAIL == H5Pset_fapl_ros3(fapl_id, &restricted_access_fa) ) + + /********* + * TESTS * + *********/ + + /* Read-Write Open access is not allowed with this file driver. + */ + H5E_BEGIN_TRY { + FAIL_IF( 0 <= H5Fopen( + url_h5_public, + H5F_ACC_RDWR, + fapl_id) ) + } H5E_END_TRY; + + /* H5Fcreate() is not allowed with this file driver. + */ + H5E_BEGIN_TRY { + FAIL_IF( 0 <= H5Fcreate( + url_missing, + H5F_ACC_RDONLY, + H5P_DEFAULT, + fapl_id) ) + } H5E_END_TRY; + + /* Successful open. + */ + file = H5Fopen( + url_h5_public, + H5F_ACC_RDONLY, + fapl_id); + FAIL_IF( file < 0 ) + + /************ + * TEARDOWN * + ************/ + + FAIL_IF( FAIL == H5Fclose(file) ) + file = -1; + + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + fapl_id = -1; + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ +HDprintf("\nerror!"); fflush(stdout); + + if (fapl_id >= 0) { + H5E_BEGIN_TRY { + (void)H5Pclose(fapl_id); + } H5E_END_TRY; + } + if (file > 0) + (void)H5Fclose(file); + + return 1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_H5F_integration */ + + + + +/*------------------------------------------------------------------------- + * + * Function: main + * + * Purpose: Tests the basic features of Virtual File Drivers + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; + +#ifdef H5_HAVE_ROS3_VFD + const char *bucket_url_env = NULL; + + /************************ + * initialize test urls * + ************************/ + + bucket_url_env = HDgetenv("HDF5_ROS3_TEST_BUCKET_URL"); + if (bucket_url_env == NULL || bucket_url_env[0] == '\0') { + HDprintf("WARNING: S3 bucket url is not defined in enviornment " \ + "variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n"); + } else { + HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE); + s3_test_bucket_defined = TRUE; + } + + if (S3_TEST_MAX_URL_SIZE < snprintf( + url_text_restricted, + (size_t)S3_TEST_MAX_URL_SIZE, + "%s/%s", + (const char *)s3_test_bucket_url, + (const char *)S3_TEST_RESOURCE_TEXT_RESTRICTED)) + { + HDprintf("* ros3 setup failed (text_restricted) ! *\n"); + return 1; + } + if (S3_TEST_MAX_URL_SIZE < HDsnprintf( + url_text_public, + (size_t)S3_TEST_MAX_URL_SIZE, + "%s/%s", + (const char *)s3_test_bucket_url, + (const char *)S3_TEST_RESOURCE_TEXT_PUBLIC)) + { + HDprintf("* ros3 setup failed (text_public) ! *\n"); + return 1; + } + if (S3_TEST_MAX_URL_SIZE < HDsnprintf( + url_h5_public, + (size_t)S3_TEST_MAX_URL_SIZE, + "%s/%s", + (const char *)s3_test_bucket_url, + (const char *)S3_TEST_RESOURCE_H5_PUBLIC)) + { + HDprintf("* ros3 setup failed (h5_public) ! *\n"); + return 1; + } + if (S3_TEST_MAX_URL_SIZE < HDsnprintf( + url_missing, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + (const char *)s3_test_bucket_url, + (const char *)S3_TEST_RESOURCE_MISSING)) + { + HDprintf("* ros3 setup failed (missing) ! *\n"); + return 1; + } + + /************************************** + * load credentials and prepare fapls * + **************************************/ + + /* "clear" profile data strings */ + s3_test_aws_access_key_id[0] = '\0'; + s3_test_aws_secret_access_key[0] = '\0'; + s3_test_aws_region[0] = '\0'; + + /* attempt to load test credentials + * if unable, certain tests will be skipped + */ + if (SUCCEED == H5FD_s3comms_load_aws_profile( + S3_TEST_PROFILE_NAME, + s3_test_aws_access_key_id, + s3_test_aws_secret_access_key, + s3_test_aws_region)) + { + s3_test_credentials_loaded = 1; + HDstrncpy(restricted_access_fa.aws_region, + (const char *)s3_test_aws_region, + H5FD__ROS3_MAX_REGION_LEN); + HDstrncpy(restricted_access_fa.secret_id, + (const char *)s3_test_aws_access_key_id, + H5FD__ROS3_MAX_SECRET_ID_LEN); + HDstrncpy(restricted_access_fa.secret_key, + (const char *)s3_test_aws_secret_access_key, + H5FD__ROS3_MAX_SECRET_KEY_LEN); + } +#endif /* H5_HAVE_ROS3_VFD */ + + /****************** + * commence tests * + ******************/ + + h5_reset(); + + HDprintf("Testing ros3 VFD functionality.\n"); + + nerrors += test_fapl_config_validation(); + nerrors += test_ros3_fapl(); + nerrors += test_vfd_open(); + nerrors += test_eof_eoa(); + nerrors += test_H5FDread_without_eoa_set_fails(); + nerrors += test_read(); + nerrors += test_noops_and_autofails(); + nerrors += test_cmp(); + nerrors += test_H5F_integration(); + + if (nerrors > 0) { + HDprintf("***** %d ros3 TEST%s FAILED! *****\n", + nerrors, + nerrors > 1 ? "S" : ""); + nerrors = 1; + } else { + HDprintf("All ros3 tests passed.\n"); + } + return nerrors; /* 0 if no errors, 1 if any errors */ + +} /* main() */ + + diff --git a/test/s3comms.c b/test/s3comms.c new file mode 100644 index 0000000..71d93c2 --- /dev/null +++ b/test/s3comms.c @@ -0,0 +1,2813 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Read-Only S3 Virtual File Driver (VFD) * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Unit tests for the S3 Communications (s3comms) module. + * + * Programmer: Jacob Smith + * 2017-10-11 + */ + +#include "h5test.h" +#include "H5FDs3comms.h" +#include "H5MMprivate.h" /* memory management */ + +/***************************************************************************** + * + * FILE-LOCAL TESTING MACROS + * + * Purpose: + * + * 1) Upon test failure, goto-jump to single-location teardown in test + * function. E.g., `error:` (consistency with HDF corpus) or + * `failed:` (reflects purpose). + * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. + * 2) Increase clarity and reduce overhead found with `TEST_ERROR`. + * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" + * requires reading of entire line to know whether this if/call is + * part of the test setup, test operation, or a test unto itself. + * 3) Provide testing macros with optional user-supplied failure message; + * if not supplied (NULL), generate comparison output in the spirit of + * test-driven development. E.g., "expected 5 but was -3" + * User messages clarify test's purpose in code, encouraging description + * without relying on comments. + * 4) Configurable expected-actual order in generated comparison strings. + * Some prefer `VERIFY(expected, actual)`, others + * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch + * to satifsy both parties, assuming one paradigm per test file. + * (One could #undef and redefine the flag through the file as desired, + * but _why_.) + * Provided as courtesy, per consideration for inclusion in the library + * proper. + * + * Macros: + * + * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order + * FAIL_IF() - check condition + * FAIL_UNLESS() - check _not_ condition + * JSVERIFY() - long-int equality check; prints reason/comparison + * JSVERIFY_NOT() - long-int inequality check; prints + * JSVERIFY_STR() - string equality check; prints + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * ifdef flag: JSVERIFY_EXP_ACT + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_EXP_ACT 1L + + +/*---------------------------------------------------------------------------- + * + * Macro: JSFAILED_AT() + * + * Purpose: + * + * Preface a test failure by printing "*FAILED*" and location to stdout + * Similar to `H5_FAILED(); AT();` from h5test.h + * + * *FAILED* at somefile.c:12 in function_name()... + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSFAILED_AT() { \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_IF() + * + * Purpose: + * + * Make tests more accessible and less cluttered than + * `if (thing == otherthing()) TEST_ERROR` + * paradigm. + * + * The following lines are roughly equivalent: + * + * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) + * `FAIL_IF(myfunc() < 0)` + * + * Prints a generic "FAILED AT" line to stdout and jumps to `error`, + * similar to `TEST_ERROR` in h5test.h + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_IF(condition) \ +if (condition) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_UNLESS() + * + * Purpose: + * + * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", + * e.g., "a != b". + * + * Opposite of FAIL_IF; fails if the given condition is _not_ true. + * + * `FAIL_IF( 5 != my_op() )` + * is equivalent to + * `FAIL_UNLESS( 5 == my_op() )` + * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. + * (see JSVERIFY) + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_UNLESS(condition) \ +if (!(condition)) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_LONG() + * + * Purpose: + * + * Print an failure message for long-int arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:488 in somefunc()... + * forest must be made of trees. + * + * or + * + * *FAILED* at myfile.c:488 in somefunc()... + * ! Expected 425 + * ! Actual 3 + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_LONG(expected, actual, reason) { \ + JSFAILED_AT() \ + if (reason!= NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ + (long)(expected), (long)(actual)); \ + } \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_STR() + * + * Purpose: + * + * Print an failure message for string arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:421 in myfunc()... + * Blue and Red strings don't match! + * + * or + * + * *FAILED* at myfile.c:421 in myfunc()... + * !!! Expected: + * this is my expected + * string + * !!! Actual: + * not what I expected at all + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_STR(expected, actual, reason) { \ + JSFAILED_AT() \ + if ((reason) != NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ + (expected), (actual)); \ + } \ +} + +#ifdef JSVERIFY_EXP_ACT +/* VERIFY rountines with paramter order (, [, ]) + */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY() + * + * Purpose: + * + * Verify that two long integers are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(expected, actual, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY */ + +#if 0 /* UNUSED */ + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_NOT() + * + * Purpose: + * + * Verify that two long integers are _not_ equal. + * If equal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(expected, actual, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ +#endif /* JSVERIFY_NOT unused */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_STR() + * + * Purpose: + * + * Verify that two strings are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(expected, actual, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + + +#else +/* JSVERIFY_EXP_ACT not defined + * + * Repeats macros above, but with actual/expected parameters reversed. + */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY() + * See: JSVERIFY documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(actual, expected, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY */ + +#if 0 /* UNUSED */ + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_NOT() + * See: JSVERIFY_NOT documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(actual, expected, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ +#endif /* JSVERIFY_NOT unused */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_STR() + * See: JSVERIFY_STR documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(actual, expected, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + +#endif /* ifdef/else JSVERIFY_EXP_ACT */ + + +#ifdef H5_HAVE_ROS3_VFD + +#define S3_TEST_PROFILE_NAME "ros3_vfd_test" + +#define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt" +#define S3_TEST_RESOURCE_TEXT_PUBLIC "Poe_Raven.txt" +#define S3_TEST_RESOURCE_MISSING "missing.csv" + +#define S3_TEST_RUN_TIMEOUT 0 /* run tests that might hang */ +#define S3_TEST_MAX_URL_SIZE 256 /* char array size */ + +/* Global variables for aws test profile. + * An attempt is made to read ~/.aws/credentials and ~/.aws/config upon test + * startup -- if unable to open either file or cannot load region, id, and key, + * tests connecting with S3 will not be run + */ +static int s3_test_credentials_loaded = 0; +static char s3_test_aws_region[16] = ""; +static char s3_test_aws_access_key_id[64] = ""; +static char s3_test_aws_secret_access_key[128] = ""; +static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = ""; +static hbool_t s3_test_bucket_defined = FALSE; + +#endif /* H5_HAVE_ROS3_VFD */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_macro_format_credential() + * + * Purpose: + * + * Demonstrate that the macro `S3COMMS_FORMAT_CREDENTIAL` + * performs as expected. + * + * Programmer: Jacob Smith + * 2017-09-19 + * + *---------------------------------------------------------------------------- + */ +static herr_t +test_macro_format_credential(void) +{ + /************************ + * test-local variables * + ************************/ + +#ifdef H5_HAVE_ROS3_VFD + char dest[256]; + const char access[] = "AKIAIOSFODNN7EXAMPLE"; + const char date[] = "20130524"; + const char region[] = "us-east-1"; + const char service[] = "s3"; + const char expected[] = + "AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request"; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("test_macro_format_credential"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + FAIL_IF( S3COMMS_MAX_CREDENTIAL_SIZE < + S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service) ) + + JSVERIFY_STR( expected, dest, NULL ) + + PASSED(); + return 0; +#endif /* H5_HAVE_ROS3_VFD */ + +error: + return -1; + +} /* test_macro_format_credential */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_aws_canonical_request() + * + * Purpose: + * + * Demonstrate the construction of a Canoncial Request (and Signed Headers) + * + * Elided / not yet implemented: + * Query strings + * request "body" + * + * Programmer: Jacob Smith + * 2017-10-04 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_aws_canonical_request(void) +{ + /************************* + * test-local structures * + *************************/ + +#ifdef H5_HAVE_ROS3_VFD + struct header { + const char *name; + const char *value; + }; + + struct testcase { + const char *exp_request; + const char *exp_headers; + const char *verb; + const char *resource; + unsigned int listsize; + struct header list[5]; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "GET\n/some/path.file\n\nhost:somebucket.someserver.somedomain\nrange:bytes=150-244\n\nhost;range\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "host;range", + "GET", + "/some/path.file", + 2, + { {"Range", "bytes=150-244"}, + {"Host", "somebucket.someserver.somedomain"}, + }, + }, + { "HEAD\n/bucketpath/myfile.dat\n\nhost:place.domain\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:19411207T150803Z\n\nhost;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "host;x-amz-content-sha256;x-amz-date", + "HEAD", + "/bucketpath/myfile.dat", + 3, + { {"x-amz-content-sha256", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, + {"host", "place.domain"}, + {"x-amz-date", "19411207T150803Z"}, + } + }, + { "PUT\n/\n\n\n\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "", + "PUT", + "/", + 0, + {{"",""},}, /* unused; satisfies compiler */ + }, + }; /* struct testcase cases[] */ + struct testcase *C = NULL; + char cr_dest[512]; /* canonical request */ + hrb_t *hrb = NULL; /* http request buffer object */ + unsigned int i = 0; /* looping/indexing */ + unsigned int j = 0; /* looping/indexing */ + hrb_node_t *node = NULL; /* http headers list pointer */ + unsigned int n_cases = 3; + char sh_dest[64]; /* signed headers */ +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("test_aws_canonical_request"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < n_cases; i++) { + /* pre-test bookkeeping + */ + C = &cases[i]; + for (j = 0; j < 256; j++) { cr_dest[j] = 0; } /* zero request buffer */ + for (j = 0; j < 64; j++) { sh_dest[j] = 0; } /* zero headers buffer */ + + /* create HTTP request object with given verb, resource/path + */ + hrb = H5FD_s3comms_hrb_init_request(C->verb, + C->resource, + "HTTP/1.1"); + HDassert(hrb->body == NULL); + + /* Create headers list from test case input + */ + for (j = 0; j < C->listsize; j++) { + FAIL_IF( FAIL == + H5FD_s3comms_hrb_node_set( + &node, + C->list[j].name, + C->list[j].value)); + } + + hrb->first_header = node; + + /* test + */ + JSVERIFY( SUCCEED, + H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, hrb), + " unable to compose canonical request" ) + JSVERIFY_STR( C->exp_headers, sh_dest, NULL ) + JSVERIFY_STR( C->exp_request, cr_dest, NULL ) + + /* tear-down + */ + while (node != NULL) + FAIL_IF( FAIL == + H5FD_s3comms_hrb_node_set(&node, node->name, NULL)); + HDassert(NULL == node); + FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb)); + HDassert(NULL == hrb); + + } /* for each test case */ + + /*************** + * ERROR CASES * + ***************/ + + /* malformed hrb and/or node-list + */ + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, NULL), + "http request object cannot be null" ) + + hrb = H5FD_s3comms_hrb_init_request("GET", "/", "HTTP/1.1"); + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(NULL, sh_dest, hrb), + "canonical request destination cannot be NULL" ) + + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, NULL, hrb), + "signed headers destination cannot be null" ) + + FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb) ) + HDassert( NULL == hrb ); + + PASSED(); + return 0; + +error: + + if (node != NULL) { + while (node != NULL) + (void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL); + HDassert( node == NULL ); + } + if (hrb != NULL) + (void)H5FD_s3comms_hrb_destroy(&hrb); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_aws_canonical_request */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_bytes_to_hex + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_bytes_to_hex()`. + * + * Return: + * + * Success: 0 + * Failure: -1 + * + * Programmer: Jacob Smith + * 2017-09-14 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_bytes_to_hex(void) +{ + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char exp[17]; /* in size * 2 + 1 for null terminator */ + const unsigned char in[8]; + size_t size; + hbool_t lower; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "52F3000C9A", + {82,243,0,12,154}, + 5, + FALSE, + }, + { "009a0cf3005200", /* lowercase alphas */ + {0,154,12,243,0,82,0}, + 7, + TRUE, + }, + { "", + {17,63,26,56}, + 0, + FALSE, /* irrelevant */ + }, + }; + int i = 0; + int n_cases = 3; + char out[17]; + int out_off = 0; + + + + TESTING("bytes-to-hex"); + + for (i = 0; i < n_cases; i++) { + for (out_off = 0; out_off < 17; out_off++) { + out[out_off] = 0; + } + + JSVERIFY( SUCCEED, + H5FD_s3comms_bytes_to_hex(out, + cases[i].in, + cases[i].size, + cases[i].lower), + NULL ) + + JSVERIFY_STR(cases[i].exp, out, NULL) + } + + /* dest cannot be null + */ + JSVERIFY( FAIL, + H5FD_s3comms_bytes_to_hex( + NULL, + (const unsigned char *)"nada", + 5, + FALSE), + "destination cannot be null" ) + + PASSED(); + return 0; + +error: + return -1; + +} /* test_bytes_to_hex */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_hrb_init_request() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_hrb_init_request()` + * + * Programmer: Jacob Smith + * 2017-09-20 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_hrb_init_request(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char msg[64]; + const char *verb; + const char *resource; + const char *exp_res; + const char *version; + hbool_t ret_null; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "get HTTP request just as we provided", + "GET", + "/path/to/some/file", + "/path/to/some/file", + "HTTP/1.1", + FALSE, + }, + { "null verb substitues to GET", + NULL, + "/MYPATH/MYFILE.tiff", + "/MYPATH/MYFILE.tiff", + "HTTP/1.1", + FALSE, + }, + { "demonstrate non-GET verb", + "HEAD", + "/MYPATH/MYFILE.tiff", + "/MYPATH/MYFILE.tiff", + "HTTP/1.1", + FALSE, + }, + { "slash prepented to resource path, if necessary", + NULL, + "MYPATH/MYFILE.tiff", + "/MYPATH/MYFILE.tiff", + NULL, + FALSE, + }, + { "null resource path causes problem", + "GET", + NULL, + NULL, + NULL, + TRUE, + }, + }; + struct testcase *C = NULL; + unsigned int i = 0; + unsigned int ncases = 5; + hrb_t *req = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("hrb_init_request"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < ncases; i++) { + C = &cases[i]; + req = H5FD_s3comms_hrb_init_request(C->verb, + C->resource, + C->version); + if (cases[i].ret_null == TRUE) { + FAIL_IF( req != NULL ); + } else { + FAIL_IF( req == NULL ); + JSVERIFY( S3COMMS_HRB_MAGIC, req->magic, NULL ) + if (C->verb == NULL) { + JSVERIFY_STR( "GET", req->verb, NULL ) + } else { + JSVERIFY_STR( req->verb, C->verb, NULL ) + } + JSVERIFY_STR( "HTTP/1.1", req->version, NULL ) + JSVERIFY_STR( C->exp_res, req->resource, NULL ) + FAIL_IF( req->first_header != NULL ); + FAIL_IF( req->body != NULL ); + JSVERIFY( 0, req->body_len, NULL ) + JSVERIFY( SUCCEED, H5FD_s3comms_hrb_destroy(&req), + "unable to destroy hrb_t" ) + FAIL_IF( NULL != req ); /* should annull pointer as well as free */ + } + + } /* for each testcase */ + + PASSED(); + return 0; + +error: + (void)H5FD_s3comms_hrb_destroy(&req); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_hrb_init_request */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_hrb_node_set() + * + * Purpose: + * + * Test operations on hrb_node_t structure + * + * Programmer: Jacob Smith + * 2017-09-22 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_hrb_node_set(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /************************* + * test-local structures * + *************************/ + + /* bundle of name/value representing an hrb_node_t + */ + typedef struct node_mock_t { + const char *name; + const char *value; + } node_mock_t; + + /* bundle for a testcase + * + * `message` + * purpose of the testcase + * + * `delta` + * container for name and value strings to pass into node-set function + * to to modify the list. + * + * `returned` + * expected return value of node-set function + * + * `given` + * `expected` + * string arrays representing the state of the list before and after + * modification. The number of strings must be even, with each name + * paired to a value. `NULL` terminates the list, with `{NULL}` + * representing the empty list. + */ + typedef struct testcase { + const char *message; + node_mock_t delta; + herr_t returned; + const char *given[11]; /* name/value pairs in array; NULL sentinel */ + const char *expected[11]; + } testcase; + + /************************ + * test-local variables * + ************************/ + + testcase cases[] = { + { "cannot remove node from null list", + { "Host", NULL }, + FAIL, + {NULL}, + {NULL}, + }, + { "cannot create list with NULL field name", + { NULL, "somevalue" }, + FAIL, + {NULL}, + {NULL}, + }, + { "create a new list", + { "Host", "somevalue" }, + SUCCEED, + {NULL}, + { "Host", "somevalue", + NULL, + }, + }, + { "insert new node at head list", + { "Host", "somevalue" }, + SUCCEED, + { "Range", "bytes=20-40", + NULL, + }, + { "Host", "somevalue", + "Range", "bytes=20-40", + NULL, + }, + }, + { "append new node at list end", + { "x-amz-date", "somevalue" }, + SUCCEED, + { "Range", "bytes=20-40", + NULL, + }, + { "Range", "bytes=20-40", + "x-amz-date", "somevalue", + NULL, + }, + }, + { "insert new node inside list", + { "Intermediary", "somevalue" }, + SUCCEED, + { "Host", "somehost" , + "Range", "bytes=20-40", + NULL, + }, + { "Host", "somehost", + "Intermediary", "somevalue", + "Range", "bytes=20-40", + NULL, + }, + }, + { "modify node", + { "Range", "bytes=40-80" }, + SUCCEED, + { "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + { "Host", "somehost", + "Range", "bytes=40-80", + NULL, + }, + }, + { "modify node with new case", + { "RANGE", "bytes=40-80" }, + SUCCEED, + { "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + { "Host", "somehost", + "RANGE", "bytes=40-80", + NULL, + }, + }, + { "cannot add node with no name", + { NULL, "bytes=40-80" }, + FAIL, + { "Host", "somehost", + NULL, + }, + { "Host", "somehost", + NULL, + }, + }, + { "add node with 'empty' name", + { "", "bytes=40-80" }, + SUCCEED, + { "Host", "somehost", + NULL, + }, + { "", "bytes=40-80", + "Host", "somehost", + NULL, + }, + }, + { "remove node from end of list", + { "Host", NULL }, + SUCCEED, + { "Date", "Thr, 25 Jan 2018", + "Host", "somehost", + NULL, + }, + { "Date", "Thr, 25 Jan 2018", + NULL, + }, + }, + { "remove node from middle of list", + { "Host", NULL }, + SUCCEED, + { "Date", "Thr, 25 Jan 2018", + "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + { "Date", "Thr, 25 Jan 2018", + "Range", "bytes=20-40", + NULL, + }, + }, + { "remove node from start of list", + { "Date", NULL }, + SUCCEED, + { "Date", "Thr, 25 Jan 2018", + "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + { "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + }, + { "remove only node in list", + { "Date", NULL }, + SUCCEED, + { "Date", "Thr, 25 Jan 2018", + NULL, + }, + { NULL, + }, + }, + { "attempt to remove absent node fails", + { "Host", NULL }, + FAIL, + { "Date", "Thr, 25 Jan 2018", + "Range", "bytes=20-40", + NULL, + }, + { "Date", "Thr, 25 Jan 2018", + "Range", "bytes=20-40", + NULL, + }, + }, + { "removal is case-insensitive", + { "hOsT", NULL }, + SUCCEED, + { "Date", "Thr, 25 Jan 2018", + "Host", "somehost", + "Range", "bytes=20-40", + NULL, + }, + { "Date", "Thr, 25 Jan 2018", + "Range", "bytes=20-40", + NULL, + }, + }, + }; + unsigned testcases_count = 16; + unsigned test_i = 0; + + hrb_node_t *list = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("test_hrb_node_t"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (test_i = 0; test_i < testcases_count; test_i++) { + const hrb_node_t *node = NULL; + const testcase *test = &(cases[test_i]); + unsigned mock_i = 0; + + /********* + * SETUP * + *********/ + + for (mock_i = 0; test->given[mock_i] != NULL; mock_i += 2) { + const char *name = test->given[mock_i]; + const char *valu = test->given[mock_i+1]; + + FAIL_IF( SUCCEED != + H5FD_s3comms_hrb_node_set(&list, name, valu) ) + } + /******** + * TEST * + ********/ + + /* perform modification on list + */ + JSVERIFY( test->returned, + H5FD_s3comms_hrb_node_set(&list, + test->delta.name, + test->delta.value), + test->message ) + + + /* verify resulting list + */ + node = list; + mock_i = 0; + while (test->expected[mock_i] != NULL && node != NULL) { + const char *name = test->expected[mock_i]; + const char *valu = test->expected[mock_i+1]; + + JSVERIFY_STR( name, node->name, NULL ) + JSVERIFY_STR( valu, node->value, NULL ) + + mock_i += 2; + node = node->next; + } + FAIL_IF( test->expected[mock_i] != NULL ) + FAIL_IF( node != NULL ) + + /************ + * TEARDOWN * + ************/ + + while (list != NULL) { + FAIL_IF( SUCCEED != + H5FD_s3comms_hrb_node_set(&list, list->name, NULL) ) + } + } + + PASSED(); + return 0; + +error: + while (list != NULL) + (void)H5FD_s3comms_hrb_node_set(&list, list->name, NULL); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_hrb_node_t */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_HMAC_SHA256() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_HMAC_SHA256()` + * + * Programmer: Jacob Smith + * 2017-09-19 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_HMAC_SHA256(void) +{ + + /************************* + * test-local structures * + *************************/ + +#ifdef H5_HAVE_ROS3_VFD + struct testcase { + herr_t ret; /* SUCCEED/FAIL expected from call */ + const unsigned char key[SHA256_DIGEST_LENGTH]; + size_t key_len; + const char *msg; + size_t msg_len; + const char *exp; /* not used if ret == FAIL */ + size_t dest_size; /* if 0, `dest` is not malloc'd */ + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { SUCCEED, + { 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49, + 0x18, 0xf1, 0xfd, 0x43, 0x3a, 0xdd, 0x87, 0xc7, + 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30, 0xc1, 0xfb, + 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78, + }, + SHA256_DIGEST_LENGTH, + "AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972", + HDstrlen("AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972"), + "f0e8bdb87c964420e857bd35b5d6ed310bd44f0170aba48dd91039c6036bdb41", + SHA256_DIGEST_LENGTH * 2 + 1, /* +1 for null terminator */ + }, + { SUCCEED, + {'J','e','f','e'}, + 4, + "what do ya want for nothing?", + 28, + "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843", + SHA256_DIGEST_LENGTH * 2 + 1, + }, + { FAIL, + "DOESN'T MATTER", + 14, + "ALSO IRRELEVANT", + 15, + NULL, + 0, /* dest -> null, resulting in immediate error */ + }, + }; + char *dest = NULL; + int i = 0; + int n_cases = 3; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("HMAC_SHA256"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < n_cases; i++) { + if (cases[i].dest_size == 0) { + dest = NULL; + } else { + dest = (char *)HDmalloc(sizeof(char) * cases[i].dest_size); + HDassert(dest != NULL); + } + + JSVERIFY( cases[i].ret, + H5FD_s3comms_HMAC_SHA256( + cases[i].key, + cases[i].key_len, + cases[i].msg, + cases[i].msg_len, + dest), + cases[i].msg ); + if (cases[i].ret == SUCCEED) { +#ifdef VERBOSE + if (0 != + strncmp(cases[i].exp, + dest, + HDstrlen(cases[i].exp))) + { + /* print out how wrong things are, and then fail + */ + dest = (char *)realloc(dest, cases[i].dest_size + 1); + HDassert(dest != NULL); + dest[cases[i].dest_size] = 0; + HDfprintf(stdout, + "ERROR:\n!!! \"%s\"\n != \"%s\"\n", + cases[i].exp, + dest); + TEST_ERROR; + } +#else + /* simple pass/fail test + */ + JSVERIFY( 0, + strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), + NULL); +#endif + } + free(dest); + } + + PASSED(); + return 0; + +error: + free(dest); + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_HMAC_SHA256 */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_nlowercase() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_nlowercase()` + * + * Programmer: Jacob Smith + * 2017-19-18 + * + *---------------------------------------------------------------------------- + */ +static herr_t +test_nlowercase(void) +{ + /************************* + * test-local structures * + *************************/ + +#ifdef H5_HAVE_ROS3_VFD + struct testcase { + const char *in; + size_t len; + const char *exp; + }; + + /************************ + * test-local variables * + ************************/ + + /* any character after in exp on or after exp[len] is undefined. + * in this test, kept as the null character for simplicity. + */ + struct testcase cases[] = { + { "HALlEluJAh", + 6, + "hallel", + }, + { "all\0 lower", + 10, + "all\0 lower", + }, + { "to meeeeeee", + 0, + "", + }, + }; + char *dest = NULL; + int i = 0; + int n_cases = 3; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("nlowercase"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < n_cases; i++) { + dest = (char *)HDmalloc(sizeof(char) * 16); + + JSVERIFY( SUCCEED, + H5FD_s3comms_nlowercase(dest, + cases[i].in, + cases[i].len), + cases[i].in ) + if (cases[i].len > 0) { + JSVERIFY( 0, strncmp(dest, cases[i].exp, cases[i].len), NULL ) + } + free(dest); + } + + JSVERIFY( FAIL, + H5FD_s3comms_nlowercase(NULL, + cases[0].in, + cases[0].len), + "null distination should fail" ) + + PASSED(); + return 0; + +error: + free(dest); + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_nlowercase */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_parse_url() + * + * Programmer: Jacob Smith + * 2017-11-?? + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_parse_url(void) +{ + /********************* + * test-local macros * + *********************/ + + /************************* + * test-local structures * + *************************/ + +#ifdef H5_HAVE_ROS3_VFD + typedef struct { + const char *scheme; + const char *host; + const char *port; + const char *path; + const char *query; + } const_purl_t; + + struct testcase { + const char *url; + herr_t exp_ret; /* expected return; */ + /* if FAIL, `expected` is unused */ + const_purl_t expected; + const char *msg; + }; + + /************************ + * test-local variables * + ************************/ + + parsed_url_t *purl = NULL; + unsigned int i = 0; + unsigned int ncases = 15; + struct testcase cases[] = { + { NULL, + FAIL, + { NULL, NULL, NULL, NULL, NULL }, + "null url", + }, + { "", + FAIL, + { NULL, NULL, NULL, NULL, NULL }, + "empty url", + }, + { "ftp://[1000:4000:0002:2010]", + SUCCEED, + { "ftp", + "[1000:4000:0002:2010]", + NULL, + NULL, + NULL, + }, + "IPv6 ftp and empty path (root)", + }, + { "ftp://[1000:4000:0002:2010]:2040", + SUCCEED, + { "ftp", + "[1000:4000:0002:2010]", + "2040", + NULL, + NULL, + }, + "root IPv6 ftp with port", + }, + { "http://some.domain.org:9000/path/to/resource.txt", + SUCCEED, + { "http", + "some.domain.org", + "9000", + "path/to/resource.txt", + NULL, + }, + "without query", + }, + { "https://domain.me:00/file.txt?some_params unchecked", + SUCCEED, + { "https", + "domain.me", + "00", + "file.txt", + "some_params unchecked", + }, + "with query", + }, + { "ftp://domain.com/", + SUCCEED, + { "ftp", + "domain.com", + NULL, + NULL, + NULL, + }, + "explicit root w/out port", + }, + { "ftp://domain.com:1234/", + SUCCEED, + { "ftp", + "domain.com", + "1234", + NULL, + NULL, + }, + "explicit root with port", + }, + { "ftp://domain.com:1234/file?", + FAIL, + { NULL, NULL, NULL, NULL, NULL, }, + "empty query is invalid", + }, + { "ftp://:1234/file", + FAIL, + { NULL, NULL, NULL, NULL, NULL, }, + "no host", + }, + { "h&r block", + FAIL, + { NULL, NULL, NULL, NULL, NULL, }, + "no scheme (bad URL)", + }, + { "http://domain.com?a=b&d=b", + SUCCEED, + { "http", + "domain.com", + NULL, + NULL, + "a=b&d=b", + }, + "QUERY with implict PATH", + }, + { "http://[5]/path?a=b&d=b", + SUCCEED, + { "http", + "[5]", + NULL, + "path", + "a=b&d=b", + }, + "IPv6 extraction is really dumb", + }, + { "http://[1234:5678:0910:1112]:port/path", + FAIL, + { NULL, NULL, NULL, NULL, NULL, }, + "non-decimal PORT (port)", + }, + { "http://mydomain.com:01a3/path", + FAIL, + { NULL, NULL, NULL, NULL, NULL, }, + "non-decimal PORT (01a3)", + }, + }; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("url-parsing functionality"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + /********* + * TESTS * + *********/ + + for (i = 0; i < ncases; i++) { + HDassert( purl == NULL ); + + JSVERIFY( cases[i].exp_ret, + H5FD_s3comms_parse_url(cases[i].url, &purl), + cases[i].msg ) + + if (cases[i].exp_ret == FAIL) { + /* on FAIL, `purl` should be untouched--remains NULL */ + FAIL_UNLESS( purl == NULL ) + } else { + /* on SUCCEED, `purl` should be set */ + FAIL_IF( purl == NULL ) + + if (cases[i].expected.scheme != NULL) { + FAIL_IF( NULL == purl->scheme ) + JSVERIFY_STR( cases[i].expected.scheme, + purl->scheme, + cases[i].msg ) + } else { + FAIL_UNLESS( NULL == purl->scheme ) + } + + if (cases[i].expected.host != NULL) { + FAIL_IF( NULL == purl->host ) + JSVERIFY_STR( cases[i].expected.host, + purl->host, + cases[i].msg ) + } else { + FAIL_UNLESS( NULL == purl->host ) + } + + if (cases[i].expected.port != NULL) { + FAIL_IF( NULL == purl->port ) + JSVERIFY_STR( cases[i].expected.port, + purl->port, + cases[i].msg ) + } else { + FAIL_UNLESS( NULL == purl->port ) + } + + if (cases[i].expected.path != NULL) { + FAIL_IF( NULL == purl->path ) + JSVERIFY_STR( cases[i].expected.path, + purl->path, + cases[i].msg ) + } else { + FAIL_UNLESS( NULL == purl->path ) + } + + if (cases[i].expected.query != NULL) { + FAIL_IF( NULL == purl->query ) + JSVERIFY_STR( cases[i].expected.query, + purl->query, + cases[i].msg ) + } else { + FAIL_UNLESS( NULL == purl->query ) + } + } /* if parse-url return SUCCEED/FAIL */ + + /* per-test cleanup + * well-behaved, even if `purl` is NULL + */ + FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) ) + purl = NULL; + + } /* for each testcase */ + + PASSED(); + return 0; + +error: + /*********** + * cleanup * + ***********/ + (void)H5FD_s3comms_free_purl(purl); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_parse_url */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_percent_encode_char() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_percent_encode_char()` + * + * Return: + * + * Success: 0 + * Failure: -1 + * + * Programmer: Jacob Smith + * 2017-09-14 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_percent_encode_char(void) +{ + /************************* + * test-local structures * + *************************/ + +#ifdef H5_HAVE_ROS3_VFD + struct testcase { + const char c; + const char *exp; + size_t exp_len; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + {'$', "%24", 3}, /* u+0024 dollar sign */ + {' ', "%20", 3}, /* u+0020 space */ + {'^', "%5E", 3}, /* u+0094 carat */ + {'/', "%2F", 3}, /* u+002f solidus (forward slash) */ + /* {??, "%C5%8C", 6},*/ /* u+014c Latin Capital Letter O with Macron */ + /* Not included because it is multibyte "wide" character that poses */ + /* issues both in the underlying function and in being written in */ + /* this file. */ + /* {'¢', "%C2%A2", 6}, */ /* u+00a2 cent sign */ + /* above works, but complains about wide character overflow */ + /* Elide for now, until it is determined (a) unnecessary or */ + /* (b) requiring signature change to accommodate wide characters */ + {'\0', "%00", 3}, /* u+0000 null */ + }; + char dest[13]; + size_t dest_len = 0; + int i = 0; + int n_cases = 5; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("percent encode characters"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < n_cases; i++) { + JSVERIFY( SUCCEED, + H5FD_s3comms_percent_encode_char( + dest, + (const unsigned char)cases[i].c, + &dest_len), + NULL ) + JSVERIFY(cases[i].exp_len, dest_len, NULL ) + JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL ) + JSVERIFY_STR( cases[i].exp, dest, NULL ) + } + + JSVERIFY( FAIL, + H5FD_s3comms_percent_encode_char( + NULL, + (const unsigned char)'^', + &dest_len), + NULL ) + + PASSED(); + return 0; + +error: + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_percent_encode_char */ + + +/*--------------------------------------------------------------------------- + * Function: test_s3r_open() + * + * Programmer: Jacob Smith 2018-01-24 + * + * Changes: None + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_s3r_get_filesize(void) +{ +#ifdef H5_HAVE_ROS3_VFD + + /************************ + * test-local variables * + ************************/ + + char url_raven[S3_TEST_MAX_URL_SIZE]; + s3r_t *handle = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("s3r_get_filesize"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + /* setup -- compose url to target resource + */ + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_raven, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + s3_test_bucket_url, + S3_TEST_RESOURCE_TEXT_PUBLIC) ); + + JSVERIFY( 0, H5FD_s3comms_s3r_get_filesize(NULL), + "filesize of the null handle should be 0" ) + + handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL); + FAIL_IF( handle == NULL ) + + JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL ) + + + FAIL_IF( SUCCEED != H5FD_s3comms_s3r_close(handle) ) + + PASSED(); + return 0; + +error: + if (handle != NULL) + (void)H5FD_s3comms_s3r_close(handle); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_s3r_get_filesize */ + + +/*--------------------------------------------------------------------------- + * Function: test_s3r_open() + * + * Programmer: Jacob Smith 2018-01-?? + * + * Changes: None + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_s3r_open(void) +{ +#ifdef H5_HAVE_ROS3_VFD + + /************************ + * test-local variables * + ************************/ + + char url_missing[S3_TEST_MAX_URL_SIZE]; + char url_raven[S3_TEST_MAX_URL_SIZE]; + char url_raven_badport[S3_TEST_MAX_URL_SIZE]; + char url_shakespeare[S3_TEST_MAX_URL_SIZE]; + unsigned char signing_key[SHA256_DIGEST_LENGTH]; + struct tm *now = NULL; + char iso8601now[ISO8601_SIZE]; + s3r_t *handle = NULL; + hbool_t curl_ready = FALSE; + parsed_url_t *purl = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("s3r_open"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + if (s3_test_credentials_loaded == 0) { + SKIPPED(); + puts(" s3 credentials are not loaded"); + fflush(stdout); + return 0; + } + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + /****************** + * PRE-TEST SETUP * + ******************/ + + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_shakespeare, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + s3_test_bucket_url, + S3_TEST_RESOURCE_TEXT_RESTRICTED) ); + + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_missing, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + s3_test_bucket_url, + S3_TEST_RESOURCE_MISSING) ); + + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_raven, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + s3_test_bucket_url, + S3_TEST_RESOURCE_TEXT_PUBLIC) ); + + /* Set given bucket url with invalid/inactive port number for badport. + * Note, this sort of micro-management of parsed_url_t is not advised + */ + FAIL_IF( FAIL == H5FD_s3comms_parse_url(s3_test_bucket_url, &purl) ) + if (purl->port == NULL) { + purl->port = (char *)H5MM_malloc(sizeof(char) * 5); + FAIL_IF( purl->port == NULL ); + FAIL_IF( 5 < HDsnprintf(purl->port, 5, "9000") ) + } else if (strcmp(purl->port, "9000") != 0) { + FAIL_IF( 5 < HDsnprintf(purl->port, 5, "9000") ) + } else { + FAIL_IF( 5 < HDsnprintf(purl->port, 5, "1234") ) + } + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_raven_badport, + S3_TEST_MAX_URL_SIZE, + "%s://%s:%s/%s", + purl->scheme, + purl->host, + purl->port, + S3_TEST_RESOURCE_TEXT_PUBLIC) ); + + curl_global_init(CURL_GLOBAL_DEFAULT); + curl_ready = TRUE; + + now = gmnow(); + FAIL_IF( now == NULL ) + FAIL_IF( ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1) ); + + /* It is desired to have means available to verify that signing_key + * was set successfully and to an expected value. + */ + FAIL_IF( FAIL == + H5FD_s3comms_signing_key( + signing_key, + (const char *)s3_test_aws_secret_access_key, + (const char *)s3_test_aws_region, + (const char *)iso8601now) ); + + /************************* + * OPEN NONEXISTENT FILE * + *************************/ + + /* attempt anonymously + */ + handle = H5FD_s3comms_s3r_open(url_missing, NULL, NULL, NULL); + FAIL_IF( handle != NULL ); + + /* attempt with authentication + */ + handle = H5FD_s3comms_s3r_open( + url_missing, + (const char *)s3_test_aws_region, + (const char *)s3_test_aws_access_key_id, + (const unsigned char *)signing_key); + FAIL_IF( handle != NULL ); + + /************************* + * INACTIVE PORT ON HOST * + *************************/ + +#if S3_TEST_RUN_TIMEOUT +printf("Opening on inactive port may hang for a minute; waiting for timeout\n"); + handle = H5FD_s3comms_s3r_open(url_raven_badport, NULL, NULL, NULL); + FAIL_IF( handle != NULL ); +#endif + + /******************************* + * INVALID AUTHENTICATION INFO * + *******************************/ + + /* anonymous access on restricted file + */ + handle = H5FD_s3comms_s3r_open(url_shakespeare, NULL, NULL, NULL); + FAIL_IF( handle != NULL ); + + /* passed in a bad ID + */ + handle = H5FD_s3comms_s3r_open( + url_shakespeare, + (const char *)s3_test_aws_region, + "I_MADE_UP_MY_ID", + (const unsigned char *)signing_key); + FAIL_IF( handle != NULL ); + + /* using an invalid signing key + */ + handle = H5FD_s3comms_s3r_open( + url_shakespeare, + (const char *)s3_test_aws_region, + (const char *)s3_test_aws_access_key_id, + (const unsigned char *)EMPTY_SHA256); + FAIL_IF( handle != NULL ); + + /******************************* + * SUCCESSFUL OPEN (AND CLOSE) * + *******************************/ + + /* anonymous + */ + handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL); + FAIL_IF( handle == NULL ); + JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), + "did not get expected filesize" ) + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_close(handle), + "unable to close file" ) + handle = NULL; + + /* using authentication on anonymously-accessible file? + */ + handle = H5FD_s3comms_s3r_open( + url_raven, + (const char *)s3_test_aws_region, + (const char *)s3_test_aws_access_key_id, + (const unsigned char *)signing_key); + FAIL_IF( handle == NULL ); + JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL ) + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_close(handle), + "unable to close file" ) + handle = NULL; + + /* authenticating + */ + handle = H5FD_s3comms_s3r_open( + url_shakespeare, + (const char *)s3_test_aws_region, + (const char *)s3_test_aws_access_key_id, + (const unsigned char *)signing_key); + FAIL_IF( handle == NULL ); + JSVERIFY( 5458199, H5FD_s3comms_s3r_get_filesize(handle), NULL ) + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_close(handle), + "unable to close file" ) + handle = NULL; + + + + curl_global_cleanup(); + curl_ready = FALSE; + + FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) ) + purl = NULL; + + PASSED(); + return 0; +error: + /*********** + * cleanup * + ***********/ + + if (handle != NULL) + H5FD_s3comms_s3r_close(handle); + if (purl != NULL) + H5FD_s3comms_free_purl(purl); + if (curl_ready == TRUE) + curl_global_cleanup(); + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_s3r_open */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_s3r_read() + * + * Purpose: + * + * Specify and demonstrate the use and life cycle of an S3 Request handle + * `s3r_t`, through its related functions. + * + * H5FD_s3comms_s3r_open + * H5FD_s3comms_s3r_getsize << called by open() _only_ + * H5FD_s3comms_s3r_read << called by getsize(), multiple times working + * H5FD_s3comms_s3r_close + * + * Shows most basic curl interation. + * + * Programmer: Jacob Smith + * 2017-10-06 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_s3r_read(void) +{ +#ifdef H5_HAVE_ROS3_VFD + +#define S3COMMS_TEST_BUFFER_SIZE 256 + + /************************ + * test-local variables * + ************************/ + + char url_raven[S3_TEST_MAX_URL_SIZE]; + char buffer[S3COMMS_TEST_BUFFER_SIZE]; + s3r_t *handle = NULL; + hbool_t curl_ready = FALSE; + unsigned int i = 0; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("test_s3r_read"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + /* + * initial setup + */ + if (FALSE == s3_test_bucket_defined) { + SKIPPED(); + puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + fflush(stdout); + return 0; + } + + curl_global_init(CURL_GLOBAL_DEFAULT); + curl_ready = TRUE; + FAIL_IF( S3_TEST_MAX_URL_SIZE < + HDsnprintf(url_raven, + S3_TEST_MAX_URL_SIZE, + "%s/%s", + s3_test_bucket_url, + S3_TEST_RESOURCE_TEXT_PUBLIC) ); + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /* open file + */ + handle = H5FD_s3comms_s3r_open(url_raven, NULL, NULL, NULL); + FAIL_IF( handle == NULL ) + JSVERIFY( 6464, H5FD_s3comms_s3r_get_filesize(handle), NULL ) + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /********************** + * read start of file * + **********************/ + + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)0, + (size_t)118, + buffer), + NULL ) + JSVERIFY_STR ( + "Once upon a midnight dreary, while I pondered, weak and weary,\n" \ + "Over many a quaint and curious volume of forgotten lore", + buffer, + NULL ) + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /************************ + * read arbitrary range * + ************************/ + + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)2540, + (size_t)54, + buffer), + NULL ) + JSVERIFY_STR( "the grave and stern decorum of the countenance it wore", + buffer, + NULL ) + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /********************** + * read one character * + **********************/ + + JSVERIFY(SUCCEED, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)2540, + (size_t)1, + buffer), + NULL ) + JSVERIFY_STR( "t", buffer, NULL ) + + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /*************** + * read to EoF * + ***************/ + + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)6370, + (size_t)0, + buffer), + NULL ) + JSVERIFY( 0, + strncmp(buffer, + "And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n", + 94), + buffer ) + + for (i = 0; i < S3COMMS_TEST_BUFFER_SIZE; i++) + buffer[i] = '\0'; + + /***************** + * read past eof * + *****************/ + + JSVERIFY( FAIL, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)6400, + (size_t)100, /* 6400+100 > 6464 */ + buffer), + NULL ) + JSVERIFY( 0, strcmp("", buffer), NULL ) + + /************************ + * read starts past eof * + ************************/ + + JSVERIFY( FAIL, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)1200699, /* 1200699 > 6464 */ + (size_t)100, + buffer), + NULL ) + JSVERIFY( 0, strcmp("", buffer), NULL ) + + /********************** + * read starts on eof * + **********************/ + + JSVERIFY( FAIL, + H5FD_s3comms_s3r_read( + handle, + (haddr_t)6464, + (size_t)0, + buffer), + NULL ) + JSVERIFY( 0, strcmp("", buffer), NULL ) + + /************* + * TEAR DOWN * + *************/ + + JSVERIFY( SUCCEED, + H5FD_s3comms_s3r_close(handle), + "unable to close file" ) + handle = NULL; + + curl_global_cleanup(); + curl_ready = FALSE; + + PASSED(); + return 0; + +error: + /*********** + * cleanup * + ***********/ + + if (handle != NULL) + H5FD_s3comms_s3r_close(handle); + + if (curl_ready == TRUE) + curl_global_cleanup(); + + return -1; + +#undef S3COMMS_TEST_BUFFER_SIZE +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_s3r_read */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_signing_key() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_signing_key()` + * + * More test cases would be a very good idea. + * + * Programmer: Jacob Smith + * 2017-09-18 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_signing_key(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char *region; + const char *secret_key; + const char *when; + unsigned char exp[SHA256_DIGEST_LENGTH]; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "us-east-1", + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + "20130524T000000Z", + { 0xdb, 0xb8, 0x93, 0xac, 0xc0, 0x10, 0x96, 0x49, + 0x18, 0xf1, 0xfd, 0x43, 0x3a, 0xdd, 0x87, 0xc7, + 0x0e, 0x8b, 0x0d, 0xb6, 0xbe, 0x30, 0xc1, 0xfb, + 0xea, 0xfe, 0xfa, 0x5e, 0xc6, 0xba, 0x83, 0x78, + }, + }, + }; + int i = 0; + unsigned char *key = NULL; + int ncases = 1; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("signing_key"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + for (i = 0; i < ncases; i++) { + key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \ + SHA256_DIGEST_LENGTH); + HDassert(key != NULL); + + JSVERIFY( SUCCEED, + H5FD_s3comms_signing_key( + key, + cases[i].secret_key, + cases[i].region, + cases[i].when), + NULL ) + + JSVERIFY( 0, + strncmp((const char *)cases[i].exp, + (const char *)key, + SHA256_DIGEST_LENGTH), + cases[i].exp ) + + free(key); + key = NULL; + } + + + /*************** + * ERROR CASES * + ***************/ + + key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \ + SHA256_DIGEST_LENGTH); + HDassert(key != NULL); + + JSVERIFY( FAIL, + H5FD_s3comms_signing_key( + NULL, + cases[0].secret_key, + cases[0].region, + cases[0].when), + "destination cannot be NULL" ) + + JSVERIFY( FAIL, + H5FD_s3comms_signing_key( + key, + NULL, + cases[0].region, + cases[0].when), + "secret key cannot be NULL" ) + + JSVERIFY( FAIL, + H5FD_s3comms_signing_key( + key, + cases[0].secret_key, + NULL, + cases[0].when), + "aws region cannot be NULL" ) + + JSVERIFY( FAIL, + H5FD_s3comms_signing_key( + key, + cases[0].secret_key, + cases[0].region, + NULL), + "time string cannot be NULL" ) + + free(key); + key = NULL; + + PASSED(); + return 0; + +error: + if (key != NULL) { + free(key); + } + + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_signing_key */ + + +/*--------------------------------------------------------------------------- + * + * Function: test_tostringtosign() + * + * Purpose: + * + * Verify that we can get the "string to sign" from a Canonical Request and + * related information. + * + * Demonstrate failure cases. + * + * Return: + * + * Success: 0 + * Failure: -1 + * + * Programmer: Jacob Smith + * 2017-09-13 + * + *--------------------------------------------------------------------------- + */ +static herr_t +test_tostringtosign(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /************************ + * test-local variables * + ************************/ + + const char canonreq[] = "GET\n/test.txt\n\nhost:examplebucket.s3.amazonaws.com\nrange:bytes=0-9\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:20130524T000000Z\n\nhost;range;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + const char iso8601now[] = "20130524T000000Z"; + const char region[] = "us-east-1"; + char s2s[512]; +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("s3comms tostringtosign"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + puts(" ROS3 VFD is not enabled"); + fflush(stdout); + return 0; +#else + JSVERIFY( SUCCEED, + H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, region), + "unable to create string to sign" ) + + JSVERIFY_STR( "AWS4-HMAC-SHA256\n20130524T000000Z\n20130524/us-east-1/s3/aws4_request\n7344ae5b7ee6c3e7e6b0fe0640412a37625d1fbfff95c48bbb2dc43964946972", + s2s, NULL ) + + JSVERIFY( FAIL, + H5FD_s3comms_tostringtosign(s2s, NULL, iso8601now, region), + "canonical request string cannot be NULL" ) + + JSVERIFY( FAIL, + H5FD_s3comms_tostringtosign(s2s, canonreq, NULL, region), + "time string cannot be NULL" ) + + JSVERIFY( FAIL, + H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, NULL), + "aws region cannot be NULL" ) + + PASSED(); + return 0; + +error : + return -1; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_tostringtosign */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_trim() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_trim()`. + * + * Programmer: Jacob Smith + * 2017-09-14 + * + *---------------------------------------------------------------------------- + */ +static herr_t +test_trim(void) +{ + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char *in; + size_t in_len; + const char *exp; + size_t exp_len; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "block string", + 12, + "block string", + 12, + }, + { " \n\r \t", + 6, + "", + 0, + }, + { " \twhite b4", + 10, + "white b4", + 8, + }, + { "white after\r\n ", + 15, + "white after", + 11, + }, + { " on\nends\t", + 9, + "on\nends", + 7, + }, + }; + char dest[32]; + size_t dest_len = 0; + int i = 0; + int n_cases = 5; + char *str = NULL; + + + + TESTING("s3comms trim"); + + for (i = 0; i < n_cases; i++) { + HDassert(str == NULL); + str = (char *)HDmalloc(sizeof(char) * cases[i].in_len); + HDassert(str != NULL); + HDstrncpy(str, cases[i].in, cases[i].in_len); + + JSVERIFY( SUCCEED, + H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), + NULL ) + JSVERIFY( cases[i].exp_len, dest_len, cases[i].in ) + if (dest_len > 0) { + JSVERIFY( 0, strncmp(cases[i].exp, dest, dest_len), + cases[i].exp ) + } + free(str); + str = NULL; + } + + JSVERIFY( SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len), + "should not fail when trimming a null string" ); + JSVERIFY( 0, dest_len, "trimming NULL string writes 0 characters" ) + + HDassert(str == NULL); + str = (char *)HDmalloc(sizeof(char *) * 11); + HDassert(str != NULL); + memcpy(str, "some text ", 11); /* string with null terminator */ + JSVERIFY( FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), + "destination for trim cannot be NULL" ); + free(str); + str = NULL; + + PASSED(); + return 0; + +error: + if (str != NULL) + free(str); + return -1; + +} /* test_trim */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_uriencode() + * + * Purpose: + * + * Define and verify behavior of `H5FD_s3comms_uriencode()`. + * + * Programmer: Jacob Smith + * 2017-09-14 + * + *---------------------------------------------------------------------------- + */ +static herr_t +test_uriencode(void) +{ + /************************* + * test-local structures * + *************************/ + + struct testcase { + const char *str; + size_t s_len; + hbool_t encode_slash; + const char *expected; + }; + + /************************ + * test-local variables * + ************************/ + + struct testcase cases[] = { + { "/path/to/resource.jpg", + 21, + FALSE, + "/path/to/resource.jpg", + }, + { "/path/to/resource.jpg", + 21, + TRUE, + "%2Fpath%2Fto%2Fresource.jpg", + }, + { "string got_spaa ces", + 20, + TRUE, + "string%20got_spaa%20%20ces", + }, + { "sp ac~es/and-sl ash.encoded", + 27, + TRUE, + "sp%20ac~es%2Fand-sl%20ash.encoded", + }, + { "sp ac~es/and-sl ash.unencoded", + 29, + FALSE, + "sp%20ac~es/and-sl%20ash.unencoded", + }, + { "/path/to/resource.txt", + 0, + FALSE, + "", + + } + }; + char *dest = NULL; + size_t dest_written = 0; + int i = 0; + int ncases = 6; + size_t str_len = 0; + + + + TESTING("s3comms uriencode") + + for (i = 0; i < ncases; i++) { + str_len = cases[i].s_len; + dest = (char *)HDmalloc(sizeof(char) * str_len * 3 + 1); + FAIL_IF( dest == NULL ) + + JSVERIFY( SUCCEED, + H5FD_s3comms_uriencode( + dest, + cases[i].str, + str_len, + cases[i].encode_slash, + &dest_written), + NULL ); + JSVERIFY( HDstrlen(cases[i].expected), + dest_written, + NULL ) + JSVERIFY( 0, + strncmp(dest, cases[i].expected, dest_written), + cases[i].expected ); + + free(dest); + dest = NULL; + } + + /*************** + * ERROR CASES * + ***************/ + + dest = (char *)HDmalloc(sizeof(char) * 15); + HDassert(dest != NULL); + + JSVERIFY( FAIL, + H5FD_s3comms_uriencode(NULL, "word$", 5, false, &dest_written), + "destination cannot be NULL" ); + JSVERIFY( FAIL, + H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written), + "source string cannot be NULL" ); + + free(dest); + dest = NULL; + + PASSED(); + return 0; + +error: + if (dest != NULL) { + free(dest); + } + return -1; + +} /* test_uriencode */ + + + + +/*------------------------------------------------------------------------- + * Function: main() + * + * Purpose: + * + * Run unit tests for S3 Communications (s3comms). + * + * Return: + * + * Success: 0 + * Failure: 1 + * + * Programmer: Jacob Smith + * 2017-10-12 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + int nerrors = 0; +#ifdef H5_HAVE_ROS3_VFD + const char *bucket_url_env = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + + h5_reset(); + + HDprintf("Testing S3Communications functionality.\n"); + +#ifdef H5_HAVE_ROS3_VFD + + /* "clear" profile data strings */ + s3_test_aws_access_key_id[0] = '\0'; + s3_test_aws_secret_access_key[0] = '\0'; + s3_test_aws_region[0] = '\0'; + s3_test_bucket_url[0] = '\0'; + +/* TODO: unit/regression test for H5FD_s3comms_load_aws_profile() + * requires a few test files and/or manipulation of default path + */ + /* attempt to load test credentials + * if unable, certain tests will be skipped + */ + if (SUCCEED == H5FD_s3comms_load_aws_profile( + S3_TEST_PROFILE_NAME, + s3_test_aws_access_key_id, + s3_test_aws_secret_access_key, + s3_test_aws_region)) + { + s3_test_credentials_loaded = 1; + } + + bucket_url_env = HDgetenv("HDF5_ROS3_TEST_BUCKET_URL"); + if (bucket_url_env == NULL || bucket_url_env[0] == '\0') { + HDprintf("WARNING: S3 bucket url is not defined in enviornment " \ + "variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n"); + } else { + HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE); + s3_test_bucket_defined = TRUE; + } + +#endif /* H5_HAVE_ROS3_VFD */ + + /* tests ordered rougly by dependence */ + nerrors += test_macro_format_credential() < 0 ? 1 : 0; + nerrors += test_trim() < 0 ? 1 : 0; + nerrors += test_nlowercase() < 0 ? 1 : 0; + nerrors += test_uriencode() < 0 ? 1 : 0; + nerrors += test_percent_encode_char() < 0 ? 1 : 0; + nerrors += test_bytes_to_hex() < 0 ? 1 : 0; + nerrors += test_HMAC_SHA256() < 0 ? 1 : 0; + nerrors += test_signing_key() < 0 ? 1 : 0; + nerrors += test_hrb_node_set() < 0 ? 1 : 0; + nerrors += test_hrb_init_request() < 0 ? 1 : 0; + nerrors += test_parse_url() < 0 ? 1 : 0; + nerrors += test_aws_canonical_request() < 0 ? 1 : 0; + nerrors += test_tostringtosign() < 0 ? 1 : 0; + nerrors += test_s3r_open() < 0 ? 1 : 0; + nerrors += test_s3r_get_filesize() < 0 ? 1 : 0; + nerrors += test_s3r_read() < 0 ? 1 : 0; + + if(nerrors) { + HDprintf("***** %d S3comms TEST%s FAILED! *****\n", + nerrors, + nerrors > 1 ? "S" : ""); + return 1; + } /* end if */ + + HDprintf("All S3comms tests passed.\n"); + + return 0; +} /* end main() */ + diff --git a/test/vfd.c b/test/vfd.c index b196406..2b15430 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -58,6 +58,7 @@ const char *FILENAME[] = { "stdio_file", /*7*/ "windows_file", /*8*/ "new_multi_file_v16",/*9*/ + "ro_s3_file6", /*10*/ NULL }; @@ -66,7 +67,7 @@ const char *FILENAME[] = { #define COMPAT_BASENAME "family_v16_" #define MULTI_COMPAT_BASENAME "multi_file_v16" - + /*------------------------------------------------------------------------- * Function: test_sec2 * @@ -178,7 +179,7 @@ error: return -1; } /* end test_sec2() */ - + /*------------------------------------------------------------------------- * Function: test_core * @@ -534,7 +535,7 @@ error: return -1; } /* end test_core() */ - + /*------------------------------------------------------------------------- * Function: test_direct * @@ -754,7 +755,7 @@ error: #endif /*H5_HAVE_DIRECT*/ } - + /*------------------------------------------------------------------------- * Function: test_family_opens * @@ -835,7 +836,7 @@ error: } /* end test_family_opens() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: test_family * @@ -1017,7 +1018,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_family_compat * @@ -1129,7 +1130,7 @@ error: } /* end test_family_compat() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: test_multi_opens * @@ -1170,7 +1171,7 @@ test_multi_opens(char *fname) } /* end test_multi_opens() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: test_multi * @@ -1404,7 +1405,7 @@ error: return FAIL; } /* end test_multi() */ - + /*------------------------------------------------------------------------- * Function: test_multi_compat * @@ -1578,7 +1579,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_log * @@ -1689,7 +1690,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: test_stdio * @@ -1794,7 +1795,7 @@ error: } - + /*------------------------------------------------------------------------- * Function: test_windows * @@ -1916,7 +1917,146 @@ error: } /* end test_windows() */ - +/*------------------------------------------------------------------------- + * Function: test_ros3 + * + * Purpose: Tests the file handle interface for the ROS3 driver + * + * As the ROS3 driver is 1) read only, 2) requires access + * to an S3 server (minio for now), this test is quite + * different from the other tests. + * + * For now, test only fapl & flags. Extend as the + * work on the VFD continues. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: John Mainzer + * 7/12/17 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_ros3(void) +{ + hid_t fid = -1; /* file ID */ + hid_t fapl_id = -1; /* file access property list ID */ + hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ + hid_t driver_id = -1; /* ID for this VFD */ + unsigned long driver_flags = 0; /* VFD feature flags */ + char filename[1024]; /* filename */ + void *os_file_handle = NULL; /* OS file handle */ + hsize_t file_size; /* file size */ + H5FD_ros3_fapl_t test_ros3_fa; + H5FD_ros3_fapl_t ros3_fa_0 = + { + /* version = */ H5FD__CURR_ROS3_FAPL_T_VERSION, + /* authenticate = */ FALSE, + /* aws_region = */ "", + /* secret_id = */ "", + /* secret_key = */ "plugh", + }; + + TESTING("ROS3 file driver"); + + /* Set property list and file name for ROS3 driver. */ + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) + TEST_ERROR; + + if(H5Pset_fapl_ros3(fapl_id, &ros3_fa_0) < 0) + TEST_ERROR; + + /* verify that the ROS3 FAPL entry is set as expected */ + if(H5Pget_fapl_ros3(fapl_id, &test_ros3_fa) < 0) + TEST_ERROR; + + /* need a macro to compare instances of H5FD_ros3_fapl_t */ + if((test_ros3_fa.version != ros3_fa_0.version) || + (test_ros3_fa.authenticate != ros3_fa_0.authenticate) || + (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) || + (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) || + (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0)) + TEST_ERROR; + + h5_fixname(FILENAME[10], fapl_id, filename, sizeof(filename)); + + /* Check that the VFD feature flags are correct */ + if ((driver_id = H5Pget_driver(fapl_id)) < 0) + TEST_ERROR; + + if (H5FDdriver_query(driver_id, &driver_flags) < 0) + TEST_ERROR; + + if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR + + /* Check for extra flags not accounted for above */ + if(driver_flags != (H5FD_FEAT_DATA_SIEVE)) + TEST_ERROR + + /* can't create analogs of the following tests until the + * ROS3 driver is up and running in a minimal fashion. + * Comment them out until we get to them. + */ +#if 0 + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + TEST_ERROR; + + /* Retrieve the access property list... */ + if((fapl_id_out = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + + /* Check that the driver is correct */ + if(H5FD_ROS3 != H5Pget_driver(fapl_id_out)) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(fapl_id_out) < 0) + TEST_ERROR; + + /* Check that we can get an operating-system-specific handle from + * the library. + */ + if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) + TEST_ERROR; + if(os_file_handle == NULL) + FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle"); + + + /* There is no garantee the size of metadata in file is constant. + * Just try to check if it's reasonable. + * + * Currently it should be around 2 KB. + */ + if(H5Fget_filesize(fid, &file_size) < 0) + TEST_ERROR; + if(file_size < 1 * KB || file_size > 4 * KB) + FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize"); + + /* Close and delete the file */ + if(H5Fclose(fid) < 0) + TEST_ERROR; + h5_delete_test_file(FILENAME[0], fapl_id); + + /* Close the fapl */ + if(H5Pclose(fapl_id) < 0) + TEST_ERROR; +#endif + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl_id); + H5Pclose(fapl_id_out); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_ros3() */ + + + /*------------------------------------------------------------------------- * Function: main * @@ -1949,6 +2089,7 @@ main(void) nerrors += test_log() < 0 ? 1 : 0; nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; + nerrors += test_ros3() < 0 ? 1 : 0; if(nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 400039e..aa09aa6 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -9,4 +9,11 @@ add_subdirectory (src) #-- Add the tests if (BUILD_TESTING) add_subdirectory (test) + +# -------------------------------------------------------------------- +# If S3 or HDFS enabled, then we need to test the tools library +# -------------------------------------------------------------------- + if (HDF5_ENABLE_ROS3_VFD OR HDF5_ENABLE_HDFS) + add_subdirectory (libtest) + endif () endif () diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e7e017f..a3cd7d9 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -21,6 +21,10 @@ #include "H5private.h" #include "h5trav.h" +#ifdef H5_HAVE_ROS3_VFD +#include "H5FDros3.h" +#endif + /* global variables */ unsigned h5tools_nCols = 80; /* ``get_option'' variables */ @@ -97,7 +101,7 @@ parallel_print(const char* format, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: error_msg * @@ -122,7 +126,7 @@ error_msg(const char *fmt, ...) HDva_end(ap); } - + /*------------------------------------------------------------------------- * Function: warn_msg * @@ -161,7 +165,7 @@ help_ref_msg(FILE *output) HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname()); } - + /*------------------------------------------------------------------------- * Function: get_option * @@ -322,7 +326,229 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti return opt_opt; } - + +/***************************************************************************** + * + * Function: parse_tuple() + * + * Purpose: + * + * Create array of pointers to strings, identified as elements in a tuple + * of arbitrary length separated by provided character. + * ("tuple" because "nple" looks strange) + * + * * Receives pointer to start of tuple sequence string, '('. + * * Attempts to separate elements by token-character `sep`. + * * If the separator character is preceded by a backslash '\', + * the backslash is deleted and the separator is included in the + * element string as any other character. + * * To end an element with a backslash, escape the backslash, e.g. + * "(myelem\\,otherelem) -> {"myelem\", "otherelem"} + * * In all other cases, a backslash appearing not as part of "\\" or + * "\" digraph will be included berbatim. + * * Last two characters in the string MUST be ")\0". + * + * * Generates a copy of the input string `start`, (src..")\0"), replacing + * separators and close-paren with null charaters. + * * This string is allocated at runtime and should be freed when done. + * * Generates array of char pointers, and directs start of each element + * (each pointer) into this copy. + * * Each tuple element points to the start of its string (substring) + * and ends with a null terminator. + * * This array is allocated at runtime and should be freed when done. + * * Reallocates and expands elements array during parsing. + * * Initially allocated for 2 (plus one null entry), and grows by + * powers of 2. + * * The final 'slot' in the element array (elements[nelements], e.g.) + * always points to NULL. + * * The number of elements found and stored are passed out through pointer + * to unsigned, `nelems`. + * + * Return: + * + * FAIL If malformed--does not look like a tuple "(...)" + * or major error was encountered while parsing. + * or + * SUCCEED String looks properly formed "(...)" and no major errors. + * + * Stores number of elements through pointer `nelems`. + * Stores list of pointers to char (first char in each element + * string) through pointer `ptrs_out`. + * NOTE: `ptrs_out[nelems] == NULL` should be true. + * NOTE: list is malloc'd by function, and should be freed + * when done. + * Stores "source string" for element pointers through `cpy_out`. + * NOTE: Each element substring is null-terminated. + * NOTE: There may be extra characters after the last element + * (past its null terminator), but is guaranteed to + * be null-terminated. + * NOTE: `cpy_out` string is malloc'd by function, + * and should be freed when done. + * + * Programmer: Jacob Smith + * 2017-11-10 + * + * Changes: None. + * + ***************************************************************************** + */ +herr_t +parse_tuple(const char *start, + int sep, + char **cpy_out, + unsigned *nelems, + char ***ptrs_out) +{ + char *elem_ptr = NULL; + char *dest_ptr = NULL; + unsigned elems_count = 0; + char **elems = NULL; /* more like *elems[], but complier... */ + char **elems_re = NULL; /* temporary pointer, for realloc */ + char *cpy = NULL; + herr_t ret_value = SUCCEED; + unsigned init_slots = 2; + + + + /***************** + * SANITY-CHECKS * + *****************/ + + /* must start with "(" + */ + if (start[0] != '(') { + ret_value = FAIL; + goto done; + } + + /* must end with ")" + */ + while (start[elems_count] != '\0') { + elems_count++; + } + if (start[elems_count - 1] != ')') { + ret_value = FAIL; + goto done; + } + + elems_count = 0; + + + + /*********** + * PREPARE * + ***********/ + + /* create list + */ + elems = (char **)HDmalloc(sizeof(char *) * (init_slots + 1)); + if (elems == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */ + + /* create destination string + */ + start++; /* advance past opening paren '(' */ + cpy = (char *)HDmalloc(sizeof(char) * (HDstrlen(start))); /* no +1; less '(' */ + if (cpy == NULL) { ret_value = FAIL; goto done; } /* CANTALLOC */ + + /* set pointers + */ + dest_ptr = cpy; /* start writing copy here */ + elem_ptr = cpy; /* first element starts here */ + elems[elems_count++] = elem_ptr; /* set first element pointer into list */ + + + + /********* + * PARSE * + *********/ + + while (*start != '\0') { + /* For each character in the source string... + */ + if (*start == '\\') { + /* Possibly an escape digraph. + */ + if ((*(start + 1) == '\\') || + (*(start + 1) == sep) ) + { + /* Valid escape digraph of "\\" or "\". + */ + start++; /* advance past escape char '\' */ + *(dest_ptr++) = *(start++); /* Copy subsequent char */ + /* and advance pointers. */ + } else { + /* Not an accepted escape digraph. + * Copy backslash character. + */ + *(dest_ptr++) = *(start++); + } + } else if (*start == sep) { + /* Non-escaped separator. + * Terminate elements substring in copy, record element, advance. + * Expand elements list if appropriate. + */ + *(dest_ptr++) = 0; /* Null-terminate elem substring in copy */ + /* and advance pointer. */ + start++; /* Advance src pointer past separator. */ + elem_ptr = dest_ptr; /* Element pointer points to start of first */ + /* character after null sep in copy. */ + elems[elems_count++] = elem_ptr; /* Set elem pointer in list */ + /* and increment count. */ + + /* Expand elements list, if necessary. + */ + if (elems_count == init_slots) { + init_slots *= 2; + elems_re = (char **)realloc(elems, sizeof(char *) * \ + (init_slots + 1)); + if (elems_re == NULL) { + /* CANTREALLOC */ + ret_value = FAIL; + goto done; + } + elems = elems_re; + } + } else if (*start == ')' && *(start + 1) == '\0') { + /* Found terminal, non-escaped close-paren. Last element. + * Write null terminator to copy. + * Advance source pointer to gently break from loop. + * Requred to prevent ")" from always being added to last element. + */ + start++; + } else { + /* Copy character into destination. Advance pointers. + */ + *(dest_ptr++) = *(start++); + } + } + *dest_ptr = '\0'; /* Null-terminate destination string. */ + elems[elems_count] = NULL; /* Null-terminate elements list. */ + + + + /******************** + * PASS BACK VALUES * + ********************/ + + *ptrs_out = elems; + *nelems = elems_count; + *cpy_out = cpy; + +done: + if (ret_value == FAIL) { + /* CLEANUP */ + if (cpy) free(cpy); + if (elems) free(elems); + } + + return ret_value; + +} /* parse_tuple */ + + + + + /*------------------------------------------------------------------------- * Function: indentation * @@ -344,7 +570,7 @@ indentation(unsigned x) } } - + /*------------------------------------------------------------------------- * Function: print_version * @@ -362,7 +588,7 @@ print_version(const char *progname) ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } - + /*------------------------------------------------------------------------- * Function: init_table * @@ -384,7 +610,7 @@ init_table(table_t **tbl) *tbl = table; } - + /*------------------------------------------------------------------------- * Function: free_table * @@ -408,7 +634,7 @@ free_table(table_t *table) } #ifdef H5DUMP_DEBUG - + /*------------------------------------------------------------------------- * Function: dump_table * @@ -429,7 +655,7 @@ dump_table(char* tablename, table_t *table) table->objs[u].displayed, table->objs[u].recorded); } - + /*------------------------------------------------------------------------- * Function: dump_tables * @@ -447,7 +673,7 @@ dump_tables(find_objs_t *info) } #endif /* H5DUMP_DEBUG */ - + /*------------------------------------------------------------------------- * Function: search_obj * @@ -470,7 +696,7 @@ search_obj(table_t *table, haddr_t objno) return NULL; } - + /*------------------------------------------------------------------------- * Function: find_objs_cb * @@ -546,7 +772,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen return ret_value; } - + /*------------------------------------------------------------------------- * Function: init_objs * @@ -591,7 +817,7 @@ done: return ret_value; } - + /*------------------------------------------------------------------------- * Function: add_obj * @@ -622,7 +848,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) table->objs[u].displayed = 0; } - + #ifndef H5_HAVE_TMPFILE /*------------------------------------------------------------------------- * Function: tmpfile @@ -841,3 +1067,266 @@ done: return ret_value; } + +/*---------------------------------------------------------------------------- + * + * Function: h5tools_populate_ros3_fapl() + * + * Purpose: + * + * Set the values of a ROS3 fapl configuration object. + * + * If the values pointer is NULL, sets fapl target `fa` to a default + * (valid, current-version, non-authenticating) fapl config. + * + * If `values` pointer is _not_ NULL, expects `values` to contain at least + * three non-null pointers to null-terminated strings, corresponding to: + * { aws_region, + * secret_id, + * secret_key, + * } + * If all three strings are empty (""), the default fapl will be default. + * Both aws_region and secret_id values must be both empty or both + * populated. If + * Only secret_key is allowed to be empty (the empty string, ""). + * All values are checked against overflow as defined in the ros3 vfd + * header file; if a value overruns the permitted space, FAIL is returned + * and the function aborts without resetting the fapl to values initially + * present. + * + * Return: + * + * 0 (failure) if... + * * Read-Only S3 VFD is not enabled. + * * NULL fapl pointer: (NULL, {...} ) + * * Warning: In all cases below, fapl will be set as "default" + * before error occurs. + * * NULL value strings: (&fa, {NULL?, NULL? NULL?, ...}) + * * Incomplete fapl info: + * * empty region, non-empty id, key either way + * * (&fa, {"", "...", "?"}) + * * empty id, non-empty region, key either way + * * (&fa, {"...", "", "?"}) + * * "non-empty key and either id or region empty + * * (&fa, {"", "", "...") + * * (&fa, {"", "...", "...") + * * (&fa, {"...", "", "...") + * * Any string would overflow allowed space in fapl definition. + * or + * 1 (success) + * * Sets components in fapl_t pointer, copying strings as appropriate. + * * "Default" fapl (valid version, authenticate->False, empty strings) + * * `values` pointer is NULL + * * (&fa, NULL) + * * first three strings in `values` are empty ("") + * * (&fa, {"", "", "", ...} + * * Authenticating fapl + * * region, id, and optional key provided + * * (&fa, {"...", "...", ""}) + * * (&fa, {"...", "...", "..."}) + * + * Programmer: Jacob Smith + * 2017-11-13 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +int +h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, + const char **values) +{ +#ifndef H5_HAVE_ROS3_VFD + return 0; +#else + int show_progress = 0; /* set to 1 for debugging */ + int ret_value = 1; /* 1 for success, 0 for failure */ + /* e.g.? if (!populate()) { then failed } */ + + if (show_progress) { + HDprintf("called h5tools_populate_ros3_fapl\n"); + } + + if (fa == NULL) { + if (show_progress) { + HDprintf(" ERROR: null pointer to fapl_t\n"); + } + ret_value = 0; + goto done; + } + + if (show_progress) { + HDprintf(" preset fapl with default values\n"); + } + fa->version = H5FD__CURR_ROS3_FAPL_T_VERSION; + fa->authenticate = FALSE; + *(fa->aws_region) = '\0'; + *(fa->secret_id) = '\0'; + *(fa->secret_key) = '\0'; + + /* sanity-check supplied values + */ + if (values != NULL) { + if (values[0] == NULL) { + if (show_progress) { + HDprintf(" ERROR: aws_region value cannot be NULL\n"); + } + ret_value = 0; + goto done; + } + if (values[1] == NULL) { + if (show_progress) { + HDprintf(" ERROR: secret_id value cannot be NULL\n"); + } + ret_value = 0; + goto done; + } + if (values[2] == NULL) { + if (show_progress) { + HDprintf(" ERROR: secret_key value cannot be NULL\n"); + } + ret_value = 0; + goto done; + } + + /* if region and ID are supplied (key optional), write to fapl... + * fail if value would overflow + */ + if (*values[0] != '\0' && + *values[1] != '\0') + { + if (HDstrlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN) { + if (show_progress) { + HDprintf(" ERROR: aws_region value too long\n"); + } + ret_value = 0; + goto done; + } + HDmemcpy(fa->aws_region, values[0], + (HDstrlen(values[0]) + 1)); + if (show_progress) { + HDprintf(" aws_region set\n"); + } + + + if (HDstrlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN) { + if (show_progress) { + HDprintf(" ERROR: secret_id value too long\n"); + } + ret_value = 0; + goto done; + } + HDmemcpy(fa->secret_id, + values[1], + (HDstrlen(values[1]) + 1)); + if (show_progress) { + HDprintf(" secret_id set\n"); + } + + if (HDstrlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN) { + if (show_progress) { + HDprintf(" ERROR: secret_key value too long\n"); + } + ret_value = 0; + goto done; + } + HDmemcpy(fa->secret_key, + values[2], + (HDstrlen(values[2]) + 1)); + if (show_progress) { + HDprintf(" secret_key set\n"); + } + + fa->authenticate = TRUE; + if (show_progress) { + HDprintf(" set to authenticate\n"); + } + + } else if (*values[0] != '\0' || + *values[1] != '\0' || + *values[2] != '\0') + { + if (show_progress) { + HDprintf( + " ERROR: invalid assortment of empty/non-empty values\n" + ); + } + ret_value = 0; + goto done; + } + } /* values != NULL */ + +done: + return ret_value; +#endif /* H5_HAVE_ROS3_VFD */ + +} /* h5tools_populate_ros3_fapl */ + + +/*----------------------------------------------------------------------------- + * + * Function: h5tools_set_configured_fapl + * + * Purpose: prepare fapl_id with the given property list, according to + * VFD prototype. + * + * Return: 0 on failure, 1 on success + * + * Programmer: Jacob Smith + * 2018-05-21 + * + * Changes: None. + * + *----------------------------------------------------------------------------- + */ +int +h5tools_set_configured_fapl(hid_t fapl_id, + const char vfd_name[], + void *fapl_t_ptr) +{ + int ret_value = 1; + + if (fapl_id < 0) { + return 0; + } + + if (!strcmp("", vfd_name)) { + goto done; + +#ifdef H5_HAVE_ROS3_VFD + } else if (!strcmp("ros3", vfd_name)) { + if ((fapl_id == H5P_DEFAULT) || + (fapl_t_ptr == NULL) || + (FAIL == H5Pset_fapl_ros3( + fapl_id, + (H5FD_ros3_fapl_t *)fapl_t_ptr))) + { + ret_value = 0; + goto done; + } +#endif /* H5_HAVE_ROS3_VFD */ + +#ifdef H5_HAVE_LIBHDFS + } else if (!strcmp("hdfs", vfd_name)) { + if ((fapl_id == H5P_DEFAULT) || + (fapl_t_ptr == NULL) || + (FAIL == H5Pset_fapl_hdfs( + fapl_id, + (H5FD_hdfs_fapl_t *)fapl_t_ptr))) + { + ret_value = 0; + goto done; + } +#endif /* H5_HAVE_LIBHDFS */ + + } else { + ret_value = 0; /* unrecognized fapl type "name" */ + } + +done: + return ret_value; + +} /* h5tools_set_configured_fapl() */ + + + diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 4c2bf1e..1c6ba2a 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -123,6 +123,11 @@ H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for H5TOOLS_DLL void indentation(unsigned); H5TOOLS_DLL void print_version(const char *progname); H5TOOLS_DLL void parallel_print(const char* format, ... ); +H5TOOLS_DLL herr_t parse_tuple(const char *start, + int sep, + char **cpy_out, + unsigned *nelems, + char ***ptrs_out); H5TOOLS_DLL void error_msg(const char *fmt, ...); H5TOOLS_DLL void warn_msg(const char *fmt, ...); H5TOOLS_DLL void help_ref_msg(FILE *output); @@ -174,6 +179,11 @@ H5TOOLS_DLL void h5tools_setprogname(const char*progname); H5TOOLS_DLL int h5tools_getstatus(void); H5TOOLS_DLL void h5tools_setstatus(int d_status); H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void); +H5TOOLS_DLL int h5tools_set_configured_fapl(hid_t fapl_id, + const char vfd_name[], + void *fapl_t_ptr); +H5TOOLS_DLL int h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, + const char **values); #ifdef __cplusplus } #endif diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt new file mode 100644 index 0000000..f5e0aa6 --- /dev/null +++ b/tools/libtest/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required (VERSION 3.10) +project (HDF5_TOOLS_LIBTEST C) + +#----------------------------------------------------------------------------- +# Add the h5tools_utils test executables +#----------------------------------------------------------------------------- +add_executable (h5tools_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_utils.c) +target_include_directories(h5tools_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +TARGET_C_PROPERTIES (h5tools_utils STATIC) +target_link_libraries (h5tools_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_target_properties (h5tools_utils PROPERTIES FOLDER tools) + +if (BUILD_SHARED_LIBS) + add_executable (h5tools_utils-shared ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_utils.c) + target_include_directories(h5tools_utils-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (h5tools_utils-shared SHARED) + target_link_libraries (h5tools_utils-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + set_target_properties (h5tools_utils-shared PROPERTIES FOLDER tools) +endif () + +include (CMakeTests.cmake) diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake new file mode 100644 index 0000000..403969d --- /dev/null +++ b/tools/libtest/CMakeTests.cmake @@ -0,0 +1,49 @@ +# +# 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 COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + + macro (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME H5LIBTEST-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5LIBTEST-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test (NAME H5LIBTEST-${resultfile} COMMAND $ ${ARGN}) + if (NOT "${resultcode}" STREQUAL "0") + set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES DEPENDS H5LIBTEST-${resultfile}-clear-objects) + endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + ADD_H5_TEST (h5tools_utils-default 0) diff --git a/tools/libtest/Makefile.am b/tools/libtest/Makefile.am new file mode 100644 index 0000000..5aa72b8 --- /dev/null +++ b/tools/libtest/Makefile.am @@ -0,0 +1,34 @@ +# +# Read-Only S3 Virtual File Driver (VFD) +# Copyright (c) 2017-2018, The HDF Group. +# +# All rights reserved. +# +# NOTICE: +# All information contained herein is, and remains, the property of The HDF +# Group. The intellectual and technical concepts contained herein are +# proprietary to The HDF Group. Dissemination of this information or +# reproduction of this material is strictly forbidden unless prior written +# permission is obtained from The HDF Group. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am + +# Include src and tools/lib directories +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib + +# All programs depend on the hdf5 and h5tools libraries +LDADD=$(LIBH5TOOLS) $(LIBHDF5) + + +# main target +bin_PROGRAMS=h5tools_utils +# check_PROGRAMS=$(TEST_PROG) + + +include $(top_srcdir)/config/conclude.am diff --git a/tools/libtest/h5tools_utils.c b/tools/libtest/h5tools_utils.c new file mode 100644 index 0000000..56e8a01 --- /dev/null +++ b/tools/libtest/h5tools_utils.c @@ -0,0 +1,1296 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright (c) 2017-2018, The HDF Group. * + * * + * All rights reserved. * + * * + * NOTICE: * + * All information contained herein is, and remains, the property of The HDF * + * Group. The intellectual and technical concepts contained herein are * + * proprietary to The HDF Group. Dissemination of this information or * + * reproduction of this material is strictly forbidden unless prior written * + * permission is obtained from The HDF Group. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: unit-test functionality of the routines in `tools/lib/h5tools_utils` + * + * Jacob Smith 2017-11-10 + */ + +#include "hdf5.h" +#include "H5private.h" +#include "h5tools_utils.h" +/* #include "h5test.h" */ /* linking failure */ + +#define UTIL_TEST_DEBUG 0 + +#ifndef _H5TEST_ + +#define AT() fprintf(stdout, " at %s:%d in %s()...\n", \ + __FILE__, __LINE__, FUNC); + +#define FAILED(msg) { \ + fprintf(stdout, "*FAILED*"); AT() \ + if (msg == NULL) { \ + fprintf(stdout,"(NULL)\n"); \ + } else { \ + fprintf(stdout, "%s\n", msg); \ + } \ + fflush(stdout); \ +} + +#define TESTING(msg) { \ + fprintf(stdout, "TESTING %-62s", (msg)); \ + fflush(stdout); \ +} + +#define PASSED() { \ + fprintf(stdout, " PASSED\n"); \ + fflush(stdout); \ +} + +#endif /* ifndef _H5TEST_ */ + +#ifndef __js_test__ + +#define __js_test__ 1L + +/***************************************************************************** + * + * FILE-LOCAL TESTING MACROS + * + * Purpose: + * + * 1. Upon test failure, goto-jump to single-location teardown in test + * function. E.g., `error:` (consistency with HDF corpus) or + * `failed:` (reflects purpose). + * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. + * 2. Increase clarity and reduce overhead found with `TEST_ERROR`. + * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" + * requires reading of entire line to know whether this if/call is + * part of the test setup, test operation, or a test unto itself. + * 3. Provide testing macros with optional user-supplied failure message; + * if not supplied (NULL), generate comparison output in the spirit of + * test-driven development. E.g., "expected 5 but was -3" + * User messages clarify test's purpose in code, encouraging description + * without relying on comments. + * 4. Configurable expected-actual order in generated comparison strings. + * Some prefer `VERIFY(expected, actual)`, others + * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch + * to satifsy both parties, assuming one paradigm per test file. + * (One could #undef and redefine the flag through the file as desired, + * but _why_.) + * + * Provided as courtesy, per consideration for inclusion in the library + * proper. + * + * Macros: + * + * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order + * FAIL_IF() - check condition + * FAIL_UNLESS() - check _not_ condition + * JSVERIFY() - long-int equality check; prints reason/comparison + * JSVERIFY_NOT() - long-int inequality check; prints + * JSVERIFY_STR() - string equality check; prints + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * ifdef flag: JSVERIFY_EXP_ACT + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_EXP_ACT 1L + + +/*---------------------------------------------------------------------------- + * + * Macro: JSFAILED_AT() + * + * Purpose: + * + * Preface a test failure by printing "*FAILED*" and location to stdout + * Similar to `H5_FAILED(); AT();` from h5test.h + * + * *FAILED* at somefile.c:12 in function_name()... + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSFAILED_AT() { \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_IF() + * + * Purpose: + * + * Make tests more accessible and less cluttered than + * `if (thing == otherthing()) TEST_ERROR` + * paradigm. + * + * The following lines are roughly equivalent: + * + * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) + * `FAIL_IF(myfunc() < 0)` + * + * Prints a generic "FAILED AT" line to stdout and jumps to `error`, + * similar to `TEST_ERROR` in h5test.h + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_IF(condition) \ +if (condition) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_UNLESS() + * + * Purpose: + * + * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", + * e.g., "a != b". + * + * Opposite of FAIL_IF; fails if the given condition is _not_ true. + * + * `FAIL_IF( 5 != my_op() )` + * is equivalent to + * `FAIL_UNLESS( 5 == my_op() )` + * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. + * (see JSVERIFY) + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_UNLESS(condition) \ +if (!(condition)) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_LONG() + * + * Purpose: + * + * Print an failure message for long-int arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:488 in somefunc()... + * forest must be made of trees. + * + * or + * + * *FAILED* at myfile.c:488 in somefunc()... + * ! Expected 425 + * ! Actual 3 + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_LONG(expected, actual, reason) { \ + JSFAILED_AT() \ + if (reason!= NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ + (long)(expected), (long)(actual)); \ + } \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_STR() + * + * Purpose: + * + * Print an failure message for string arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:421 in myfunc()... + * Blue and Red strings don't match! + * + * or + * + * *FAILED* at myfile.c:421 in myfunc()... + * !!! Expected: + * this is my expected + * string + * !!! Actual: + * not what I expected at all + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_STR(expected, actual, reason) { \ + JSFAILED_AT() \ + if ((reason) != NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ + (expected), (actual)); \ + } \ +} + +#ifdef JSVERIFY_EXP_ACT + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY() + * + * Purpose: + * + * Verify that two long integers are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(expected, actual, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_NOT() + * + * Purpose: + * + * Verify that two long integers are _not_ equal. + * If equal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(expected, actual, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_STR() + * + * Purpose: + * + * Verify that two strings are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(expected, actual, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + + +#else /* JSVERIFY_EXP_ACT not defined */ + /* Repeats macros above, but with actual/expected parameters reversed. */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY() + * See: JSVERIFY documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(actual, expected, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_NOT() + * See: JSVERIFY_NOT documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(actual, expected, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_STR() + * See: JSVERIFY_STR documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(actual, expected, reason) \ +if (strcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + +#endif /* ifdef/else JSVERIFY_EXP_ACT */ + +#endif /* __js_test__ */ + +/* if > 0, be very verbose when performing tests */ +#define H5TOOLS_UTILS_TEST_DEBUG 0 + +/******************/ +/* TEST FUNCTIONS */ +/******************/ + + +/*---------------------------------------------------------------------------- + * + * Function: test_parse_tuple() + * + * Purpose: + * + * Provide unit tests and specification for the `parse_tuple()` function. + * + * Return: + * + * 0 Tests passed. + * 1 Tests failed. + * + * Programmer: Jacob Smith + * 2017-11-11 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_parse_tuple(void) +{ + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + + struct testcase { + const char *test_msg; /* info about test case */ + const char *in_str; /* input string */ + int sep; /* separator "character" */ + herr_t exp_ret; /* expected SUCCEED / FAIL */ + unsigned exp_nelems; /* expected number of elements */ + /* (no more than 7!) */ + const char *exp_elems[7]; /* list of elements (no more than 7!) */ + }; + + /****************** + * TEST VARIABLES * + ******************/ + + struct testcase cases[] = { + { "bad start", + "words(before)", + ';', + FAIL, + 0, + {NULL}, + }, + { "tuple not closed", + "(not ok", + ',', + FAIL, + 0, + {NULL}, + }, + { "empty tuple", + "()", + '-', + SUCCEED, + 1, + {""}, + }, + { "no separator", + "(stuff keeps on going)", + ',', + SUCCEED, + 1, + {"stuff keeps on going"}, + }, + { "4-ple, escaped seperator", + "(elem0,elem1,el\\,em2,elem3)", /* "el\,em" */ + ',', + SUCCEED, + 4, + {"elem0", "elem1", "el,em2", "elem3"}, + }, + { "5-ple, escaped escaped separator", + "(elem0,elem1,el\\\\,em2,elem3)", + ',', + SUCCEED, + 5, + {"elem0", "elem1", "el\\", "em2", "elem3"}, + }, + { "escaped non-comma separator", + "(5-2-7-2\\-6-2)", + '-', + SUCCEED, + 5, + {"5","2","7","2-6","2"}, + }, + { "embedded close-paren", + "(be;fo)re)", + ';', + SUCCEED, + 2, + {"be", "fo)re"}, + }, + { "embedded non-escaping backslash", + "(be;fo\\re)", + ';', + SUCCEED, + 2, + {"be", "fo\\re"}, + }, + { "double close-paren at end", + "(be;fore))", + ';', + SUCCEED, + 2, + {"be", "fore)"}, + }, + { "empty elements", + "(;a1;;a4;)", + ';', + SUCCEED, + 5, + {"", "a1", "", "a4", ""}, + }, + { "nested tuples with different separators", + "((4,e,a);(6,2,a))", + ';', + SUCCEED, + 2, + {"(4,e,a)","(6,2,a)"}, + }, + { "nested tuples with same separators", + "((4,e,a),(6,2,a))", + ',', + SUCCEED, + 6, + {"(4","e","a)","(6","2","a)"}, + }, + { "real-world use case", + "(us-east-2,AKIAIMC3D3XLYXLN5COA,ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+)", + ',', + SUCCEED, + 3, + {"us-east-2", + "AKIAIMC3D3XLYXLN5COA", + "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}, + } + }; + struct testcase tc; + unsigned n_tests = 14; + unsigned i = 0; + unsigned count = 0; + unsigned elem_i = 0; + char **parsed = NULL; + char *cpy = NULL; + herr_t success = TRUE; + hbool_t show_progress = FALSE; + + + + TESTING("arbitrary-count tuple parsing"); + +#if H5TOOLS_UTILS_TEST_DEBUG > 0 + show_progress = TRUE; +#endif /* H5TOOLS_UTILS_TEST_DEBUG */ + + /********* + * TESTS * + *********/ + + for (i = 0; i < n_tests; i++) { + + /* SETUP + */ + HDassert(parsed == NULL); + HDassert(cpy == NULL); + tc = cases[i]; + if (show_progress == TRUE) { + printf("testing %d: %s...\n", i, tc.test_msg); + } + + /* VERIFY + */ + success = parse_tuple(tc.in_str, tc.sep, + &cpy, &count, &parsed); + + JSVERIFY( tc.exp_ret, success, "function returned incorrect value" ) + JSVERIFY( tc.exp_nelems, count, NULL ) + if (success == SUCCEED) { + FAIL_IF( parsed == NULL ) + for (elem_i = 0; elem_i < count; elem_i++) { + JSVERIFY_STR( tc.exp_elems[elem_i], parsed[elem_i], NULL ) + } + /* TEARDOWN */ + HDassert(parsed != NULL); + HDassert(cpy != NULL); + free(parsed); + parsed = NULL; + free(cpy); + cpy = NULL; + } else { + FAIL_IF( parsed != NULL ) + } /* if parse_tuple() == SUCCEED or no */ + + } /* for each testcase */ + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (parsed != NULL) free(parsed); + if (cpy != NULL) free(cpy); + + return 1; + +} /* test_parse_tuple */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_populate_ros3_fa() + * + * Purpose: Verify behavior of `populate_ros3_fa()` + * + * Return: 0 if test passes + * 1 if failure + * + * Programmer: Jacob Smith + * 2017-11-13 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_populate_ros3_fa(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + + /************************ + * TEST-LOCAL VARIABLES * + ************************/ + + hbool_t show_progress = FALSE; + int bad_version = 0xf87a; /* arbitrarily wrong version number */ +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("programmatic ros3 fapl population"); + +#ifndef H5_HAVE_ROS3_VFD + puts(" -SKIP-"); + puts(" Read-Only S3 VFD not enabled"); + fflush(stdout); + return 0; +#else +#if H5TOOLS_UTILS_TEST_DEBUG > 0 + show_progress = TRUE; +#endif /* H5TOOLS_UTILS_TEST_DEBUG */ + + HDassert(bad_version != H5FD__CURR_ROS3_FAPL_T_VERSION); + + /********* + * TESTS * + *********/ + + /* NULL fapl config pointer fails + */ + { + const char *values[] = {"x", "y", "z"}; + + if (show_progress) { HDprintf("NULL fapl pointer\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(NULL, values), + "fapl pointer cannot be null" ) + } + + /* NULL values pointer yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; + + if (show_progress) { HDprintf("NULL values pointer\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, NULL), + "NULL values pointer yields \"default\" fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* all-empty values + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; + const char *values[] = {"", "", ""}; + + if (show_progress) { HDprintf("all empty values\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "empty values yields \"default\" fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* successfully set fapl with values + * excess value is ignored + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", "z", "a"}; + + if (show_progress) { HDprintf("successful full set\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "four values" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( TRUE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "z", fa.secret_key, NULL ) + } + + /* NULL region + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {NULL, "y", "z", NULL}; + + if (show_progress) { HDprintf("NULL region\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty region + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"", "y", "z", NULL}; + + if (show_progress) { HDprintf("empty region; non-empty id, key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* region overflow + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "somewhere over the rainbow not too high " \ + "there is another rainbow bounding some darkened sky", + "y", + "z"}; + + if (show_progress) { HDprintf("region overflow\n"); } + + HDassert(strlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* NULL id + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", NULL, "z", NULL}; + + if (show_progress) { HDprintf("NULL id\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty id (non-empty region, key) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "", "z", NULL}; + + if (show_progress) { HDprintf("empty id; non-empty region and key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* id overflow + * partial set: region + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "x", + "Why is it necessary to solve the problem? " \ + "What benefits will you receive by solving the problem? " \ + "What is the unknown? " \ + "What is it you don't yet understand? " \ + "What is the information you have? " \ + "What isn't the problem? " \ + "Is the information insufficient, redundant, or contradictory? " \ + "Should you draw a diagram or figure of the problem? " \ + "What are the boundaries of the problem? " \ + "Can you separate the various parts of the problem?", + "z"}; + + if (show_progress) { HDprintf("id overflow\n"); } + + HDassert(strlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* NULL key + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", NULL, NULL}; + + if (show_progress) { HDprintf("NULL key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key (non-empty region, id) + * yeilds authenticating fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", "", NULL}; + + if (show_progress) { HDprintf("empty key; non-empty region and id\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( TRUE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key, region (non-empty id) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"", "y", "", NULL}; + + if (show_progress) { HDprintf("empty key and region; non-empty id\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key, id (non-empty region) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "", "", NULL}; + + if (show_progress) { HDprintf("empty key and id; non-empty region\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* key overflow + * partial set: region, id + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "x", + "y", + "Why is it necessary to solve the problem? " \ + "What benefits will you receive by solving the problem? " \ + "What is the unknown? " \ + "What is it you don't yet understand? " \ + "What is the information you have? " \ + "What isn't the problem? " \ + "Is the information insufficient, redundant, or contradictory? " \ + "Should you draw a diagram or figure of the problem? " \ + "What are the boundaries of the problem? " \ + "Can you separate the various parts of the problem?"}; + + if (show_progress) { HDprintf("key overflow\n"); } + + HDassert(strlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* use case + */ + { + H5FD_ros3_fapl_t fa = {0, 0, "", "", ""}; + const char *values[] = { + "us-east-2", + "AKIAIMC3D3XLYXLN5COA", + "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+" + }; + JSVERIFY( 1, + h5tools_populate_ros3_fapl(&fa, values), + "unable to set use case" ) + JSVERIFY( 1, fa.version, "version check" ) + JSVERIFY( 1, fa.authenticate, "should authenticate" ) + } + + PASSED(); + return 0; + +error : + /*********** + * CLEANUP * + ***********/ + + return 1; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_populate_ros3_fa */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_set_configured_fapl() + * + * Purpose: Verify `h5tools_set_configured_fapl()` with ROS3 VFD + * + * Return: 0 if test passes + * 1 if failure + * + * Programmer: Jacob Smith + * 2018-07-12 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_set_configured_fapl(void) +{ +#define UTIL_TEST_NOFAPL 1 +#define UTIL_TEST_DEFAULT 2 +#define UTIL_TEST_CREATE 3 + + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + typedef struct testcase { + const char message[88]; + int expected; + int fapl_choice; + const char vfdname[12]; + void *conf_fa; + } testcase; + + typedef struct other_fa_t { + int a; + int b; + int c; + } other_fa_t; + + /************************ + * TEST-LOCAL VARIABLES * + ************************/ + + hid_t fapl_id = -1; + other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; + H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; + H5FD_ros3_fapl_t ros3_auth_fa = { + 1, /* fapl version */ + TRUE, /* authenticate */ + "us-east-1", /* aws region */ + "12345677890abcdef", /* simulate access key ID */ + "oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */ + }; + H5FD_hdfs_fapl_t hdfs_fa = { + 1, /* fapl version */ + "", /* namenode name */ + 0, /* namenode port */ + "", /* kerberos ticket cache */ + "", /* user name */ + 2048, /* stream buffer size */ + }; + unsigned n_cases = 7; /* number of common testcases */ + testcase cases[] = { + { "(common) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "", + NULL, + }, + { "(common) should fail: no fapl id (with struct)", + 0, + UTIL_TEST_NOFAPL, + "", + &wrong_fa, + }, + { "(common) H5P_DEFAULT with no struct should succeed", + 1, + UTIL_TEST_DEFAULT, + "", + NULL, + }, + { "(common) H5P_DEFAULT with (ignored) struct should succeed", + 1, + UTIL_TEST_DEFAULT, + "", + &wrong_fa, + }, + { "(common) provided fapl entry should not fail", + 1, + UTIL_TEST_CREATE, + "", + NULL, + }, + { "(common) provided fapl entry should not fail; ignores struct", + 1, + UTIL_TEST_CREATE, + "", + &wrong_fa, + }, + { "(common) should fail: unrecoginzed vfd name", + 0, + UTIL_TEST_DEFAULT, + "unknown", + NULL, + }, + +#ifdef H5_HAVE_ROS3_VFD + /* WARNING: add number of ROS3 test cases after array definition + */ + { "(ROS3) should fail: no fapl id, no struct", + 0, + UTIL_TEST_NOFAPL, + "ros3", + NULL, + }, + { "(ROS3) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "ros3", + &ros3_anon_fa, + }, + { "(ROS3) should fail: no struct", + 0, + UTIL_TEST_CREATE, + "ros3", + NULL, + }, + { "(ROS3) successful set", + 1, + UTIL_TEST_CREATE, + "ros3", + &ros3_anon_fa, + }, + { "(ROS3) should fail: attempt to set DEFAULT fapl", + 0, + UTIL_TEST_DEFAULT, + "ros3", + &ros3_anon_fa, + }, +#endif /* H5_HAVE_ROS3_VFD */ + +#ifdef H5_HAVE_LIBHDFS + /* WARNING: add number of HDFS test cases after array definition + */ + { "(HDFS) should fail: no fapl id, no struct", + 0, + UTIL_TEST_NOFAPL, + "hdfs", + NULL, + }, + { "(HDFS) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "hdfs", + &hdfs_fa, + }, + { "(HDFS) should fail: no struct", + 0, + UTIL_TEST_CREATE, + "hdfs", + NULL, + }, + { "(HDFS) successful set", + 1, + UTIL_TEST_CREATE, + "hdfs", + &hdfs_fa, + }, + { "(HDFS) should fail: attempt to set DEFAULT fapl", + 0, + UTIL_TEST_DEFAULT, + "hdfs", + &hdfs_fa, + }, +#endif /* H5_HAVE_LIBHDFS */ + + }; /* testcases `cases` array */ + +#ifdef H5_HAVE_ROS3_VFD + n_cases += 5; +#endif /* H5_HAVE_ROS3_VFD */ + +#ifdef H5_HAVE_LIBHDFS + n_cases += 5; +#endif /* H5_HAVE_LIBHDFS */ + + TESTING("programmatic fapl set"); + + for (unsigned i = 0; i < n_cases; i++) { + int result; + testcase C = cases[i]; + + fapl_id = -1; + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "setup test %d\t%s\n", i, C.message); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* per-test setup */ + if (C.fapl_choice == UTIL_TEST_DEFAULT) { + fapl_id = H5P_DEFAULT; + } else if (C.fapl_choice == UTIL_TEST_CREATE) { + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + } + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "before test\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* test */ + result = h5tools_set_configured_fapl( + fapl_id, + C.vfdname, + C.conf_fa); + JSVERIFY( result, C.expected, C.message ) + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after test\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* per-test-teardown */ + if (fapl_id > 0) { + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + } + fapl_id = -1; + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after cleanup\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + } + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after loop\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + PASSED(); + return 0; + +error : + /*********** + * CLEANUP * + ***********/ + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "ERROR\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + if (fapl_id > 0) { + (void)H5Pclose(fapl_id); + } + + return 1; + +#undef UTIL_TEST_NOFAPL +#undef UTIL_TEST_DEFAULT +#undef UTIL_TEST_CREATE +} /* test_set_configured_fapl */ + + +/*---------------------------------------------------------------------------- + * + * Function: main() + * + * Purpose: Run all test functions. + * + * Return: 0 iff all test pass + * 1 iff any failures + * + * Programmer: Jacob Smith + * 2017-11-10 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrors = 0; + +#ifdef _H5TEST_ + h5reset(); /* h5test? */ +#endif /* _H5TEST_ */ + + HDfprintf(stdout, "Testing h5tools_utils corpus.\n"); + + nerrors += test_parse_tuple(); + nerrors += test_populate_ros3_fa(); + nerrors += test_set_configured_fapl(); + + if (nerrors > 0) { + HDfprintf(stdout, "***** %d h5tools_utils TEST%s FAILED! *****\n", + nerrors, + nerrors > 1 ? "S" : ""); + nerrors = 1; + } else { + HDfprintf(stdout, "All h5tools_utils tests passed\n"); + } + + return (int)nerrors; + +} /* main */ + + diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index b9e37e8..a824197 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -24,6 +24,23 @@ static int doxml = 0; static int useschema = 1; static const char *xml_dtd_uri = NULL; +static H5FD_ros3_fapl_t ros3_fa = { + 1, /* version */ + false, /* authenticate */ + "", /* aws region */ + "", /* access key id */ + "", /* secret access key */ +}; + +static H5FD_hdfs_fapl_t hdfs_fa = { + 1, /* fapl version */ + "localhost", /* namenode name */ + 0, /* namenode port */ + "", /* kerberos ticket cache */ + "", /* user name */ + 2048, /* stream buffer size */ +}; + /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" #define DEFAULT_DTD "http://www.hdfgroup.org/HDF5/XML/DTD/HDF5-File.dtd" @@ -188,6 +205,8 @@ static struct long_options l_opts[] = { { "any_path", require_arg, 'N' }, { "vds-view-first-missing", no_arg, 'v' }, { "vds-gap-size", require_arg, 'G' }, + { "s3-cred", require_arg, '$' }, + { "hdfs-attrs", require_arg, '#' }, { NULL, 0, '\0' } }; @@ -241,6 +260,16 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n"); PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, " --s3-cred= Supply S3 authentication information to \"ros3\" vfd.\n"); + PRINTVALSTREAM(rawoutstream, " :: \"(,,)\"\n"); + PRINTVALSTREAM(rawoutstream, " If absent or -> \"(,,)\", no authentication.\n"); + PRINTVALSTREAM(rawoutstream, " Has no effect is filedriver is not `ros3'.\n"); + PRINTVALSTREAM(rawoutstream, " --hdfs-attrs= Supply configuration information for HDFS file access.\n"); + PRINTVALSTREAM(rawoutstream, " For use with \"--filedriver=hdfs\"\n"); + PRINTVALSTREAM(rawoutstream, " :: (,,\n"); + PRINTVALSTREAM(rawoutstream, " ,,\n"); + PRINTVALSTREAM(rawoutstream, " )\n"); + PRINTVALSTREAM(rawoutstream, " Any absent attribute will use a default value.\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); @@ -1282,6 +1311,126 @@ end_collect: hand = NULL; h5tools_setstatus(EXIT_SUCCESS); goto done; + + case '$': +#ifndef H5_HAVE_ROS3_VFD + error_msg("Read-Only S3 VFD not enabled.\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; +#else + /* s3 credential */ + { + char **s3_cred = NULL; + char *s3_cred_string = NULL; + const char *ccred[3]; + unsigned nelems = 0; + if ( FAIL == + parse_tuple(opt_arg, ',', + &s3_cred_string, &nelems, &s3_cred)) + { + error_msg("unable to parse malformed s3 credentials\n"); + usage(h5tools_getprogname()); + free_handler(hand, argc); + hand= NULL; + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if (nelems != 3) { + error_msg("s3 credentials expects 3 elements\n"); + usage(h5tools_getprogname()); + free_handler(hand, argc); + hand= NULL; + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + ccred[0] = (const char *)s3_cred[0]; + ccred[1] = (const char *)s3_cred[1]; + ccred[2] = (const char *)s3_cred[2]; + if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) { + error_msg("Invalid S3 credentials\n"); + usage(h5tools_getprogname()); + free_handler(hand, argc); + hand= NULL; + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + HDfree(s3_cred); + HDfree(s3_cred_string); + } /* s3 credential block */ + break; +#endif /* H5_HAVE_ROS3_VFD */ + + case '#': +#ifndef H5_HAVE_LIBHDFS + error_msg("HDFS VFD is not enabled.\n"); + goto error; +#else + { + /* read hdfs properties tuple and store values in `hdfs_fa` + */ + unsigned nelems = 0; + char *props_src = NULL; + char **props = NULL; + unsigned long k = 0; + if (FAIL == parse_tuple( + (const char *)opt_arg, + ',', + &props_src, + &nelems, + &props)) + { + error_msg("unable to parse hdfs properties tuple\n"); + goto error; + } + /* sanity-check tuple count + */ + if (nelems != 5) { + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + /* Populate fapl configuration structure with given + * properties. + * WARNING: No error-checking is done on length of input + * strings... Silent overflow is possible, albeit + * unlikely. + */ + if (strncmp(props[0], "", 1)) { + HDstrncpy(hdfs_fa.namenode_name, + (const char *)props[0], + HDstrlen(props[0])); + } + if (strncmp(props[1], "", 1)) { + k = strtoul((const char *)props[1], NULL, 0); + if (errno == ERANGE) { + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + hdfs_fa.namenode_port = (int32_t)k; + } + if (strncmp(props[2], "", 1)) { + HDstrncpy(hdfs_fa.kerberos_ticket_cache, + (const char *)props[2], + HDstrlen(props[2])); + } + if (strncmp(props[3], "", 1)) { + HDstrncpy(hdfs_fa.user_name, + (const char *)props[3], + HDstrlen(props[3])); + } + if (strncmp(props[4], "", 1)) { + k = strtoul((const char *)props[4], NULL, 0); + if (errno == ERANGE) { + h5tools_setstatus(EXIT_FAILURE); + goto error; + } + hdfs_fa.stream_buffer_size = (int32_t)k; + } + HDfree(props); + HDfree(props_src); + } +#endif /* H5_HAVE_LIBHDFS */ + break; + case '?': default: usage(h5tools_getprogname()); @@ -1354,6 +1503,7 @@ main(int argc, const char *argv[]) { hid_t fid = -1; hid_t gid = -1; + hid_t fapl_id = H5P_DEFAULT; H5E_auto2_t func; H5E_auto2_t tools_func; H5O_info_t oi; @@ -1440,10 +1590,60 @@ main(int argc, const char *argv[]) /* Initialize indexing options */ h5trav_set_index(sort_by, sort_order); + if (driver != NULL) { + void *conf_fa = NULL; + + if (!strcmp(driver, "ros3")) { +#ifndef H5_HAVE_ROS3_VFD + error_msg("Read-Only S3 VFD not enabled.\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; +#else + conf_fa = (void *)&ros3_fa; +#endif /* H5_HAVE_ROS3_VFD */ + } else if (!HDstrcmp(driver, "hdfs")) { +#ifndef H5_HAVE_LIBHDFS + error_msg("HDFS VFD is not enabled.\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; +#else + conf_fa = (void *)&hdfs_fa; +#endif /* H5_HAVE_LIBHDFS */ + } + + if (conf_fa != NULL) { + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (fapl_id < 0) { + error_msg("unable to create fapl entry\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + if (0 == h5tools_set_configured_fapl( + fapl_id, + driver, /* guaranteed "ros3" or "hdfs" */ + conf_fa)) /* appropriate to driver */ + { + error_msg("unable to set fapl\n"); + h5tools_setstatus(EXIT_FAILURE); + goto done; + } + } + } /* driver defined */ + while(opt_ind < argc) { fname = HDstrdup(argv[opt_ind++]); - fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); + if (fapl_id != H5P_DEFAULT) { + fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); + } else { + fid = h5tools_fopen( + fname, + H5F_ACC_RDONLY, + H5P_DEFAULT, + driver, + NULL, + 0); + } if (fid < 0) { error_msg("unable to open file \"%s\"\n", fname); @@ -1624,6 +1824,11 @@ done: /* Free tables for objects */ table_list_free(); + if (fapl_id != H5P_DEFAULT && 0 < H5Pclose(fapl_id)) { + error_msg("Can't close fapl entry\n"); + h5tools_setstatus(EXIT_FAILURE); + } + if(fid >=0) if (H5Fclose(fid) < 0) h5tools_setstatus(EXIT_FAILURE); @@ -1645,127 +1850,7 @@ done: H5Eset_auto2(H5E_DEFAULT, func, edata); leave(h5tools_getstatus()); -} - -/*------------------------------------------------------------------------- - * Function: h5_fileaccess - * - * Purpose: Returns a file access template which is the default template - * but with a file driver set according to the constant or - * environment variable HDF5_DRIVER - * - * Return: Success: A file access property list - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, November 19, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hid_t -h5_fileaccess(void) -{ - static const char *multi_letters = "msbrglo"; - const char *val = NULL; - const char *name; - char s[1024]; - hid_t fapl = -1; - - /* First use the environment variable, then the constant */ - val = HDgetenv("HDF5_DRIVER"); -#ifdef HDF5_DRIVER - if (!val) val = HDF5_DRIVER; -#endif - - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1; - if (!val || !*val) return fapl; /*use default*/ - - HDstrncpy(s, val, sizeof s); - s[sizeof(s)-1] = '\0'; - if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl; - - if (!HDstrcmp(name, "sec2")) { - /* Unix read() and write() system calls */ - if (H5Pset_fapl_sec2(fapl)<0) return -1; - } - else if (!HDstrcmp(name, "stdio")) { - /* Standard C fread() and fwrite() system calls */ - if (H5Pset_fapl_stdio(fapl)<0) return -1; - } - else if (!HDstrcmp(name, "core")) { - /* In-core temporary file with 1MB increment */ - if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1; - } - else if (!HDstrcmp(name, "split")) { - /* Split meta data and raw data each using default driver */ - if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - return -1; - } - else if (!HDstrcmp(name, "multi")) { - /* Multi-file driver, general case of the split driver */ - H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; - hid_t memb_fapl[H5FD_MEM_NTYPES]; - const char *memb_name[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][1024]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; - H5FD_mem_t mt; - - HDmemset(memb_map, 0, sizeof memb_map); - HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset(memb_name, 0, sizeof memb_name); - HDmemset(memb_addr, 0, sizeof memb_addr); - - if(HDstrlen(multi_letters)==H5FD_MEM_NTYPES) { - for (mt=H5FD_MEM_DEFAULT; mt,,)\".\n"); + PRINTVALSTREAM(rawoutstream, " If absent or C->\"(,,)\", defaults to no-authentication.\n"); + PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag not set to \"ros3\".\n"); + PRINTVALSTREAM(rawoutstream, " --hdfs-attrs=A Supply configuration information to Hadoop VFD.\n"); + PRINTVALSTREAM(rawoutstream, " Accepts tuple of (,,\n"); + PRINTVALSTREAM(rawoutstream, " ...,,)\n"); + PRINTVALSTREAM(rawoutstream, " If absent or A == '(,,,,)', all default values are used.\n"); + PRINTVALSTREAM(rawoutstream, " Has no effect if vfd flag is not 'hdfs'.\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " file/OBJECT\n"); PRINTVALSTREAM(rawoutstream, " Each object consists of an HDF5 file name optionally followed by a\n"); @@ -237,7 +246,7 @@ usage (void) PRINTVALSTREAM(rawoutstream, " Replaced by --enable-error-stack.\n"); } - + /*------------------------------------------------------------------------- * Function: print_string @@ -315,7 +324,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) return nprint; } - + /*------------------------------------------------------------------------- * Function: print_obj_name * @@ -364,7 +373,7 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_native_type * @@ -489,7 +498,7 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_ieee_type * @@ -527,7 +536,7 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_precision * @@ -619,7 +628,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) } } - + /*------------------------------------------------------------------------- * Function: print_int_type * @@ -693,7 +702,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_float_type * @@ -807,7 +816,7 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_cmpd_type * @@ -860,7 +869,7 @@ print_cmpd_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_enum_type * @@ -985,7 +994,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_string_type * @@ -1086,7 +1095,7 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_reference_type * @@ -1124,7 +1133,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_opaque_type * @@ -1160,7 +1169,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_vlen_type * @@ -1190,7 +1199,7 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*--------------------------------------------------------------------------- * Purpose: Print information about an array type * @@ -1237,7 +1246,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) return TRUE; } - + /*------------------------------------------------------------------------- * Function: print_bitfield_type * @@ -1345,7 +1354,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) (unsigned long)H5Tget_size(type), (unsigned)data_class); } - + /*------------------------------------------------------------------------- * Function: dump_dataset_values * @@ -1475,7 +1484,7 @@ dump_dataset_values(hid_t dset) PRINTVALSTREAM(rawoutstream, "\n"); } - + /*------------------------------------------------------------------------- * Function: list_attr * @@ -1662,7 +1671,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain return 0; } - + /*------------------------------------------------------------------------- * Function: dataset_list1 * @@ -1727,7 +1736,7 @@ dataset_list1(hid_t dset) return 0; } - + /*------------------------------------------------------------------------- * Function: dataset_list2 * @@ -1962,7 +1971,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) return 0; } /* end dataset_list2() */ - + /*------------------------------------------------------------------------- * Function: datatype_list2 * @@ -2004,7 +2013,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) return 0; } - + /*------------------------------------------------------------------------- * Function: list_obj * @@ -2160,7 +2169,7 @@ done: } /* end list_obj() */ - + /*------------------------------------------------------------------------- * Function: list_lnk * @@ -2354,7 +2363,7 @@ done: return 0; } /* end list_lnk() */ - + /*------------------------------------------------------------------------- * Function: visit_obj * @@ -2434,7 +2443,7 @@ done: return retval; } - + /*------------------------------------------------------------------------- * Function: get_width * @@ -2550,7 +2559,7 @@ out: return ret; } - + /*------------------------------------------------------------------------- * Function: leave * @@ -2573,7 +2582,7 @@ leave(int ret) HDexit(ret); } - + /*------------------------------------------------------------------------- * Function: main * @@ -2602,6 +2611,26 @@ main(int argc, const char *argv[]) char drivername[50]; const char *preferred_driver = NULL; int err_exit = 0; + hid_t fapl_id = H5P_DEFAULT; + + /* default "anonymous" s3 configuration */ + H5FD_ros3_fapl_t ros3_fa = { + 1, /* fapl version */ + false, /* authenticate */ + "", /* aws region */ + "", /* access key id */ + "", /* secret access key */ + }; + + /* "default" HDFS configuration */ + H5FD_hdfs_fapl_t hdfs_fa = { + 1, /* fapl version */ + "localhost", /* namenode name */ + 0, /* namenode port */ + "", /* kerberos ticket cache */ + "", /* user name */ + 2048, /* stream buffer size */ + }; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -2701,6 +2730,185 @@ main(int argc, const char *argv[]) usage(); leave(EXIT_FAILURE); } + + } else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) { +#ifndef H5_HAVE_ROS3_VFD + HDfprintf(rawerrorstream, + "Error: Read-Only S3 VFD is not enabled\n\n"); + usage(); + leave(EXIT_FAILURE); +#else + unsigned nelems = 0; + char *start = NULL; + char *s3cred_src = NULL; + char **s3cred = NULL; + char const *ccred[3]; + /* try to parse s3 credentials tuple + */ + start = strchr(argv[argno], '='); + if (start == NULL) { + HDfprintf(rawerrorstream, + "Error: Unable to parse null credentials tuple\n" + " For anonymous access, omit \"--s3-cred\" and use" + "only \"--vfd=ros3\"\n\n"); + usage(); + leave(EXIT_FAILURE); + } + start++; + if (FAIL == + parse_tuple((const char *)start, ',', + &s3cred_src, &nelems, &s3cred)) + { + HDfprintf(rawerrorstream, + "Error: Unable to parse S3 credentials\n\n"); + usage(); + leave(EXIT_FAILURE); + } + /* sanity-check tuple count + */ + if (nelems != 3) { + HDfprintf(rawerrorstream, + "Error: Invalid S3 credentials\n\n"); + usage(); + leave(EXIT_FAILURE); + } + ccred[0] = (const char *)s3cred[0]; + ccred[1] = (const char *)s3cred[1]; + ccred[2] = (const char *)s3cred[2]; + if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) { + HDfprintf(rawerrorstream, + "Error: Invalid S3 credentials\n\n"); + usage(); + leave(EXIT_FAILURE); + } + HDfree(s3cred); + HDfree(s3cred_src); +#endif /* H5_HAVE_ROS3_VFD */ + + } else if (!HDstrncmp(argv[argno], "--hdfs-attrs=", (size_t)13)) { +#ifndef H5_HAVE_LIBHDFS + PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n"); + leave(EXIT_FAILURE); +#else + /* Parse received configuration data and set fapl config struct + */ + + hbool_t _debug = FALSE; + unsigned nelems = 0; + char const *start = NULL; + char *props_src = NULL; + char **props = NULL; + unsigned long k = 0; + + /* try to parse tuple + */ + if (_debug) { + HDfprintf(stderr, "configuring hdfs...\n"); + } + start = argv[argno]+13; /* should never segfault: worst case of */ + if (*start != '(') /* null-termintor after '='. */ + { + if (_debug) { + HDfprintf(stderr, " no tuple.\n"); + } + usage(); + leave(EXIT_FAILURE); + } + if (FAIL == + parse_tuple((const char *)start, ',', + &props_src, &nelems, &props)) + { + HDfprintf(stderr, + " unable to parse tuple.\n"); + usage(); + leave(EXIT_FAILURE); + } + + /* sanity-check tuple count + */ + if (nelems != 5) { + HDfprintf(stderr, + " expected 5-ple, got `%d`\n", + nelems); + usage(); + leave(EXIT_FAILURE); + } + if (_debug) { + HDfprintf(stderr, + " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n", + props[0], + props[1], + props[2], + props[3], + props[4]); + } + + /* Populate fapl configuration structure with given properties. + * WARNING: No error-checking is done on length of input strings... + * Silent overflow is possible, albeit unlikely. + */ + if (HDstrncmp(props[0], "", 1)) { + if (_debug) { + HDfprintf(stderr, + " setting namenode name: %s\n", + props[0]); + } + HDstrncpy(hdfs_fa.namenode_name, + (const char *)props[0], + HDstrlen(props[0])); + } + if (HDstrncmp(props[1], "", 1)) { + k = strtoul((const char *)props[1], NULL, 0); + if (errno == ERANGE) { + HDfprintf(stderr, + " supposed port number wasn't.\n"); + leave(EXIT_FAILURE); + } + if (_debug) { + HDfprintf(stderr, + " setting namenode port: %lu\n", + k); + } + hdfs_fa.namenode_port = (int32_t)k; + } + if (HDstrncmp(props[2], "", 1)) { + if (_debug) { + HDfprintf(stderr, + " setting kerb cache path: %s\n", + props[2]); + } + HDstrncpy(hdfs_fa.kerberos_ticket_cache, + (const char *)props[2], + HDstrlen(props[2])); + } + if (HDstrncmp(props[3], "", 1)) { + if (_debug) { + HDfprintf(stderr, + " setting username: %s\n", + props[3]); + } + HDstrncpy(hdfs_fa.user_name, + (const char *)props[3], + HDstrlen(props[3])); + } + if (HDstrncmp(props[4], "", 1)) { + k = HDstrtoul((const char *)props[4], NULL, 0); + if (errno == ERANGE) { + HDfprintf(stderr, + " supposed buffersize number wasn't.\n"); + leave(EXIT_FAILURE); + } + if (_debug) { + HDfprintf(stderr, + " setting stream buffer size: %lu\n", + k); + } + hdfs_fa.stream_buffer_size = (int32_t)k; + } + HDfree(props); + HDfree(props_src); +#endif /* H5_HAVE_LIBHDFS */ + } else if('-'!=argv[argno][1]) { /* Single-letter switches */ for(s = argv[argno] + 1; *s; s++) { @@ -2772,6 +2980,7 @@ main(int argc, const char *argv[]) } /* end switch */ } /* end for */ } else { + HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]); usage(); leave(EXIT_FAILURE); } @@ -2791,6 +3000,49 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } + if (preferred_driver) { + void *conf_fa = NULL; + + if (!HDstrcmp(preferred_driver, "ros3")) { +#ifndef H5_HAVE_ROS3_VFD + HDfprintf(rawerrorstream, + "Error: Read-Only S3 VFD not enabled.\n\n"); + usage(); + leave(EXIT_FAILURE); +#else + conf_fa = (void *)&ros3_fa; +#endif /* H5_HAVE_ROS3_VFD */ + + } else if (!HDstrcmp(preferred_driver, "hdfs")) { +#ifndef H5_HAVE_LIBHDFS + PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n"); + leave(EXIT_FAILURE); +#else + conf_fa = (void *)&hdfs_fa; +#endif /* H5_HAVE_LIBHDFS */ + } + + if (conf_fa != NULL) { + HDassert(fapl_id == H5P_DEFAULT); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (fapl_id < 0) { + HDfprintf(rawerrorstream, + "Error: Unable to create fapl entry\n\n"); + leave(EXIT_FAILURE); + } + if (0 == h5tools_set_configured_fapl( + fapl_id, + preferred_driver, + conf_fa)) + { + HDfprintf(rawerrorstream, + "Error: Unable to set fapl\n\n"); + usage(); + leave(EXIT_FAILURE); + } + } + } /* preferred_driver defined */ + /* Turn off HDF5's automatic error printing unless you're debugging h5ls */ if(!show_errors_g) H5Eset_auto2(H5E_DEFAULT, NULL, NULL); @@ -2820,7 +3072,12 @@ main(int argc, const char *argv[]) file = -1; while(fname && *fname) { - file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); + if (fapl_id != H5P_DEFAULT) { + file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); + } + else { + file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); + } if(file >= 0) { if(verbose_g) @@ -2933,6 +3190,14 @@ main(int argc, const char *argv[]) err_exit = 1; } /* end while */ + if (fapl_id != H5P_DEFAULT) { + if (0 < H5Pclose(fapl_id)) { + HDfprintf(rawerrorstream, + "Error: Unable to set close fapl entry\n\n"); + leave(EXIT_FAILURE); + } + } + if (err_exit) leave(EXIT_FAILURE); else diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 450f731..59038a0 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -74,7 +74,7 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ @@ -118,6 +118,29 @@ typedef struct iter_t { } iter_t; +static const char *drivername = ""; + +/* default "anonymous" s3 configuration + */ +static H5FD_ros3_fapl_t ros3_fa = { + 1, /* fapl version */ + false, /* authenticate */ + "", /* aws region */ + "", /* access key id */ + "", /* secret access key */ +}; + +/* default HDFS access configuration + */ +static H5FD_hdfs_fapl_t hdfs_fa = { + 1, /* fapl version */ + "localhost", /* namenode name */ + 0, /* namenode port */ + "", /* kerberos ticket cache */ + "", /* user name */ + 2048, /* stream buffer size */ +}; + static int display_all = TRUE; /* Enable the printing of selected statistics */ @@ -146,7 +169,7 @@ struct handler_t { char **obj; }; -static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:V"; +static const char *s_opts ="Aa:Ddm:EFfhGgl:sSTO:Vw:"; /* e.g. "filemetadata" has to precede "file"; "groupmetadata" has to precede "group" etc. */ static struct long_options l_opts[] = { {"help", no_arg, 'h'}, @@ -246,6 +269,8 @@ static struct long_options l_opts[] = { { "summ", no_arg, 'S' }, { "sum", no_arg, 'S' }, { "su", no_arg, 'S' }, + { "s3-cred", require_arg, 'w' }, + { "hdfs-attrs", require_arg, 'H' }, { NULL, 0, '\0' } }; @@ -257,7 +282,7 @@ leave(int ret) } - + /*------------------------------------------------------------------------- * Function: usage * @@ -295,9 +320,19 @@ static void usage(const char *prog) HDfprintf(stdout, " -s, --freespace Print free space information\n"); HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); + HDfprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n"); + HDfprintf(stdout, " :: (region,id,key)\n"); + HDfprintf(stdout, " If == \"(,,)\", no authentication is used.\n"); + HDfprintf(stdout, " --hdfs-attrs= Access a file on HDFS with given configuration\n"); + HDfprintf(stdout, " attributes.\n"); + HDfprintf(stdout, " :: (,,\n"); + HDfprintf(stdout, " ,,\n"); + HDfprintf(stdout, " )\n"); + HDfprintf(stdout, " If an attribute is empty, a default value will be\n"); + HDfprintf(stdout, " used.\n"); } - + /*------------------------------------------------------------------------- * Function: ceil_log10 * @@ -324,7 +359,7 @@ ceil_log10(unsigned long x) return ret; } /* ceil_log10() */ - + /*------------------------------------------------------------------------- * Function: attribute_stats * @@ -374,7 +409,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) return 0; } /* end attribute_stats() */ - + /*------------------------------------------------------------------------- * Function: group_stats * @@ -456,7 +491,7 @@ done: return ret_value; } /* end group_stats() */ - + /*------------------------------------------------------------------------- * Function: dataset_stats * @@ -647,7 +682,7 @@ done: return ret_value; } /* end dataset_stats() */ - + /*------------------------------------------------------------------------- * Function: datatype_stats * @@ -679,7 +714,7 @@ done: return ret_value; } /* end datatype_stats() */ - + /*------------------------------------------------------------------------- * Function: obj_stats * @@ -735,7 +770,7 @@ done: return ret_value; } /* end obj_stats() */ - + /*------------------------------------------------------------------------- * Function: lnk_stats * @@ -833,7 +868,7 @@ freespace_stats(hid_t fid, iter_t *iter) return 0; } /* end freespace_stats() */ - + /*------------------------------------------------------------------------- * Function: hand_free * @@ -862,7 +897,7 @@ hand_free(struct handler_t *hand) } /* end if */ } /* end hand_free() */ - + /*------------------------------------------------------------------------- * Function: parse_command_line * @@ -1014,6 +1049,119 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) } /* end if */ break; + case 'w': +#ifndef H5_HAVE_ROS3_VFD + error_msg("Read-Only S3 VFD not enabled.\n"); + goto error; +#else + { + char *cred_str = NULL; + unsigned nelems = 0; + char **cred = NULL; + char const *ccred[3]; + + if (FAIL == parse_tuple((const char *)opt_arg, ',', + &cred_str, &nelems, &cred)) { + error_msg("Unable to parse s3 credential\n"); + goto error; + } + if (nelems != 3) { + error_msg("s3 credential must have three elements\n"); + goto error; + } + ccred[0] = (const char *)cred[0]; + ccred[1] = (const char *)cred[1]; + ccred[2] = (const char *)cred[2]; + if (0 == + h5tools_populate_ros3_fapl(&ros3_fa, ccred)) + { + error_msg("Unable to set ros3 fapl config\n"); + goto error; + } + HDfree(cred); + HDfree(cred_str); + } /* parse s3-cred block */ + drivername = "ros3"; + break; +#endif /* H5_HAVE_ROS3_VFD */ + + case 'H': +#ifndef H5_HAVE_LIBHDFS + error_msg("HDFS VFD is not enabled.\n"); + goto error; +#else + { + unsigned nelems = 0; + char *props_src = NULL; + char **props = NULL; + unsigned long k = 0; + if (FAIL == parse_tuple( + (const char *)opt_arg, + ',', + &props_src, + &nelems, + &props)) + { + error_msg("unable to parse hdfs properties tuple\n"); + goto error; + } + /* sanity-check tuple count + */ + if (nelems != 5) { + char str[64] = ""; + sprintf(str, + "expected 5 elements in hdfs properties tuple " + "but found %u\n", + nelems); + HDfree(props); + HDfree(props_src); + error_msg(str); + goto error; + } + /* Populate fapl configuration structure with given + * properties. + * TODO/WARNING: No error-checking is done on length of + * input strings... Silent overflow is possible, + * albeit unlikely. + */ + if (strncmp(props[0], "", 1)) { + HDstrncpy(hdfs_fa.namenode_name, + (const char *)props[0], + HDstrlen(props[0])); + } + if (strncmp(props[1], "", 1)) { + k = strtoul((const char *)props[1], NULL, 0); + if (errno == ERANGE) { + error_msg("supposed port number wasn't.\n"); + goto error; + } + hdfs_fa.namenode_port = (int32_t)k; + } + if (strncmp(props[2], "", 1)) { + HDstrncpy(hdfs_fa.kerberos_ticket_cache, + (const char *)props[2], + HDstrlen(props[2])); + } + if (strncmp(props[3], "", 1)) { + HDstrncpy(hdfs_fa.user_name, + (const char *)props[3], + HDstrlen(props[3])); + } + if (strncmp(props[4], "", 1)) { + k = strtoul((const char *)props[4], NULL, 0); + if (errno == ERANGE) { + error_msg("supposed buffersize number wasn't.\n"); + goto error; + } + hdfs_fa.stream_buffer_size = (int32_t)k; + } + HDfree(props); + HDfree(props_src); + drivername = "hdfs"; + } + break; +#endif /* H5_HAVE_LIBHDFS */ + default: usage(h5tools_getprogname()); goto error; @@ -1040,7 +1188,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: iter_free * @@ -1105,7 +1253,7 @@ iter_free(iter_t *iter) } /* end if */ } /* end iter_free() */ - + /*------------------------------------------------------------------------- * Function: print_file_info * @@ -1137,7 +1285,7 @@ print_file_info(const iter_t *iter) return 0; } /* print_file_info() */ - + /*------------------------------------------------------------------------- * Function: print_file_metadata * @@ -1197,7 +1345,7 @@ print_file_metadata(const iter_t *iter) return 0; } /* print_file_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_group_info * @@ -1254,7 +1402,7 @@ print_group_info(const iter_t *iter) return 0; } /* print_group_info() */ - + /*------------------------------------------------------------------------- * Function: print_group_metadata * @@ -1281,7 +1429,7 @@ print_group_metadata(const iter_t *iter) return 0; } /* print_group_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_info * @@ -1368,7 +1516,7 @@ print_dataset_info(const iter_t *iter) return 0; } /* print_dataset_info() */ - + /*------------------------------------------------------------------------- * Function: print_dataset_metadata * @@ -1397,7 +1545,7 @@ print_dset_metadata(const iter_t *iter) return 0; } /* print_dset_metadata() */ - + /*------------------------------------------------------------------------- * Function: print_dset_dtype_meta * @@ -1438,7 +1586,7 @@ print_dset_dtype_meta(const iter_t *iter) return 0; } /* print_dset_dtype_meta() */ - + /*------------------------------------------------------------------------- * Function: print_attr_info * @@ -1487,7 +1635,7 @@ print_attr_info(const iter_t *iter) return 0; } /* print_attr_info() */ - + /*------------------------------------------------------------------------- * Function: print_freespace_info * @@ -1537,7 +1685,7 @@ print_freespace_info(const iter_t *iter) return 0; } /* print_freespace_info() */ - + /*------------------------------------------------------------------------- * Function: print_storage_summary * @@ -1601,7 +1749,7 @@ print_storage_summary(const iter_t *iter) return 0; } /* print_storage_summary() */ - + /*------------------------------------------------------------------------- * Function: print_file_statistics * @@ -1648,7 +1796,7 @@ print_file_statistics(const iter_t *iter) if(display_summary) print_storage_summary(iter); } /* print_file_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_object_statistics * @@ -1671,7 +1819,7 @@ print_object_statistics(const char *name) printf("Object name %s\n", name); } /* print_object_statistics() */ - + /*------------------------------------------------------------------------- * Function: print_statistics * @@ -1697,7 +1845,7 @@ print_statistics(const char *name, const iter_t *iter) print_file_statistics(iter); } /* print_statistics() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -1718,6 +1866,7 @@ main(int argc, const char *argv[]) void *edata; void *tools_edata; struct handler_t *hand = NULL; + hid_t fapl_id = H5P_DEFAULT; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -1738,6 +1887,45 @@ main(int argc, const char *argv[]) if(parse_command_line(argc, argv, &hand) < 0) goto done; + /* if drivername is not null, probably need to set the fapl */ + if (HDstrcmp(drivername, "")) { + void *conf_fa = NULL; + + if (!HDstrcmp(drivername, "ros3")) { +#ifndef H5_HAVE_ROS3_VFD + error_msg("Read-Only S3 VFD not enabled.\n\n"); + goto done; +#else + conf_fa = (void *)&ros3_fa; +#endif /* H5_HAVE_ROS3_VFD */ + + } else if (!HDstrcmp(drivername, "hdfs")) { +#ifndef H5_HAVE_LIBHDFS + error_msg("HDFS VFD not enabled.\n\n"); + goto done; +#else + conf_fa = (void *)&hdfs_fa; +#endif /* H5_HAVE_LIBHDFS */ + } + + if (conf_fa != NULL) { + HDassert(fapl_id == H5P_DEFAULT); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + if (fapl_id < 0) { + error_msg("Unable to create fapl entry\n"); + goto done; + } + if (1 > h5tools_set_configured_fapl( + fapl_id, + drivername, + conf_fa)) + { + error_msg("Unable to set fapl\n"); + goto done; + } + } + } /* drivername set */ + fname = argv[opt_ind]; if(enable_error_stack > 0) { @@ -1752,7 +1940,7 @@ main(int argc, const char *argv[]) printf("Filename: %s\n", fname); - fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); + fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); if(fid < 0) { error_msg("unable to open file \"%s\"\n", fname); h5tools_setstatus(EXIT_FAILURE); @@ -1833,6 +2021,13 @@ done: /* Free iter structure */ iter_free(&iter); + if (fapl_id != H5P_DEFAULT) { + if (0 < H5Pclose(fapl_id)) { + error_msg("unable to close fapl entry\n"); + h5tools_setstatus(EXIT_FAILURE); + } + } + if(fid >= 0 && H5Fclose(fid) < 0) { error_msg("unable to close file \"%s\"\n", fname); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/test/h5stat/testfiles/h5stat_help1.ddl b/tools/test/h5stat/testfiles/h5stat_help1.ddl index 01e39af..2ba7772 100644 --- a/tools/test/h5stat/testfiles/h5stat_help1.ddl +++ b/tools/test/h5stat/testfiles/h5stat_help1.ddl @@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur + --s3-cred= Access file on S3, using provided credential + :: (region,id,key) + If == "(,,)", no authentication is used. + --hdfs-attrs= Access a file on HDFS with given configuration + attributes. + :: (,, + ,, + ) + If an attribute is empty, a default value will be + used. diff --git a/tools/test/h5stat/testfiles/h5stat_help2.ddl b/tools/test/h5stat/testfiles/h5stat_help2.ddl index 01e39af..2ba7772 100644 --- a/tools/test/h5stat/testfiles/h5stat_help2.ddl +++ b/tools/test/h5stat/testfiles/h5stat_help2.ddl @@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur + --s3-cred= Access file on S3, using provided credential + :: (region,id,key) + If == "(,,)", no authentication is used. + --hdfs-attrs= Access a file on HDFS with given configuration + attributes. + :: (,, + ,, + ) + If an attribute is empty, a default value will be + used. diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl index 01e39af..2ba7772 100644 --- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl +++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl @@ -23,3 +23,13 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur + --s3-cred= Access file on S3, using provided credential + :: (region,id,key) + If == "(,,)", no authentication is used. + --hdfs-attrs= Access a file on HDFS with given configuration + attributes. + :: (,, + ,, + ) + If an attribute is empty, a default value will be + used. diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 19de76f..95dfc3b 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/help-1.ls b/tools/testfiles/help-1.ls index 491f696..396bed3 100644 --- a/tools/testfiles/help-1.ls +++ b/tools/testfiles/help-1.ls @@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] -V, --version Print version number and exit --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format + --s3-cred=C Supply S3 authentication information to "ros3" vfd. + Accepts tuple of "(,,)". + If absent or C->"(,,)", defaults to no-authentication. + Has no effect if vfd flag not set to "ros3". + --hdfs-attrs=A Supply configuration information to Hadoop VFD. + Accepts tuple of (,, + ...,,) + If absent or A == '(,,,,)', all default values are used. + Has no effect if vfd flag is not 'hdfs'. file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/help-2.ls b/tools/testfiles/help-2.ls index 491f696..396bed3 100644 --- a/tools/testfiles/help-2.ls +++ b/tools/testfiles/help-2.ls @@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] -V, --version Print version number and exit --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format + --s3-cred=C Supply S3 authentication information to "ros3" vfd. + Accepts tuple of "(,,)". + If absent or C->"(,,)", defaults to no-authentication. + Has no effect if vfd flag not set to "ros3". + --hdfs-attrs=A Supply configuration information to Hadoop VFD. + Accepts tuple of (,, + ...,,) + If absent or A == '(,,,,)', all default values are used. + Has no effect if vfd flag is not 'hdfs'. file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/help-3.ls b/tools/testfiles/help-3.ls index 491f696..396bed3 100644 --- a/tools/testfiles/help-3.ls +++ b/tools/testfiles/help-3.ls @@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] -V, --version Print version number and exit --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format + --s3-cred=C Supply S3 authentication information to "ros3" vfd. + Accepts tuple of "(,,)". + If absent or C->"(,,)", defaults to no-authentication. + Has no effect if vfd flag not set to "ros3". + --hdfs-attrs=A Supply configuration information to Hadoop VFD. + Accepts tuple of (,, + ...,,) + If absent or A == '(,,,,)', all default values are used. + Has no effect if vfd flag is not 'hdfs'. file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index 19de76f..95dfc3b 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -12,6 +12,16 @@ usage: h5dump [OPTIONS] files -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F Use blank(empty) filename F to suppress ddl display + --s3-cred= Supply S3 authentication information to "ros3" vfd. + :: "(,,)" + If absent or -> "(,,)", no authentication. + Has no effect is filedriver is not `ros3'. + --hdfs-attrs= Supply configuration information for HDFS file access. + For use with "--filedriver=hdfs" + :: (,, + ,, + ) + Any absent attribute will use a default value. --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls index 491f696..396bed3 100644 --- a/tools/testfiles/textlinksrc-nodangle-1.ls +++ b/tools/testfiles/textlinksrc-nodangle-1.ls @@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] -V, --version Print version number and exit --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format + --s3-cred=C Supply S3 authentication information to "ros3" vfd. + Accepts tuple of "(,,)". + If absent or C->"(,,)", defaults to no-authentication. + Has no effect if vfd flag not set to "ros3". + --hdfs-attrs=A Supply configuration information to Hadoop VFD. + Accepts tuple of (,, + ...,,) + If absent or A == '(,,,,)', all default values are used. + Has no effect if vfd flag is not 'hdfs'. file/OBJECT Each object consists of an HDF5 file name optionally followed by a diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls index 491f696..396bed3 100644 --- a/tools/testfiles/tgroup-1.ls +++ b/tools/testfiles/tgroup-1.ls @@ -37,6 +37,15 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...] -V, --version Print version number and exit --vfd=DRIVER Use the specified virtual file driver -x, --hexdump Show raw data in hexadecimal format + --s3-cred=C Supply S3 authentication information to "ros3" vfd. + Accepts tuple of "(,,)". + If absent or C->"(,,)", defaults to no-authentication. + Has no effect if vfd flag not set to "ros3". + --hdfs-attrs=A Supply configuration information to Hadoop VFD. + Accepts tuple of (,, + ...,,) + If absent or A == '(,,,,)', all default values are used. + Has no effect if vfd flag is not 'hdfs'. file/OBJECT Each object consists of an HDF5 file name optionally followed by a -- cgit v0.12 From 094f14ef3857a47deb15bdfe45a1d4fe26655a6a Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 26 Jul 2019 11:56:03 -0500 Subject: Add HD to string functions. Switched strtoul to strtoumax in H5FDs3comms.c. Removed unused functions and variables in s3 and hdfs TestH5Pfapl*.java. Update Copyright headers. --- config/cmake/ConfigureChecks.cmake | 2 +- java/examples/groups/JavaGroupExample.sh.in | 2 - java/test/TestH5Pfaplhdfs.java | 212 ----- java/test/TestH5Pfapls3.java | 212 ----- src/H5FDros3.c | 34 +- src/H5FDros3.h | 18 +- src/H5FDs3comms.c | 42 +- src/H5FDs3comms.h | 17 +- test/hdfs.c | 18 +- test/ros3.c | 18 +- test/s3comms.c | 18 +- tools/libtest/Makefile.am | 2 +- tools/libtest/h5tools_test_utils.c | 1295 ++++++++++++++++++++++++++ tools/libtest/h5tools_utils.c | 1296 --------------------------- 14 files changed, 1382 insertions(+), 1804 deletions(-) create mode 100644 tools/libtest/h5tools_test_utils.c delete mode 100644 tools/libtest/h5tools_utils.c diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index f295a1c..cb1eb48 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -155,7 +155,7 @@ if (NOT WINDOWS) endif () #----------------------------------------------------------------------------- -# Check if ROS3 driver works +# Check if ROS3 driver can be built #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 3ba512a..9d4673f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -64,8 +64,6 @@ $HDFTEST_HOME/h5ex_g_iterate.h5 $HDFTEST_HOME/h5ex_g_visit.h5 " LIST_DATA_FILES=" -$HDFTEST_HOME/h5ex_g_iterate.h5 -$HDFTEST_HOME/h5ex_g_visit.h5 $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 2b0a808..30d326e 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -41,228 +41,16 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testPf.h5"; - private static final String H5_LOG_FILE = "testPf.log"; - private static final String H5_FAMILY_FILE = "testPf%05d"; - private static final String H5_MULTI_FILE = "testPfmulti"; - private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - private static final int DIMF_X = 12; - private static final int DIMF_Y = 18; long H5fid = -1; long H5dsid = -1; long H5did = -1; long H5Fdsid = -1; long H5Fdid = -1; - long[] H5dims = { DIM_X, DIM_Y }; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; long plist_id = -1; long btplist_id = -1; - long[] H5Fdims = { DIMF_X, DIMF_Y }; - double windchillF[][] = - {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, - {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, - {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, - {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, - {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, - {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, - {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, - {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, - {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, - {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, - {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, - {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} - }; - - private final void _deleteFile(String filename) { - File file = null; - try { - file = new File(filename); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - - private final void _deleteLogFile() { - File file = null; - try { - file = new File(H5_LOG_FILE); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - - private final void _deleteFamilyFile() { - File file = null; - for(int indx = 0; ;indx++) { - java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); - try { - file = new File("test"+myFormat.format(new Integer(indx))+".h5"); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - else - return; - } - } - - private final void _deleteMultiFile() { - File file = null; - for(int indx = 1;indx<7;indx++) { - try { - file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - } - - private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; - try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Dcreate: " + err); - } - assertTrue("TestH5Pfapl._createDataset: ", did > 0); - - return did; - } - - private final void _createFloatDataset() { - try { - H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); - H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Dcreate: " + err); - } - assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5multiFileDS() { - try { - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5File(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5familyFile(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5multiFile(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - public void deleteH5file() { - _deleteFile(H5_FILE); - } - - public void deleteH5familyfile() { - _deleteFamilyFile(); - } - - public void deleteH5multifile() { - _deleteMultiFile(); - } @Before public void createFileAccess() diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index 3107bc8..00a2a73 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -41,228 +41,16 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testPf.h5"; - private static final String H5_LOG_FILE = "testPf.log"; - private static final String H5_FAMILY_FILE = "testPf%05d"; - private static final String H5_MULTI_FILE = "testPfmulti"; - private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - private static final int DIMF_X = 12; - private static final int DIMF_Y = 18; long H5fid = -1; long H5dsid = -1; long H5did = -1; long H5Fdsid = -1; long H5Fdid = -1; - long[] H5dims = { DIM_X, DIM_Y }; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; long plist_id = -1; long btplist_id = -1; - long[] H5Fdims = { DIMF_X, DIMF_Y }; - double windchillF[][] = - {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, - {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, - {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, - {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, - {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, - {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, - {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, - {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, - {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, - {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, - {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, - {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} - }; - - private final void _deleteFile(String filename) { - File file = null; - try { - file = new File(filename); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - - private final void _deleteLogFile() { - File file = null; - try { - file = new File(H5_LOG_FILE); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - - private final void _deleteFamilyFile() { - File file = null; - for(int indx = 0; ;indx++) { - java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); - try { - file = new File("test"+myFormat.format(new Integer(indx))+".h5"); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - else - return; - } - } - - private final void _deleteMultiFile() { - File file = null; - for(int indx = 1;indx<7;indx++) { - try { - file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); - } - catch (Throwable err) {} - - if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} - } - } - } - - private final long _createDataset(long fid, long dsid, String name, long dapl) { - long did = -1; - try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Dcreate: " + err); - } - assertTrue("TestH5Pfapl._createDataset: ", did > 0); - - return did; - } - - private final void _createFloatDataset() { - try { - H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); - H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5.H5Dcreate: " + err); - } - assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5multiFileDS() { - try { - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5File(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5familyFile(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - private final void _createH5multiFile(long fapl) { - try { - H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Pfapl.createH5file: " + err); - } - assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); - assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - - try { - H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); - } - catch (Throwable err) { - err.printStackTrace(); - } - } - - public void deleteH5file() { - _deleteFile(H5_FILE); - } - - public void deleteH5familyfile() { - _deleteFamilyFile(); - } - - public void deleteH5multifile() { - _deleteMultiFile(); - } @Before public void createFileAccess() diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 8bf0420..86642aa 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Programmer: Jacob Smith * 2017-10-13 * @@ -1334,14 +1334,14 @@ H5FD_ros3_cmp(const H5FD_t *_f1, HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (strcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); /* URL: HOST */ - if (strcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); /* URL: PORT */ if (purl1->port && purl2->port) { - if (strcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); } else if (purl1->port) { HGOTO_DONE(-1); } else if (purl2->port) { @@ -1350,7 +1350,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* URL: PATH */ if (purl1->path && purl2->path) { - if (strcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); } else if (purl1->path && !purl2->path) { HGOTO_DONE(-1); } else if (purl2->path && !purl1->path) { @@ -1359,7 +1359,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* URL: QUERY */ if (purl1->query && purl2->query) { - if (strcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); } else if (purl1->query && !purl2->query) { HGOTO_DONE(-1); } else if (purl2->query && !purl1->query) { @@ -1368,7 +1368,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: AWS_REGION */ if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') { - if (strcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); } else if (f1->fa.aws_region[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.aws_region[0] != '\0') { @@ -1377,7 +1377,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: SECRET_ID */ if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') { - if (strcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); } else if (f1->fa.secret_id[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.secret_id[0] != '\0') { @@ -1386,7 +1386,7 @@ H5FD_ros3_cmp(const H5FD_t *_f1, /* FAPL: SECRET_KEY */ if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') { - if (strcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); + if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); } else if (f1->fa.secret_key[0] != '\0') { HGOTO_DONE(-1); } else if (f2->fa.secret_key[0] != '\0') { diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 49e757c..7dfc95b 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Programmer: John Mainzer * 2017-10-10 * diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 7caeacb..4c24866 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** + * Read-Only S3 Virtual File Driver (VFD) + * * Source for S3 Communications module * * ***NOT A FILE DRIVER*** @@ -1005,7 +1005,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle) { #ifdef H5_HAVE_ROS3_VFD - unsigned long int content_length = 0; + uintmax_t content_length = 0; CURL *curlh = NULL; char *end = NULL; char *headerresponse = NULL; @@ -1135,9 +1135,14 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) */ *end = '\0'; - content_length = strtoul((const char *)start, + content_length = strtoumax((const char *)start, NULL, 0); + + if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) { + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); + } + if (content_length == 0 || content_length == ULONG_MAX || errno == ERANGE) /* errno set by strtoul */ @@ -1156,7 +1161,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if ( CURLE_OK != curl_easy_setopt(curlh, CURLOPT_NOBODY, - 0) ) + NULL) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_NOBODY). " @@ -1166,7 +1171,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if ( CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, - 0) ) + NULL) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA). " @@ -2518,7 +2523,7 @@ done: * + internal error occurred. * + -1 :: unable to format profile label * + -2 :: profile name/label not found in file - * + -3 :: some other error + * + -3 :: some other error * * Programmer: Jacob Smith * 2018-02-27 @@ -2602,14 +2607,14 @@ H5FD__s3comms_load_aws_creds_from_file( "unable to format line prefix") /* found a matching name? */ - if (!strncmp(line_buffer, line_prefix, setting_name_len + 1)) { + if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ if (setting_pointers[setting_i] == NULL) break; - /* advance to end fo name in string */ + /* advance to end of name in string */ do { line_buffer++; } while (*line_buffer != 0 && *line_buffer != '='); @@ -2620,7 +2625,8 @@ H5FD__s3comms_load_aws_creds_from_file( line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - strcpy(setting_pointers[setting_i], (const char *)line_buffer); + HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, + HDstrlen(line_buffer)); /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; @@ -2889,7 +2895,7 @@ H5FD_s3comms_parse_url(const char *str, * READ SCHEME * ***************/ - tmpstr = strchr(curstr, ':'); + tmpstr = HDstrchr(curstr, ':'); if (tmpstr == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 0524c46..93a5a81 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -1,18 +1,17 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** + * Read-Only S3 Virtual File Driver (VFD) * * This is the header for the S3 Communications module * diff --git a/test/hdfs.c b/test/hdfs.c index 11b9918..57dbac9 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only HDFS Virtual File Driver (VFD) * - * Copyright (c) 2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only HDFS Virtual File Driver (VFD) + * * Purpose: * * Verify behavior for Read-Only HDFS VFD. diff --git a/test/ros3.c b/test/ros3.c index 51c1a89..60d3932 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Purpose: * * Verify behavior for Read-Only S3 VFD diff --git a/test/s3comms.c b/test/s3comms.c index 71d93c2..a797e04 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -1,18 +1,18 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Read-Only S3 Virtual File Driver (VFD) * - * Copyright (c) 2017-2018, The HDF Group. * - * * + * Copyright by The HDF Group. * * All rights reserved. * * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* + * Read-Only S3 Virtual File Driver (VFD) + * * Purpose: Unit tests for the S3 Communications (s3comms) module. * * Programmer: Jacob Smith diff --git a/tools/libtest/Makefile.am b/tools/libtest/Makefile.am index 5aa72b8..a93e25d 100644 --- a/tools/libtest/Makefile.am +++ b/tools/libtest/Makefile.am @@ -27,7 +27,7 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5) # main target -bin_PROGRAMS=h5tools_utils +bin_PROGRAMS=h5tools_test_utils # check_PROGRAMS=$(TEST_PROG) diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c new file mode 100644 index 0000000..ac8e4c0 --- /dev/null +++ b/tools/libtest/h5tools_test_utils.c @@ -0,0 +1,1295 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: unit-test functionality of the routines in `tools/lib/h5tools_utils` + * + * Jacob Smith 2017-11-10 + */ + +#include "hdf5.h" +#include "H5private.h" +#include "h5tools_utils.h" +/* #include "h5test.h" */ /* linking failure */ + +#define UTIL_TEST_DEBUG 0 + +#ifndef _H5TEST_ + +#define AT() fprintf(stdout, " at %s:%d in %s()...\n", \ + __FILE__, __LINE__, FUNC); + +#define FAILED(msg) { \ + fprintf(stdout, "*FAILED*"); AT() \ + if (msg == NULL) { \ + fprintf(stdout,"(NULL)\n"); \ + } else { \ + fprintf(stdout, "%s\n", msg); \ + } \ + fflush(stdout); \ +} + +#define TESTING(msg) { \ + fprintf(stdout, "TESTING %-62s", (msg)); \ + fflush(stdout); \ +} + +#define PASSED() { \ + fprintf(stdout, " PASSED\n"); \ + fflush(stdout); \ +} + +#endif /* ifndef _H5TEST_ */ + +#ifndef __js_test__ + +#define __js_test__ 1L + +/***************************************************************************** + * + * FILE-LOCAL TESTING MACROS + * + * Purpose: + * + * 1. Upon test failure, goto-jump to single-location teardown in test + * function. E.g., `error:` (consistency with HDF corpus) or + * `failed:` (reflects purpose). + * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. + * 2. Increase clarity and reduce overhead found with `TEST_ERROR`. + * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" + * requires reading of entire line to know whether this if/call is + * part of the test setup, test operation, or a test unto itself. + * 3. Provide testing macros with optional user-supplied failure message; + * if not supplied (NULL), generate comparison output in the spirit of + * test-driven development. E.g., "expected 5 but was -3" + * User messages clarify test's purpose in code, encouraging description + * without relying on comments. + * 4. Configurable expected-actual order in generated comparison strings. + * Some prefer `VERIFY(expected, actual)`, others + * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch + * to satifsy both parties, assuming one paradigm per test file. + * (One could #undef and redefine the flag through the file as desired, + * but _why_.) + * + * Provided as courtesy, per consideration for inclusion in the library + * proper. + * + * Macros: + * + * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order + * FAIL_IF() - check condition + * FAIL_UNLESS() - check _not_ condition + * JSVERIFY() - long-int equality check; prints reason/comparison + * JSVERIFY_NOT() - long-int inequality check; prints + * JSVERIFY_STR() - string equality check; prints + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *****************************************************************************/ + + +/*---------------------------------------------------------------------------- + * + * ifdef flag: JSVERIFY_EXP_ACT + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_EXP_ACT 1L + + +/*---------------------------------------------------------------------------- + * + * Macro: JSFAILED_AT() + * + * Purpose: + * + * Preface a test failure by printing "*FAILED*" and location to stdout + * Similar to `H5_FAILED(); AT();` from h5test.h + * + * *FAILED* at somefile.c:12 in function_name()... + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSFAILED_AT() { \ + HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_IF() + * + * Purpose: + * + * Make tests more accessible and less cluttered than + * `if (thing == otherthing()) TEST_ERROR` + * paradigm. + * + * The following lines are roughly equivalent: + * + * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) + * `FAIL_IF(myfunc() < 0)` + * + * Prints a generic "FAILED AT" line to stdout and jumps to `error`, + * similar to `TEST_ERROR` in h5test.h + * + * Programmer: Jacob Smith + * 2017-10-23 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_IF(condition) \ +if (condition) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: FAIL_UNLESS() + * + * Purpose: + * + * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", + * e.g., "a != b". + * + * Opposite of FAIL_IF; fails if the given condition is _not_ true. + * + * `FAIL_IF( 5 != my_op() )` + * is equivalent to + * `FAIL_UNLESS( 5 == my_op() )` + * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. + * (see JSVERIFY) + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define FAIL_UNLESS(condition) \ +if (!(condition)) { \ + JSFAILED_AT() \ + goto error; \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_LONG() + * + * Purpose: + * + * Print an failure message for long-int arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:488 in somefunc()... + * forest must be made of trees. + * + * or + * + * *FAILED* at myfile.c:488 in somefunc()... + * ! Expected 425 + * ! Actual 3 + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_LONG(expected, actual, reason) { \ + JSFAILED_AT() \ + if (reason!= NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ + (long)(expected), (long)(actual)); \ + } \ +} + + +/*---------------------------------------------------------------------------- + * + * Macro: JSERR_STR() + * + * Purpose: + * + * Print an failure message for string arguments. + * ERROR-AT printed first. + * If `reason` is given, it is printed on own line and newlined after + * else, prints "expected/actual" aligned on own lines. + * + * *FAILED* at myfile.c:421 in myfunc()... + * Blue and Red strings don't match! + * + * or + * + * *FAILED* at myfile.c:421 in myfunc()... + * !!! Expected: + * this is my expected + * string + * !!! Actual: + * not what I expected at all + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSERR_STR(expected, actual, reason) { \ + JSFAILED_AT() \ + if ((reason) != NULL) { \ + HDprintf("%s\n", (reason)); \ + } else { \ + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ + (expected), (actual)); \ + } \ +} + +#ifdef JSVERIFY_EXP_ACT + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY() + * + * Purpose: + * + * Verify that two long integers are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(expected, actual, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_NOT() + * + * Purpose: + * + * Verify that two long integers are _not_ equal. + * If equal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(expected, actual, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * + * Macro: JSVERIFY_STR() + * + * Purpose: + * + * Verify that two strings are equal. + * If unequal, print failure message + * (with `reason`, if not NULL; expected/actual if NULL) + * and jump to `error` at end of function + * + * Programmer: Jacob Smith + * 2017-10-24 + * + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(expected, actual, reason) \ +if (HDstrcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + + +#else /* JSVERIFY_EXP_ACT not defined */ + /* Repeats macros above, but with actual/expected parameters reversed. */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY() + * See: JSVERIFY documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY(actual, expected, reason) \ +if ((long)(actual) != (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_NOT() + * See: JSVERIFY_NOT documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_NOT(actual, expected, reason) \ +if ((long)(actual) == (long)(expected)) { \ + JSERR_LONG((expected), (actual), (reason)) \ + goto error; \ +} /* JSVERIFY_NOT */ + + +/*---------------------------------------------------------------------------- + * Macro: JSVERIFY_STR() + * See: JSVERIFY_STR documentation above. + * Programmer: Jacob Smith + * 2017-10-14 + *---------------------------------------------------------------------------- + */ +#define JSVERIFY_STR(actual, expected, reason) \ +if (HDstrcmp((actual), (expected)) != 0) { \ + JSERR_STR((expected), (actual), (reason)); \ + goto error; \ +} /* JSVERIFY_STR */ + +#endif /* ifdef/else JSVERIFY_EXP_ACT */ + +#endif /* __js_test__ */ + +/* if > 0, be very verbose when performing tests */ +#define H5TOOLS_UTILS_TEST_DEBUG 0 + +/******************/ +/* TEST FUNCTIONS */ +/******************/ + + +/*---------------------------------------------------------------------------- + * + * Function: test_parse_tuple() + * + * Purpose: + * + * Provide unit tests and specification for the `parse_tuple()` function. + * + * Return: + * + * 0 Tests passed. + * 1 Tests failed. + * + * Programmer: Jacob Smith + * 2017-11-11 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_parse_tuple(void) +{ + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + + struct testcase { + const char *test_msg; /* info about test case */ + const char *in_str; /* input string */ + int sep; /* separator "character" */ + herr_t exp_ret; /* expected SUCCEED / FAIL */ + unsigned exp_nelems; /* expected number of elements */ + /* (no more than 7!) */ + const char *exp_elems[7]; /* list of elements (no more than 7!) */ + }; + + /****************** + * TEST VARIABLES * + ******************/ + + struct testcase cases[] = { + { "bad start", + "words(before)", + ';', + FAIL, + 0, + {NULL}, + }, + { "tuple not closed", + "(not ok", + ',', + FAIL, + 0, + {NULL}, + }, + { "empty tuple", + "()", + '-', + SUCCEED, + 1, + {""}, + }, + { "no separator", + "(stuff keeps on going)", + ',', + SUCCEED, + 1, + {"stuff keeps on going"}, + }, + { "4-ple, escaped seperator", + "(elem0,elem1,el\\,em2,elem3)", /* "el\,em" */ + ',', + SUCCEED, + 4, + {"elem0", "elem1", "el,em2", "elem3"}, + }, + { "5-ple, escaped escaped separator", + "(elem0,elem1,el\\\\,em2,elem3)", + ',', + SUCCEED, + 5, + {"elem0", "elem1", "el\\", "em2", "elem3"}, + }, + { "escaped non-comma separator", + "(5-2-7-2\\-6-2)", + '-', + SUCCEED, + 5, + {"5","2","7","2-6","2"}, + }, + { "embedded close-paren", + "(be;fo)re)", + ';', + SUCCEED, + 2, + {"be", "fo)re"}, + }, + { "embedded non-escaping backslash", + "(be;fo\\re)", + ';', + SUCCEED, + 2, + {"be", "fo\\re"}, + }, + { "double close-paren at end", + "(be;fore))", + ';', + SUCCEED, + 2, + {"be", "fore)"}, + }, + { "empty elements", + "(;a1;;a4;)", + ';', + SUCCEED, + 5, + {"", "a1", "", "a4", ""}, + }, + { "nested tuples with different separators", + "((4,e,a);(6,2,a))", + ';', + SUCCEED, + 2, + {"(4,e,a)","(6,2,a)"}, + }, + { "nested tuples with same separators", + "((4,e,a),(6,2,a))", + ',', + SUCCEED, + 6, + {"(4","e","a)","(6","2","a)"}, + }, + { "real-world use case", + "(us-east-2,AKIAIMC3D3XLYXLN5COA,ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+)", + ',', + SUCCEED, + 3, + {"us-east-2", + "AKIAIMC3D3XLYXLN5COA", + "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}, + } + }; + struct testcase tc; + unsigned n_tests = 14; + unsigned i = 0; + unsigned count = 0; + unsigned elem_i = 0; + char **parsed = NULL; + char *cpy = NULL; + herr_t success = TRUE; + hbool_t show_progress = FALSE; + + + + TESTING("arbitrary-count tuple parsing"); + +#if H5TOOLS_UTILS_TEST_DEBUG > 0 + show_progress = TRUE; +#endif /* H5TOOLS_UTILS_TEST_DEBUG */ + + /********* + * TESTS * + *********/ + + for (i = 0; i < n_tests; i++) { + + /* SETUP + */ + HDassert(parsed == NULL); + HDassert(cpy == NULL); + tc = cases[i]; + if (show_progress == TRUE) { + printf("testing %d: %s...\n", i, tc.test_msg); + } + + /* VERIFY + */ + success = parse_tuple(tc.in_str, tc.sep, + &cpy, &count, &parsed); + + JSVERIFY( tc.exp_ret, success, "function returned incorrect value" ) + JSVERIFY( tc.exp_nelems, count, NULL ) + if (success == SUCCEED) { + FAIL_IF( parsed == NULL ) + for (elem_i = 0; elem_i < count; elem_i++) { + JSVERIFY_STR( tc.exp_elems[elem_i], parsed[elem_i], NULL ) + } + /* TEARDOWN */ + HDassert(parsed != NULL); + HDassert(cpy != NULL); + free(parsed); + parsed = NULL; + free(cpy); + cpy = NULL; + } else { + FAIL_IF( parsed != NULL ) + } /* if parse_tuple() == SUCCEED or no */ + + } /* for each testcase */ + + PASSED(); + return 0; + +error: + /*********** + * CLEANUP * + ***********/ + + if (parsed != NULL) free(parsed); + if (cpy != NULL) free(cpy); + + return 1; + +} /* test_parse_tuple */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_populate_ros3_fa() + * + * Purpose: Verify behavior of `populate_ros3_fa()` + * + * Return: 0 if test passes + * 1 if failure + * + * Programmer: Jacob Smith + * 2017-11-13 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_populate_ros3_fa(void) +{ +#ifdef H5_HAVE_ROS3_VFD + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + + /************************ + * TEST-LOCAL VARIABLES * + ************************/ + + hbool_t show_progress = FALSE; + int bad_version = 0xf87a; /* arbitrarily wrong version number */ +#endif /* H5_HAVE_ROS3_VFD */ + + TESTING("programmatic ros3 fapl population"); + +#ifndef H5_HAVE_ROS3_VFD + puts(" -SKIP-"); + puts(" Read-Only S3 VFD not enabled"); + fflush(stdout); + return 0; +#else +#if H5TOOLS_UTILS_TEST_DEBUG > 0 + show_progress = TRUE; +#endif /* H5TOOLS_UTILS_TEST_DEBUG */ + + HDassert(bad_version != H5FD__CURR_ROS3_FAPL_T_VERSION); + + /********* + * TESTS * + *********/ + + /* NULL fapl config pointer fails + */ + { + const char *values[] = {"x", "y", "z"}; + + if (show_progress) { HDprintf("NULL fapl pointer\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(NULL, values), + "fapl pointer cannot be null" ) + } + + /* NULL values pointer yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; + + if (show_progress) { HDprintf("NULL values pointer\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, NULL), + "NULL values pointer yields \"default\" fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* all-empty values + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; + const char *values[] = {"", "", ""}; + + if (show_progress) { HDprintf("all empty values\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "empty values yields \"default\" fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* successfully set fapl with values + * excess value is ignored + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", "z", "a"}; + + if (show_progress) { HDprintf("successful full set\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "four values" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( TRUE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "z", fa.secret_key, NULL ) + } + + /* NULL region + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {NULL, "y", "z", NULL}; + + if (show_progress) { HDprintf("NULL region\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty region + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"", "y", "z", NULL}; + + if (show_progress) { HDprintf("empty region; non-empty id, key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* region overflow + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "somewhere over the rainbow not too high " \ + "there is another rainbow bounding some darkened sky", + "y", + "z"}; + + if (show_progress) { HDprintf("region overflow\n"); } + + HDassert(HDstrlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* NULL id + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", NULL, "z", NULL}; + + if (show_progress) { HDprintf("NULL id\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty id (non-empty region, key) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "", "z", NULL}; + + if (show_progress) { HDprintf("empty id; non-empty region and key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* id overflow + * partial set: region + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "x", + "Why is it necessary to solve the problem? " \ + "What benefits will you receive by solving the problem? " \ + "What is the unknown? " \ + "What is it you don't yet understand? " \ + "What is the information you have? " \ + "What isn't the problem? " \ + "Is the information insufficient, redundant, or contradictory? " \ + "Should you draw a diagram or figure of the problem? " \ + "What are the boundaries of the problem? " \ + "Can you separate the various parts of the problem?", + "z"}; + + if (show_progress) { HDprintf("id overflow\n"); } + + HDassert(HDstrlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* NULL key + * yields default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", NULL, NULL}; + + if (show_progress) { HDprintf("NULL key\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key (non-empty region, id) + * yeilds authenticating fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "y", "", NULL}; + + if (show_progress) { HDprintf("empty key; non-empty region and id\n"); } + + JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( TRUE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key, region (non-empty id) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"", "y", "", NULL}; + + if (show_progress) { HDprintf("empty key and region; non-empty id\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* empty key, id (non-empty region) + * yeilds default fapl + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = {"x", "", "", NULL}; + + if (show_progress) { HDprintf("empty key and id; non-empty region\n"); } + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "", fa.aws_region, NULL ) + JSVERIFY_STR( "", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* key overflow + * partial set: region, id + */ + { + H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; + const char *values[] = { + "x", + "y", + "Why is it necessary to solve the problem? " \ + "What benefits will you receive by solving the problem? " \ + "What is the unknown? " \ + "What is it you don't yet understand? " \ + "What is the information you have? " \ + "What isn't the problem? " \ + "Is the information insufficient, redundant, or contradictory? " \ + "Should you draw a diagram or figure of the problem? " \ + "What are the boundaries of the problem? " \ + "Can you separate the various parts of the problem?"}; + + if (show_progress) { HDprintf("key overflow\n"); } + + HDassert(HDstrlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN); + + JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), + "could not fill fapl" ) + JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( FALSE, fa.authenticate, NULL ) + JSVERIFY_STR( "x", fa.aws_region, NULL ) + JSVERIFY_STR( "y", fa.secret_id, NULL ) + JSVERIFY_STR( "", fa.secret_key, NULL ) + } + + /* use case + */ + { + H5FD_ros3_fapl_t fa = {0, 0, "", "", ""}; + const char *values[] = { + "us-east-2", + "AKIAIMC3D3XLYXLN5COA", + "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+" + }; + JSVERIFY( 1, + h5tools_populate_ros3_fapl(&fa, values), + "unable to set use case" ) + JSVERIFY( 1, fa.version, "version check" ) + JSVERIFY( 1, fa.authenticate, "should authenticate" ) + } + + PASSED(); + return 0; + +error : + /*********** + * CLEANUP * + ***********/ + + return 1; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* test_populate_ros3_fa */ + + +/*---------------------------------------------------------------------------- + * + * Function: test_set_configured_fapl() + * + * Purpose: Verify `h5tools_set_configured_fapl()` with ROS3 VFD + * + * Return: 0 if test passes + * 1 if failure + * + * Programmer: Jacob Smith + * 2018-07-12 + * + * Changes: None + * + *---------------------------------------------------------------------------- + */ +static unsigned +test_set_configured_fapl(void) +{ +#define UTIL_TEST_NOFAPL 1 +#define UTIL_TEST_DEFAULT 2 +#define UTIL_TEST_CREATE 3 + + /************************* + * TEST-LOCAL STRUCTURES * + *************************/ + typedef struct testcase { + const char message[88]; + int expected; + int fapl_choice; + const char vfdname[12]; + void *conf_fa; + } testcase; + + typedef struct other_fa_t { + int a; + int b; + int c; + } other_fa_t; + + /************************ + * TEST-LOCAL VARIABLES * + ************************/ + + hid_t fapl_id = -1; + other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; + H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; + H5FD_ros3_fapl_t ros3_auth_fa = { + 1, /* fapl version */ + TRUE, /* authenticate */ + "us-east-1", /* aws region */ + "12345677890abcdef", /* simulate access key ID */ + "oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */ + }; + H5FD_hdfs_fapl_t hdfs_fa = { + 1, /* fapl version */ + "", /* namenode name */ + 0, /* namenode port */ + "", /* kerberos ticket cache */ + "", /* user name */ + 2048, /* stream buffer size */ + }; + unsigned n_cases = 7; /* number of common testcases */ + testcase cases[] = { + { "(common) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "", + NULL, + }, + { "(common) should fail: no fapl id (with struct)", + 0, + UTIL_TEST_NOFAPL, + "", + &wrong_fa, + }, + { "(common) H5P_DEFAULT with no struct should succeed", + 1, + UTIL_TEST_DEFAULT, + "", + NULL, + }, + { "(common) H5P_DEFAULT with (ignored) struct should succeed", + 1, + UTIL_TEST_DEFAULT, + "", + &wrong_fa, + }, + { "(common) provided fapl entry should not fail", + 1, + UTIL_TEST_CREATE, + "", + NULL, + }, + { "(common) provided fapl entry should not fail; ignores struct", + 1, + UTIL_TEST_CREATE, + "", + &wrong_fa, + }, + { "(common) should fail: unrecoginzed vfd name", + 0, + UTIL_TEST_DEFAULT, + "unknown", + NULL, + }, + +#ifdef H5_HAVE_ROS3_VFD + /* WARNING: add number of ROS3 test cases after array definition + */ + { "(ROS3) should fail: no fapl id, no struct", + 0, + UTIL_TEST_NOFAPL, + "ros3", + NULL, + }, + { "(ROS3) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "ros3", + &ros3_anon_fa, + }, + { "(ROS3) should fail: no struct", + 0, + UTIL_TEST_CREATE, + "ros3", + NULL, + }, + { "(ROS3) successful set", + 1, + UTIL_TEST_CREATE, + "ros3", + &ros3_anon_fa, + }, + { "(ROS3) should fail: attempt to set DEFAULT fapl", + 0, + UTIL_TEST_DEFAULT, + "ros3", + &ros3_anon_fa, + }, +#endif /* H5_HAVE_ROS3_VFD */ + +#ifdef H5_HAVE_LIBHDFS + /* WARNING: add number of HDFS test cases after array definition + */ + { "(HDFS) should fail: no fapl id, no struct", + 0, + UTIL_TEST_NOFAPL, + "hdfs", + NULL, + }, + { "(HDFS) should fail: no fapl id", + 0, + UTIL_TEST_NOFAPL, + "hdfs", + &hdfs_fa, + }, + { "(HDFS) should fail: no struct", + 0, + UTIL_TEST_CREATE, + "hdfs", + NULL, + }, + { "(HDFS) successful set", + 1, + UTIL_TEST_CREATE, + "hdfs", + &hdfs_fa, + }, + { "(HDFS) should fail: attempt to set DEFAULT fapl", + 0, + UTIL_TEST_DEFAULT, + "hdfs", + &hdfs_fa, + }, +#endif /* H5_HAVE_LIBHDFS */ + + }; /* testcases `cases` array */ + +#ifdef H5_HAVE_ROS3_VFD + n_cases += 5; +#endif /* H5_HAVE_ROS3_VFD */ + +#ifdef H5_HAVE_LIBHDFS + n_cases += 5; +#endif /* H5_HAVE_LIBHDFS */ + + TESTING("programmatic fapl set"); + + for (unsigned i = 0; i < n_cases; i++) { + int result; + testcase C = cases[i]; + + fapl_id = -1; + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "setup test %d\t%s\n", i, C.message); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* per-test setup */ + if (C.fapl_choice == UTIL_TEST_DEFAULT) { + fapl_id = H5P_DEFAULT; + } else if (C.fapl_choice == UTIL_TEST_CREATE) { + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + FAIL_IF( fapl_id < 0 ) + } + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "before test\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* test */ + result = h5tools_set_configured_fapl( + fapl_id, + C.vfdname, + C.conf_fa); + JSVERIFY( result, C.expected, C.message ) + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after test\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + /* per-test-teardown */ + if (fapl_id > 0) { + FAIL_IF( FAIL == H5Pclose(fapl_id) ) + } + fapl_id = -1; + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after cleanup\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + } + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "after loop\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + PASSED(); + return 0; + +error : + /*********** + * CLEANUP * + ***********/ + +#if UTIL_TEST_DEBUG + HDfprintf(stderr, "ERROR\n"); fflush(stderr); +#endif /* UTIL_TEST_DEBUG */ + + if (fapl_id > 0) { + (void)H5Pclose(fapl_id); + } + + return 1; + +#undef UTIL_TEST_NOFAPL +#undef UTIL_TEST_DEFAULT +#undef UTIL_TEST_CREATE +} /* test_set_configured_fapl */ + + +/*---------------------------------------------------------------------------- + * + * Function: main() + * + * Purpose: Run all test functions. + * + * Return: 0 iff all test pass + * 1 iff any failures + * + * Programmer: Jacob Smith + * 2017-11-10 + * + * Changes: None. + * + *---------------------------------------------------------------------------- + */ +int +main(void) +{ + unsigned nerrors = 0; + +#ifdef _H5TEST_ + h5reset(); /* h5test? */ +#endif /* _H5TEST_ */ + + HDfprintf(stdout, "Testing h5tools_utils corpus.\n"); + + nerrors += test_parse_tuple(); + nerrors += test_populate_ros3_fa(); + nerrors += test_set_configured_fapl(); + + if (nerrors > 0) { + HDfprintf(stdout, "***** %d h5tools_utils TEST%s FAILED! *****\n", + nerrors, + nerrors > 1 ? "S" : ""); + nerrors = 1; + } else { + HDfprintf(stdout, "All h5tools_utils tests passed\n"); + } + + return (int)nerrors; + +} /* main */ + + diff --git a/tools/libtest/h5tools_utils.c b/tools/libtest/h5tools_utils.c deleted file mode 100644 index 56e8a01..0000000 --- a/tools/libtest/h5tools_utils.c +++ /dev/null @@ -1,1296 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright (c) 2017-2018, The HDF Group. * - * * - * All rights reserved. * - * * - * NOTICE: * - * All information contained herein is, and remains, the property of The HDF * - * Group. The intellectual and technical concepts contained herein are * - * proprietary to The HDF Group. Dissemination of this information or * - * reproduction of this material is strictly forbidden unless prior written * - * permission is obtained from The HDF Group. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Purpose: unit-test functionality of the routines in `tools/lib/h5tools_utils` - * - * Jacob Smith 2017-11-10 - */ - -#include "hdf5.h" -#include "H5private.h" -#include "h5tools_utils.h" -/* #include "h5test.h" */ /* linking failure */ - -#define UTIL_TEST_DEBUG 0 - -#ifndef _H5TEST_ - -#define AT() fprintf(stdout, " at %s:%d in %s()...\n", \ - __FILE__, __LINE__, FUNC); - -#define FAILED(msg) { \ - fprintf(stdout, "*FAILED*"); AT() \ - if (msg == NULL) { \ - fprintf(stdout,"(NULL)\n"); \ - } else { \ - fprintf(stdout, "%s\n", msg); \ - } \ - fflush(stdout); \ -} - -#define TESTING(msg) { \ - fprintf(stdout, "TESTING %-62s", (msg)); \ - fflush(stdout); \ -} - -#define PASSED() { \ - fprintf(stdout, " PASSED\n"); \ - fflush(stdout); \ -} - -#endif /* ifndef _H5TEST_ */ - -#ifndef __js_test__ - -#define __js_test__ 1L - -/***************************************************************************** - * - * FILE-LOCAL TESTING MACROS - * - * Purpose: - * - * 1. Upon test failure, goto-jump to single-location teardown in test - * function. E.g., `error:` (consistency with HDF corpus) or - * `failed:` (reflects purpose). - * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. - * 2. Increase clarity and reduce overhead found with `TEST_ERROR`. - * e.g., "if(somefunction(arg, arg2) < 0) TEST_ERROR:" - * requires reading of entire line to know whether this if/call is - * part of the test setup, test operation, or a test unto itself. - * 3. Provide testing macros with optional user-supplied failure message; - * if not supplied (NULL), generate comparison output in the spirit of - * test-driven development. E.g., "expected 5 but was -3" - * User messages clarify test's purpose in code, encouraging description - * without relying on comments. - * 4. Configurable expected-actual order in generated comparison strings. - * Some prefer `VERIFY(expected, actual)`, others - * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch - * to satifsy both parties, assuming one paradigm per test file. - * (One could #undef and redefine the flag through the file as desired, - * but _why_.) - * - * Provided as courtesy, per consideration for inclusion in the library - * proper. - * - * Macros: - * - * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order - * FAIL_IF() - check condition - * FAIL_UNLESS() - check _not_ condition - * JSVERIFY() - long-int equality check; prints reason/comparison - * JSVERIFY_NOT() - long-int inequality check; prints - * JSVERIFY_STR() - string equality check; prints - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *****************************************************************************/ - - -/*---------------------------------------------------------------------------- - * - * ifdef flag: JSVERIFY_EXP_ACT - * - * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) - * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) - * - *---------------------------------------------------------------------------- - */ -#define JSVERIFY_EXP_ACT 1L - - -/*---------------------------------------------------------------------------- - * - * Macro: JSFAILED_AT() - * - * Purpose: - * - * Preface a test failure by printing "*FAILED*" and location to stdout - * Similar to `H5_FAILED(); AT();` from h5test.h - * - * *FAILED* at somefile.c:12 in function_name()... - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSFAILED_AT() { \ - HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ -} - - -/*---------------------------------------------------------------------------- - * - * Macro: FAIL_IF() - * - * Purpose: - * - * Make tests more accessible and less cluttered than - * `if (thing == otherthing()) TEST_ERROR` - * paradigm. - * - * The following lines are roughly equivalent: - * - * `if (myfunc() < 0) TEST_ERROR;` (as seen elsewhere in HDF tests) - * `FAIL_IF(myfunc() < 0)` - * - * Prints a generic "FAILED AT" line to stdout and jumps to `error`, - * similar to `TEST_ERROR` in h5test.h - * - * Programmer: Jacob Smith - * 2017-10-23 - * - *---------------------------------------------------------------------------- - */ -#define FAIL_IF(condition) \ -if (condition) { \ - JSFAILED_AT() \ - goto error; \ -} - - -/*---------------------------------------------------------------------------- - * - * Macro: FAIL_UNLESS() - * - * Purpose: - * - * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", - * e.g., "a != b". - * - * Opposite of FAIL_IF; fails if the given condition is _not_ true. - * - * `FAIL_IF( 5 != my_op() )` - * is equivalent to - * `FAIL_UNLESS( 5 == my_op() )` - * However, `JSVERIFY(5, my_op(), "bad return")` may be even clearer. - * (see JSVERIFY) - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define FAIL_UNLESS(condition) \ -if (!(condition)) { \ - JSFAILED_AT() \ - goto error; \ -} - - -/*---------------------------------------------------------------------------- - * - * Macro: JSERR_LONG() - * - * Purpose: - * - * Print an failure message for long-int arguments. - * ERROR-AT printed first. - * If `reason` is given, it is printed on own line and newlined after - * else, prints "expected/actual" aligned on own lines. - * - * *FAILED* at myfile.c:488 in somefunc()... - * forest must be made of trees. - * - * or - * - * *FAILED* at myfile.c:488 in somefunc()... - * ! Expected 425 - * ! Actual 3 - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSERR_LONG(expected, actual, reason) { \ - JSFAILED_AT() \ - if (reason!= NULL) { \ - HDprintf("%s\n", (reason)); \ - } else { \ - HDprintf(" ! Expected %ld\n ! Actual %ld\n", \ - (long)(expected), (long)(actual)); \ - } \ -} - - -/*---------------------------------------------------------------------------- - * - * Macro: JSERR_STR() - * - * Purpose: - * - * Print an failure message for string arguments. - * ERROR-AT printed first. - * If `reason` is given, it is printed on own line and newlined after - * else, prints "expected/actual" aligned on own lines. - * - * *FAILED* at myfile.c:421 in myfunc()... - * Blue and Red strings don't match! - * - * or - * - * *FAILED* at myfile.c:421 in myfunc()... - * !!! Expected: - * this is my expected - * string - * !!! Actual: - * not what I expected at all - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSERR_STR(expected, actual, reason) { \ - JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ - } else { \ - HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", \ - (expected), (actual)); \ - } \ -} - -#ifdef JSVERIFY_EXP_ACT - - -/*---------------------------------------------------------------------------- - * - * Macro: JSVERIFY() - * - * Purpose: - * - * Verify that two long integers are equal. - * If unequal, print failure message - * (with `reason`, if not NULL; expected/actual if NULL) - * and jump to `error` at end of function - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSVERIFY(expected, actual, reason) \ -if ((long)(actual) != (long)(expected)) { \ - JSERR_LONG((expected), (actual), (reason)) \ - goto error; \ -} /* JSVERIFY */ - - -/*---------------------------------------------------------------------------- - * - * Macro: JSVERIFY_NOT() - * - * Purpose: - * - * Verify that two long integers are _not_ equal. - * If equal, print failure message - * (with `reason`, if not NULL; expected/actual if NULL) - * and jump to `error` at end of function - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSVERIFY_NOT(expected, actual, reason) \ -if ((long)(actual) == (long)(expected)) { \ - JSERR_LONG((expected), (actual), (reason)) \ - goto error; \ -} /* JSVERIFY_NOT */ - - -/*---------------------------------------------------------------------------- - * - * Macro: JSVERIFY_STR() - * - * Purpose: - * - * Verify that two strings are equal. - * If unequal, print failure message - * (with `reason`, if not NULL; expected/actual if NULL) - * and jump to `error` at end of function - * - * Programmer: Jacob Smith - * 2017-10-24 - * - *---------------------------------------------------------------------------- - */ -#define JSVERIFY_STR(expected, actual, reason) \ -if (strcmp((actual), (expected)) != 0) { \ - JSERR_STR((expected), (actual), (reason)); \ - goto error; \ -} /* JSVERIFY_STR */ - - -#else /* JSVERIFY_EXP_ACT not defined */ - /* Repeats macros above, but with actual/expected parameters reversed. */ - - -/*---------------------------------------------------------------------------- - * Macro: JSVERIFY() - * See: JSVERIFY documentation above. - * Programmer: Jacob Smith - * 2017-10-14 - *---------------------------------------------------------------------------- - */ -#define JSVERIFY(actual, expected, reason) \ -if ((long)(actual) != (long)(expected)) { \ - JSERR_LONG((expected), (actual), (reason)); \ - goto error; \ -} /* JSVERIFY */ - - -/*---------------------------------------------------------------------------- - * Macro: JSVERIFY_NOT() - * See: JSVERIFY_NOT documentation above. - * Programmer: Jacob Smith - * 2017-10-14 - *---------------------------------------------------------------------------- - */ -#define JSVERIFY_NOT(actual, expected, reason) \ -if ((long)(actual) == (long)(expected)) { \ - JSERR_LONG((expected), (actual), (reason)) \ - goto error; \ -} /* JSVERIFY_NOT */ - - -/*---------------------------------------------------------------------------- - * Macro: JSVERIFY_STR() - * See: JSVERIFY_STR documentation above. - * Programmer: Jacob Smith - * 2017-10-14 - *---------------------------------------------------------------------------- - */ -#define JSVERIFY_STR(actual, expected, reason) \ -if (strcmp((actual), (expected)) != 0) { \ - JSERR_STR((expected), (actual), (reason)); \ - goto error; \ -} /* JSVERIFY_STR */ - -#endif /* ifdef/else JSVERIFY_EXP_ACT */ - -#endif /* __js_test__ */ - -/* if > 0, be very verbose when performing tests */ -#define H5TOOLS_UTILS_TEST_DEBUG 0 - -/******************/ -/* TEST FUNCTIONS */ -/******************/ - - -/*---------------------------------------------------------------------------- - * - * Function: test_parse_tuple() - * - * Purpose: - * - * Provide unit tests and specification for the `parse_tuple()` function. - * - * Return: - * - * 0 Tests passed. - * 1 Tests failed. - * - * Programmer: Jacob Smith - * 2017-11-11 - * - * Changes: None. - * - *---------------------------------------------------------------------------- - */ -static unsigned -test_parse_tuple(void) -{ - /************************* - * TEST-LOCAL STRUCTURES * - *************************/ - - struct testcase { - const char *test_msg; /* info about test case */ - const char *in_str; /* input string */ - int sep; /* separator "character" */ - herr_t exp_ret; /* expected SUCCEED / FAIL */ - unsigned exp_nelems; /* expected number of elements */ - /* (no more than 7!) */ - const char *exp_elems[7]; /* list of elements (no more than 7!) */ - }; - - /****************** - * TEST VARIABLES * - ******************/ - - struct testcase cases[] = { - { "bad start", - "words(before)", - ';', - FAIL, - 0, - {NULL}, - }, - { "tuple not closed", - "(not ok", - ',', - FAIL, - 0, - {NULL}, - }, - { "empty tuple", - "()", - '-', - SUCCEED, - 1, - {""}, - }, - { "no separator", - "(stuff keeps on going)", - ',', - SUCCEED, - 1, - {"stuff keeps on going"}, - }, - { "4-ple, escaped seperator", - "(elem0,elem1,el\\,em2,elem3)", /* "el\,em" */ - ',', - SUCCEED, - 4, - {"elem0", "elem1", "el,em2", "elem3"}, - }, - { "5-ple, escaped escaped separator", - "(elem0,elem1,el\\\\,em2,elem3)", - ',', - SUCCEED, - 5, - {"elem0", "elem1", "el\\", "em2", "elem3"}, - }, - { "escaped non-comma separator", - "(5-2-7-2\\-6-2)", - '-', - SUCCEED, - 5, - {"5","2","7","2-6","2"}, - }, - { "embedded close-paren", - "(be;fo)re)", - ';', - SUCCEED, - 2, - {"be", "fo)re"}, - }, - { "embedded non-escaping backslash", - "(be;fo\\re)", - ';', - SUCCEED, - 2, - {"be", "fo\\re"}, - }, - { "double close-paren at end", - "(be;fore))", - ';', - SUCCEED, - 2, - {"be", "fore)"}, - }, - { "empty elements", - "(;a1;;a4;)", - ';', - SUCCEED, - 5, - {"", "a1", "", "a4", ""}, - }, - { "nested tuples with different separators", - "((4,e,a);(6,2,a))", - ';', - SUCCEED, - 2, - {"(4,e,a)","(6,2,a)"}, - }, - { "nested tuples with same separators", - "((4,e,a),(6,2,a))", - ',', - SUCCEED, - 6, - {"(4","e","a)","(6","2","a)"}, - }, - { "real-world use case", - "(us-east-2,AKIAIMC3D3XLYXLN5COA,ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+)", - ',', - SUCCEED, - 3, - {"us-east-2", - "AKIAIMC3D3XLYXLN5COA", - "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+"}, - } - }; - struct testcase tc; - unsigned n_tests = 14; - unsigned i = 0; - unsigned count = 0; - unsigned elem_i = 0; - char **parsed = NULL; - char *cpy = NULL; - herr_t success = TRUE; - hbool_t show_progress = FALSE; - - - - TESTING("arbitrary-count tuple parsing"); - -#if H5TOOLS_UTILS_TEST_DEBUG > 0 - show_progress = TRUE; -#endif /* H5TOOLS_UTILS_TEST_DEBUG */ - - /********* - * TESTS * - *********/ - - for (i = 0; i < n_tests; i++) { - - /* SETUP - */ - HDassert(parsed == NULL); - HDassert(cpy == NULL); - tc = cases[i]; - if (show_progress == TRUE) { - printf("testing %d: %s...\n", i, tc.test_msg); - } - - /* VERIFY - */ - success = parse_tuple(tc.in_str, tc.sep, - &cpy, &count, &parsed); - - JSVERIFY( tc.exp_ret, success, "function returned incorrect value" ) - JSVERIFY( tc.exp_nelems, count, NULL ) - if (success == SUCCEED) { - FAIL_IF( parsed == NULL ) - for (elem_i = 0; elem_i < count; elem_i++) { - JSVERIFY_STR( tc.exp_elems[elem_i], parsed[elem_i], NULL ) - } - /* TEARDOWN */ - HDassert(parsed != NULL); - HDassert(cpy != NULL); - free(parsed); - parsed = NULL; - free(cpy); - cpy = NULL; - } else { - FAIL_IF( parsed != NULL ) - } /* if parse_tuple() == SUCCEED or no */ - - } /* for each testcase */ - - PASSED(); - return 0; - -error: - /*********** - * CLEANUP * - ***********/ - - if (parsed != NULL) free(parsed); - if (cpy != NULL) free(cpy); - - return 1; - -} /* test_parse_tuple */ - - -/*---------------------------------------------------------------------------- - * - * Function: test_populate_ros3_fa() - * - * Purpose: Verify behavior of `populate_ros3_fa()` - * - * Return: 0 if test passes - * 1 if failure - * - * Programmer: Jacob Smith - * 2017-11-13 - * - * Changes: None - * - *---------------------------------------------------------------------------- - */ -static unsigned -test_populate_ros3_fa(void) -{ -#ifdef H5_HAVE_ROS3_VFD - /************************* - * TEST-LOCAL STRUCTURES * - *************************/ - - /************************ - * TEST-LOCAL VARIABLES * - ************************/ - - hbool_t show_progress = FALSE; - int bad_version = 0xf87a; /* arbitrarily wrong version number */ -#endif /* H5_HAVE_ROS3_VFD */ - - TESTING("programmatic ros3 fapl population"); - -#ifndef H5_HAVE_ROS3_VFD - puts(" -SKIP-"); - puts(" Read-Only S3 VFD not enabled"); - fflush(stdout); - return 0; -#else -#if H5TOOLS_UTILS_TEST_DEBUG > 0 - show_progress = TRUE; -#endif /* H5TOOLS_UTILS_TEST_DEBUG */ - - HDassert(bad_version != H5FD__CURR_ROS3_FAPL_T_VERSION); - - /********* - * TESTS * - *********/ - - /* NULL fapl config pointer fails - */ - { - const char *values[] = {"x", "y", "z"}; - - if (show_progress) { HDprintf("NULL fapl pointer\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(NULL, values), - "fapl pointer cannot be null" ) - } - - /* NULL values pointer yields default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; - - if (show_progress) { HDprintf("NULL values pointer\n"); } - - JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, NULL), - "NULL values pointer yields \"default\" fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* all-empty values - * yields default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, TRUE, "u", "v", "w"}; - const char *values[] = {"", "", ""}; - - if (show_progress) { HDprintf("all empty values\n"); } - - JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), - "empty values yields \"default\" fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* successfully set fapl with values - * excess value is ignored - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", "z", "a"}; - - if (show_progress) { HDprintf("successful full set\n"); } - - JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), - "four values" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( TRUE, fa.authenticate, NULL ) - JSVERIFY_STR( "x", fa.aws_region, NULL ) - JSVERIFY_STR( "y", fa.secret_id, NULL ) - JSVERIFY_STR( "z", fa.secret_key, NULL ) - } - - /* NULL region - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {NULL, "y", "z", NULL}; - - if (show_progress) { HDprintf("NULL region\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* empty region - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"", "y", "z", NULL}; - - if (show_progress) { HDprintf("empty region; non-empty id, key\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* region overflow - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "somewhere over the rainbow not too high " \ - "there is another rainbow bounding some darkened sky", - "y", - "z"}; - - if (show_progress) { HDprintf("region overflow\n"); } - - HDassert(strlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN); - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* NULL id - * yields default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", NULL, "z", NULL}; - - if (show_progress) { HDprintf("NULL id\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* empty id (non-empty region, key) - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "", "z", NULL}; - - if (show_progress) { HDprintf("empty id; non-empty region and key\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* id overflow - * partial set: region - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "x", - "Why is it necessary to solve the problem? " \ - "What benefits will you receive by solving the problem? " \ - "What is the unknown? " \ - "What is it you don't yet understand? " \ - "What is the information you have? " \ - "What isn't the problem? " \ - "Is the information insufficient, redundant, or contradictory? " \ - "Should you draw a diagram or figure of the problem? " \ - "What are the boundaries of the problem? " \ - "Can you separate the various parts of the problem?", - "z"}; - - if (show_progress) { HDprintf("id overflow\n"); } - - HDassert(strlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN); - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "x", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* NULL key - * yields default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", NULL, NULL}; - - if (show_progress) { HDprintf("NULL key\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* empty key (non-empty region, id) - * yeilds authenticating fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "y", "", NULL}; - - if (show_progress) { HDprintf("empty key; non-empty region and id\n"); } - - JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( TRUE, fa.authenticate, NULL ) - JSVERIFY_STR( "x", fa.aws_region, NULL ) - JSVERIFY_STR( "y", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* empty key, region (non-empty id) - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"", "y", "", NULL}; - - if (show_progress) { HDprintf("empty key and region; non-empty id\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* empty key, id (non-empty region) - * yeilds default fapl - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = {"x", "", "", NULL}; - - if (show_progress) { HDprintf("empty key and id; non-empty region\n"); } - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "", fa.aws_region, NULL ) - JSVERIFY_STR( "", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* key overflow - * partial set: region, id - */ - { - H5FD_ros3_fapl_t fa = {bad_version, FALSE, "a", "b", "c"}; - const char *values[] = { - "x", - "y", - "Why is it necessary to solve the problem? " \ - "What benefits will you receive by solving the problem? " \ - "What is the unknown? " \ - "What is it you don't yet understand? " \ - "What is the information you have? " \ - "What isn't the problem? " \ - "Is the information insufficient, redundant, or contradictory? " \ - "Should you draw a diagram or figure of the problem? " \ - "What are the boundaries of the problem? " \ - "Can you separate the various parts of the problem?"}; - - if (show_progress) { HDprintf("key overflow\n"); } - - HDassert(strlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN); - - JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), - "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) - JSVERIFY( FALSE, fa.authenticate, NULL ) - JSVERIFY_STR( "x", fa.aws_region, NULL ) - JSVERIFY_STR( "y", fa.secret_id, NULL ) - JSVERIFY_STR( "", fa.secret_key, NULL ) - } - - /* use case - */ - { - H5FD_ros3_fapl_t fa = {0, 0, "", "", ""}; - const char *values[] = { - "us-east-2", - "AKIAIMC3D3XLYXLN5COA", - "ugs5aVVnLFCErO/8uW14iWE3K5AgXMpsMlWneO/+" - }; - JSVERIFY( 1, - h5tools_populate_ros3_fapl(&fa, values), - "unable to set use case" ) - JSVERIFY( 1, fa.version, "version check" ) - JSVERIFY( 1, fa.authenticate, "should authenticate" ) - } - - PASSED(); - return 0; - -error : - /*********** - * CLEANUP * - ***********/ - - return 1; - -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_populate_ros3_fa */ - - -/*---------------------------------------------------------------------------- - * - * Function: test_set_configured_fapl() - * - * Purpose: Verify `h5tools_set_configured_fapl()` with ROS3 VFD - * - * Return: 0 if test passes - * 1 if failure - * - * Programmer: Jacob Smith - * 2018-07-12 - * - * Changes: None - * - *---------------------------------------------------------------------------- - */ -static unsigned -test_set_configured_fapl(void) -{ -#define UTIL_TEST_NOFAPL 1 -#define UTIL_TEST_DEFAULT 2 -#define UTIL_TEST_CREATE 3 - - /************************* - * TEST-LOCAL STRUCTURES * - *************************/ - typedef struct testcase { - const char message[88]; - int expected; - int fapl_choice; - const char vfdname[12]; - void *conf_fa; - } testcase; - - typedef struct other_fa_t { - int a; - int b; - int c; - } other_fa_t; - - /************************ - * TEST-LOCAL VARIABLES * - ************************/ - - hid_t fapl_id = -1; - other_fa_t wrong_fa = {0x432, 0xf82, 0x9093}; - H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""}; - H5FD_ros3_fapl_t ros3_auth_fa = { - 1, /* fapl version */ - TRUE, /* authenticate */ - "us-east-1", /* aws region */ - "12345677890abcdef", /* simulate access key ID */ - "oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */ - }; - H5FD_hdfs_fapl_t hdfs_fa = { - 1, /* fapl version */ - "", /* namenode name */ - 0, /* namenode port */ - "", /* kerberos ticket cache */ - "", /* user name */ - 2048, /* stream buffer size */ - }; - unsigned n_cases = 7; /* number of common testcases */ - testcase cases[] = { - { "(common) should fail: no fapl id", - 0, - UTIL_TEST_NOFAPL, - "", - NULL, - }, - { "(common) should fail: no fapl id (with struct)", - 0, - UTIL_TEST_NOFAPL, - "", - &wrong_fa, - }, - { "(common) H5P_DEFAULT with no struct should succeed", - 1, - UTIL_TEST_DEFAULT, - "", - NULL, - }, - { "(common) H5P_DEFAULT with (ignored) struct should succeed", - 1, - UTIL_TEST_DEFAULT, - "", - &wrong_fa, - }, - { "(common) provided fapl entry should not fail", - 1, - UTIL_TEST_CREATE, - "", - NULL, - }, - { "(common) provided fapl entry should not fail; ignores struct", - 1, - UTIL_TEST_CREATE, - "", - &wrong_fa, - }, - { "(common) should fail: unrecoginzed vfd name", - 0, - UTIL_TEST_DEFAULT, - "unknown", - NULL, - }, - -#ifdef H5_HAVE_ROS3_VFD - /* WARNING: add number of ROS3 test cases after array definition - */ - { "(ROS3) should fail: no fapl id, no struct", - 0, - UTIL_TEST_NOFAPL, - "ros3", - NULL, - }, - { "(ROS3) should fail: no fapl id", - 0, - UTIL_TEST_NOFAPL, - "ros3", - &ros3_anon_fa, - }, - { "(ROS3) should fail: no struct", - 0, - UTIL_TEST_CREATE, - "ros3", - NULL, - }, - { "(ROS3) successful set", - 1, - UTIL_TEST_CREATE, - "ros3", - &ros3_anon_fa, - }, - { "(ROS3) should fail: attempt to set DEFAULT fapl", - 0, - UTIL_TEST_DEFAULT, - "ros3", - &ros3_anon_fa, - }, -#endif /* H5_HAVE_ROS3_VFD */ - -#ifdef H5_HAVE_LIBHDFS - /* WARNING: add number of HDFS test cases after array definition - */ - { "(HDFS) should fail: no fapl id, no struct", - 0, - UTIL_TEST_NOFAPL, - "hdfs", - NULL, - }, - { "(HDFS) should fail: no fapl id", - 0, - UTIL_TEST_NOFAPL, - "hdfs", - &hdfs_fa, - }, - { "(HDFS) should fail: no struct", - 0, - UTIL_TEST_CREATE, - "hdfs", - NULL, - }, - { "(HDFS) successful set", - 1, - UTIL_TEST_CREATE, - "hdfs", - &hdfs_fa, - }, - { "(HDFS) should fail: attempt to set DEFAULT fapl", - 0, - UTIL_TEST_DEFAULT, - "hdfs", - &hdfs_fa, - }, -#endif /* H5_HAVE_LIBHDFS */ - - }; /* testcases `cases` array */ - -#ifdef H5_HAVE_ROS3_VFD - n_cases += 5; -#endif /* H5_HAVE_ROS3_VFD */ - -#ifdef H5_HAVE_LIBHDFS - n_cases += 5; -#endif /* H5_HAVE_LIBHDFS */ - - TESTING("programmatic fapl set"); - - for (unsigned i = 0; i < n_cases; i++) { - int result; - testcase C = cases[i]; - - fapl_id = -1; - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "setup test %d\t%s\n", i, C.message); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - /* per-test setup */ - if (C.fapl_choice == UTIL_TEST_DEFAULT) { - fapl_id = H5P_DEFAULT; - } else if (C.fapl_choice == UTIL_TEST_CREATE) { - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - FAIL_IF( fapl_id < 0 ) - } - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "before test\n"); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - /* test */ - result = h5tools_set_configured_fapl( - fapl_id, - C.vfdname, - C.conf_fa); - JSVERIFY( result, C.expected, C.message ) - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "after test\n"); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - /* per-test-teardown */ - if (fapl_id > 0) { - FAIL_IF( FAIL == H5Pclose(fapl_id) ) - } - fapl_id = -1; - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "after cleanup\n"); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - } - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "after loop\n"); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - PASSED(); - return 0; - -error : - /*********** - * CLEANUP * - ***********/ - -#if UTIL_TEST_DEBUG - HDfprintf(stderr, "ERROR\n"); fflush(stderr); -#endif /* UTIL_TEST_DEBUG */ - - if (fapl_id > 0) { - (void)H5Pclose(fapl_id); - } - - return 1; - -#undef UTIL_TEST_NOFAPL -#undef UTIL_TEST_DEFAULT -#undef UTIL_TEST_CREATE -} /* test_set_configured_fapl */ - - -/*---------------------------------------------------------------------------- - * - * Function: main() - * - * Purpose: Run all test functions. - * - * Return: 0 iff all test pass - * 1 iff any failures - * - * Programmer: Jacob Smith - * 2017-11-10 - * - * Changes: None. - * - *---------------------------------------------------------------------------- - */ -int -main(void) -{ - unsigned nerrors = 0; - -#ifdef _H5TEST_ - h5reset(); /* h5test? */ -#endif /* _H5TEST_ */ - - HDfprintf(stdout, "Testing h5tools_utils corpus.\n"); - - nerrors += test_parse_tuple(); - nerrors += test_populate_ros3_fa(); - nerrors += test_set_configured_fapl(); - - if (nerrors > 0) { - HDfprintf(stdout, "***** %d h5tools_utils TEST%s FAILED! *****\n", - nerrors, - nerrors > 1 ? "S" : ""); - nerrors = 1; - } else { - HDfprintf(stdout, "All h5tools_utils tests passed\n"); - } - - return (int)nerrors; - -} /* main */ - - -- cgit v0.12 From e852c8deb81f1ded2b9f4f7276967a6b7d2712ba Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 26 Jul 2019 12:58:56 -0500 Subject: Modify CMakeLists.txt file for renamed h5tools_test_utils files. --- tools/libtest/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index f5e0aa6..105607d 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -4,7 +4,7 @@ project (HDF5_TOOLS_LIBTEST C) #----------------------------------------------------------------------------- # Add the h5tools_utils test executables #----------------------------------------------------------------------------- -add_executable (h5tools_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_utils.c) +add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) target_include_directories(h5tools_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") TARGET_C_PROPERTIES (h5tools_utils STATIC) target_link_libraries (h5tools_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -- cgit v0.12 From a7d74160d043310d3819692c0aff5074bf466b1a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Jul 2019 16:18:39 -0500 Subject: Correct generator and add HD prefix --- hl/test/test_ds.c | 6 +++--- tools/test/misc/CMakeLists.txt | 18 ++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index d7af9e9..6c75423 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4876,12 +4876,12 @@ static int read_data( const char* fname, for(i=0, nelms=1; i < ndims; i++) { if(fscanf( f, "%s %u", str, &j) && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ if(fscanf( f, "%d",&n ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ @@ -4899,7 +4899,7 @@ static int read_data( const char* fname, for(j = 0; j < nelms; j++) { if(fscanf( f, "%f",&val ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s\n", data_file ); + HDprintf( "fscanf error in file %s\n", data_file ); HDfclose(f); return -1; } /* end if */ diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index a250222..3d63681 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -7,25 +7,15 @@ project (HDF5_TOOLS_TEST_MISC C) if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT ONLY_SHARED_LIBS) - TARGET_C_PROPERTIES (h5repart_gentest STATIC) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (h5repart_gentest SHARED) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) - endif () + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT ONLY_SHARED_LIBS) - TARGET_C_PROPERTIES (h5clear_gentest STATIC) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (h5clear_gentest SHARED) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) - endif () + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -- cgit v0.12 From 8aa9043837ea217280098b4b32da8d98ac18f58b Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 26 Jul 2019 16:36:45 -0500 Subject: Update comment and check for strtoumax. --- src/H5FDs3comms.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 4c24866..8c0515d 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1143,9 +1143,8 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); } - if (content_length == 0 || - content_length == ULONG_MAX || - errno == ERANGE) /* errno set by strtoul */ + if (content_length == 0 || + errno == ERANGE) /* errno set by strtoumax*/ { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert found \"Content-Length\" response (\"%s\")", -- cgit v0.12 From da2ec6163d4a8f76ef9c32518b5a0b5810f2d63f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 28 Jul 2019 14:41:52 -0500 Subject: Update libvers usage --- java/test/TestH5Fparams.java | 2 +- java/test/TestH5P.java | 4 ++-- tools/src/h5repack/h5repack_main.c | 3 ++- tools/test/h5repack/testfiles/h5repack-help.txt | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 40cbe4b..6b541c6 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -244,7 +244,7 @@ public class TestH5Fparams { catch (Throwable err) { fail("H5.H5Fcreate: " + err); } - H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1); + H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); } finally { try {H5.H5Fclose(fid);} catch (Exception ex) {} diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index e46ed48..a85405b 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -209,12 +209,12 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidlow() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_EARLIEST-1, HDF5Constants.H5F_LIBVER_LATEST); } @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V112, HDF5Constants.H5F_LIBVER_V112+1); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); } @Test diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index dec25f9..b961765 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -127,7 +127,8 @@ static void usage(const char *prog) { PRINTVALSTREAM(rawoutstream, " 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 1: This is H5F_LIBVER_V18 in H5F_libver_t struct\n"); PRINTVALSTREAM(rawoutstream, " 2: This is H5F_LIBVER_V110 in H5F_libver_t struct\n"); - PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release\n"); + PRINTVALSTREAM(rawoutstream, " 3: This is H5F_LIBVER_V112 in H5F_libver_t struct\n"); + PRINTVALSTREAM(rawoutstream, " (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release\n"); PRINTVALSTREAM(rawoutstream, "\n"); PRINTVALSTREAM(rawoutstream, " FS_STRATEGY is a string indicating the file space strategy used:\n"); PRINTVALSTREAM(rawoutstream, " FSM_AGGR:\n"); diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt index 0eef0f5..2381865 100644 --- a/tools/test/h5repack/testfiles/h5repack-help.txt +++ b/tools/test/h5repack/testfiles/h5repack-help.txt @@ -50,7 +50,8 @@ usage: h5repack [OPTIONS] file1 file2 0: This is H5F_LIBVER_EARLIEST in H5F_libver_t struct 1: This is H5F_LIBVER_V18 in H5F_libver_t struct 2: This is H5F_LIBVER_V110 in H5F_libver_t struct - (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V110 for this release + 3: This is H5F_LIBVER_V112 in H5F_libver_t struct + (H5F_LIBVER_LATEST is aliased to H5F_LIBVER_V112 for this release FS_STRATEGY is a string indicating the file space strategy used: FSM_AGGR: -- cgit v0.12 From 99a6a5a16e84512dfc57ba2eb7c3e09ecef94b1c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 30 Jul 2019 07:29:37 -0700 Subject: Fixed the MANIFEST --- MANIFEST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index f5e718e..9c7c0db 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1555,7 +1555,7 @@ ./tools/lib/io_timer.h ./tools/libtest/Makefile.am -./tools/libtest/h5tools_utils.c +./tools/libtest/h5tools_test_utils.c ./tools/src/misc/Makefile.am ./tools/src/misc/h5clear.c -- cgit v0.12 From 44e2ddac97a6bae4637ef040c9f1a9f7b70978f3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 30 Jul 2019 12:39:20 -0500 Subject: Merge cleanup mostly whitespace --- CTestConfig.cmake | 2 +- config/cmake/scripts/HDF5config.cmake | 2 +- java/test/TestH5P.java | 2 +- java/test/TestH5Pfapl.java | 3 - java/test/TestH5Z.java | 1 - test/direct_chunk.c | 178 ++-- test/dsets.c | 245 +++--- test/dt_arith.c | 1460 ++++++++++++++++----------------- test/earray.c | 4 +- test/th5o.c | 32 +- test/titerate.c | 2 +- 11 files changed, 963 insertions(+), 968 deletions(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index d80f48f..4868d07 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -50,5 +50,5 @@ set (CTEST_TEST_TIMEOUT 1200 CACHE STRING set (DART_TESTING_TIMEOUT 1200 CACHE STRING "Maximum time allowed before CTest will kill the test." FORCE) -SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING +set (CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING "How long to wait between timed-out CTest submissions.") diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index e6c9619..3511d05 100644 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -45,7 +45,7 @@ set (CTEST_SOURCE_VERSEXT "") #CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 #MODEL - CDash group name #HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub, qsub -#MPI - enable MPI; +#MPI - enable MPI if (DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form # script.ctest,var1=value1,var2=value2 diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index a85405b..b1c29b2 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -209,7 +209,7 @@ public class TestH5P { @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_libver_bounds_invalidlow() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_EARLIEST-1, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST); } @Test(expected = HDF5FunctionArgumentException.class) diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 81a7ecb..7d690cf 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -29,8 +29,6 @@ import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; import hdf.hdf5lib.structs.H5AC_cache_config_t; -import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; -import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; import org.junit.Before; @@ -1401,5 +1399,4 @@ public class TestH5Pfapl { fail("H5P_evict_on_close: " + err); } } - } diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index f3049ed..27bda6f 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -109,4 +109,3 @@ public class TestH5Z { H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); } } - diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 9ea814c..447e827 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -13,7 +13,7 @@ #include "h5test.h" -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) # define H5_ZLIB_HEADER "zlib.h" #endif #if defined(H5_ZLIB_HEADER) @@ -46,10 +46,10 @@ #define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0)) /* Temporary filter IDs used for testing */ -#define H5Z_FILTER_BOGUS1 305 -#define H5Z_FILTER_BOGUS2 306 -#define ADD_ON 7 -#define FACTOR 3 +#define H5Z_FILTER_BOGUS1 305 +#define H5Z_FILTER_BOGUS2 306 +#define ADD_ON 7 +#define FACTOR 3 /* Constants for the overwrite test */ #define OVERWRITE_NDIMS 3 @@ -83,33 +83,33 @@ static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, /* This message derives from H5Z */ const H5Z_class2_t H5Z_BOGUS1[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS1, /* Filter id number */ + H5Z_FILTER_BOGUS1, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "bogus1", /* Filter name for debugging */ + "bogus1", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - filter_bogus1, /* The actual filter function */ + filter_bogus1, /* The actual filter function */ }}; const H5Z_class2_t H5Z_BOGUS2[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ - H5Z_FILTER_BOGUS2, /* Filter id number */ + H5Z_FILTER_BOGUS2, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ - "bogus2", /* Filter name for debugging */ + "bogus2", /* Filter name for debugging */ NULL, /* The "can apply" callback */ NULL, /* The "set local" callback */ - filter_bogus2, /* The actual filter function */ + filter_bogus2, /* The actual filter function */ }}; /*------------------------------------------------------------------------- - * Function: test_direct_chunk_write + * Function: test_direct_chunk_write * - * Purpose: Test the basic functionality of H5Dwrite_chunk + * Purpose: Test the basic functionality of H5Dwrite_chunk * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 30 November 2012 * *------------------------------------------------------------------------- @@ -121,7 +121,7 @@ test_direct_chunk_write (hid_t file) hid_t dataspace = -1, dataset = -1; hid_t mem_space = -1; hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; + hsize_t dims[2] = {NX, NY}; hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; herr_t status; @@ -136,11 +136,11 @@ test_direct_chunk_write (hid_t file) size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); const Bytef *z_src = (const Bytef*)(direct_buf); - Bytef *z_dst = NULL; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; + Bytef *z_dst = NULL; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; int aggression = 9; /* Compression aggression setting */ - void *outbuf = NULL; /* Pointer to new buffer */ + void *outbuf = NULL; /* Pointer to new buffer */ hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ @@ -175,29 +175,29 @@ test_direct_chunk_write (hid_t file) * creation properties. */ if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, - cparms, H5P_DEFAULT)) < 0) + cparms, H5P_DEFAULT)) < 0) goto error; /* Initialize the dataset */ for(i = n = 0; i < NX; i++) for(j = 0; j < NY; j++) - data[i][j] = n++; + data[i][j] = n++; if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; /* * Write the data for the dataset. It should stay in the chunk cache. - * It will be evicted from the cache by the H5Dwrite_chunk calls. + * It will be evicted from the cache by the H5Dwrite_chunk calls. */ if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, - dxpl, data)) < 0) + dxpl, data)) < 0) goto error; /* Initialize data for one chunk */ for(i = n = 0; i < CHUNK_NX; i++) for(j = 0; j < CHUNK_NY; j++) - direct_buf[i][j] = n++; + direct_buf[i][j] = n++; /* Allocate output (compressed) buffer */ outbuf = HDmalloc(z_dst_nbytes); @@ -218,8 +218,8 @@ test_direct_chunk_write (hid_t file) goto error; } - /* Write the compressed chunk data repeatedly to cover all the chunks in the - * dataset, using the direct writing function. */ + /* Write the compressed chunk data repeatedly to cover all the chunks in the + * dataset, using the direct writing function. */ for(i=0; i H5Fset_dset_no_attrs_hint(file, TRUE)) + /* Create the file for this test */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0) goto error; - puts("(minimized dataset object headers with file setting)"); - } - /* Cause the library to emit initial messages */ - if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0) - goto error; - if(H5Gclose(grp) < 0) - goto error; + if (TRUE == minimized_ohdr) { + if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) + goto error; + puts("(minimized dataset object headers with file setting)"); + } - nerrors += (test_create(file) < 0 ? 1 : 0); - nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); - nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); - nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0); - nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); - nerrors += (test_tconv(file) < 0 ? 1 : 0); - nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); - nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int(file) < 0 ? 1 : 0); - nerrors += (test_nbit_float(file) < 0 ? 1 : 0); - nerrors += (test_nbit_double(file) < 0 ? 1 : 0); - nerrors += (test_nbit_array(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); - nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); - nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); - nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); - nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); - nerrors += (test_multiopen (file) < 0 ? 1 : 0); - nerrors += (test_types(file) < 0 ? 1 : 0); - nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); - nerrors += (test_missing_filter(file) < 0 ? 1 : 0); - nerrors += (test_can_apply(file) < 0 ? 1 : 0); - nerrors += (test_can_apply2(file) < 0 ? 1 : 0); - nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); - nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); - nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); - nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); - nerrors += (test_filter_delete(file) < 0 ? 1 : 0); - nerrors += (test_filters_endianess() < 0 ? 1 : 0); - nerrors += (test_zero_dims(file) < 0 ? 1 : 0); - nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); - nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); + /* Cause the library to emit initial messages */ + if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0) + goto error; + if(H5Gclose(grp) < 0) + goto error; + + nerrors += (test_create(file) < 0 ? 1 : 0); + nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0); + nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0); + nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0); + nerrors += (test_conv_buffer(file) < 0 ? 1 : 0); + nerrors += (test_tconv(file) < 0 ? 1 : 0); + nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int(file) < 0 ? 1 : 0); + nerrors += (test_nbit_float(file) < 0 ? 1 : 0); + nerrors += (test_nbit_double(file) < 0 ? 1 : 0); + nerrors += (test_nbit_array(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0); + nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0); + nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0); + nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0); + nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0); + nerrors += (test_multiopen (file) < 0 ? 1 : 0); + nerrors += (test_types(file) < 0 ? 1 : 0); + nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0); + nerrors += (test_missing_filter(file) < 0 ? 1 : 0); + nerrors += (test_can_apply(file) < 0 ? 1 : 0); + nerrors += (test_can_apply2(file) < 0 ? 1 : 0); + nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0); + nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0); + nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0); + nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0); + nerrors += (test_filter_delete(file) < 0 ? 1 : 0); + nerrors += (test_filters_endianess() < 0 ? 1 : 0); + nerrors += (test_zero_dims(file) < 0 ? 1 : 0); + nerrors += (test_missing_chunk(file) < 0 ? 1 : 0); + nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += (test_deprec(file) < 0 ? 1 : 0); + nerrors += (test_deprec(file) < 0 ? 1 : 0); #endif /* H5_NO_DEPRECATED_SYMBOLS */ - nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); - nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); - nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); - nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); - nerrors += (test_idx_compatible() < 0 ? 1 : 0); - nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); - nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); - nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); - nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); - nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0); - nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0); - - nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); - - if(H5Fclose(file) < 0) - goto error; - } /* end for new_format */ - } /* for minimized dset object headers */ + nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0); + nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0); + nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); + nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); + nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); + nerrors += (test_idx_compatible() < 0 ? 1 : 0); + nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); + nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0); + nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); + nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); + nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0); + nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0); + + nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0); + + if(H5Fclose(file) < 0) + goto error; + } /* end for new_format */ + } /* end for minimized_ohdr */ } /* end for paged */ /* Close property lists */ @@ -13363,7 +13368,7 @@ main(void) nerrors += (test_gather_error() < 0 ? 1 : 0); /* Tests version bounds using its own file */ - nerrors += (test_versionbounds() < 0 ? 1 : 0); + nerrors += (test_versionbounds() < 0 ? 1 : 0); nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); diff --git a/test/dt_arith.c b/test/dt_arith.c index 645608b..7e1adf5 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -21,7 +21,7 @@ #include "h5test.h" /* Number of elements in each random test */ -#define NTESTELEM 10000 +#define NTESTELEM 10000 /* Epsilon for floating-point comparisons */ #define FP_EPSILON 0.000001F @@ -30,7 +30,7 @@ * Offset from alinged memory returned by malloc(). This can be used to test * that type conversions handle non-aligned buffers correctly. */ -#define ALIGNMENT 1 +#define ALIGNMENT 1 /* * Define if you want to test alignment code on a machine that doesn't @@ -41,7 +41,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_FRIEND /*suppress error about including H5Tpkg */ +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif #define SET_ALIGNMENT(TYPE,VAL) \ @@ -58,7 +58,7 @@ const char *FILENAME[] = { * endian. If local variable `endian' is H5T_ORDER_BE then the result will * be I, otherwise the result will be Z-(I+1). */ -#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) +#define ENDIAN(Z,I,E) (H5T_ORDER_BE==E?(I):(Z)-((I)+1)) typedef enum dtype_t { INT_SCHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT, @@ -100,8 +100,8 @@ static int skip_overflow_tests_g = 0; static int without_hardware_g = 0; /* Allocates memory aligned on a certain boundary. */ -#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) -#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) +#define aligned_malloc(Z) ((void*)((char*)HDmalloc(ALIGNMENT+Z)+ALIGNMENT)) +#define aligned_free(M) HDfree((char*)(M)-ALIGNMENT) /* Initialize source buffer of integer for integer->integer and integer->floating-point conversion test. * This algorithm is mainly to avoid any casting and comparison between source and destination types @@ -394,13 +394,13 @@ static int my_isinf(int endian, unsigned char *val, size_t size, size_t mpos, size_t msize, size_t epos, size_t esize); /*------------------------------------------------------------------------- - * Function: fpe_handler + * Function: fpe_handler * - * Purpose: Exit with 255 + * Purpose: Exit with 255 * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, July 6, 1998 * * Modifications: @@ -419,16 +419,16 @@ fpe_handler(int H5_ATTR_UNUSED signo) HDexit(255); } - + /*------------------------------------------------------------------------- - * Function: reset_hdf5 + * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -461,19 +461,19 @@ reset_hdf5(void) } - + /*------------------------------------------------------------------------- - * Function: except_func + * Function: except_func * - * Purpose: Gets called for all data type conversion exceptions. + * Purpose: Gets called for all data type conversion exceptions. * - * Return: H5T_CONV_ABORT: -1 + * Return: H5T_CONV_ABORT: -1 * * H5T_CONV_UNHANDLED 0 * * H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * April 19, 2004 * * Modifications: @@ -482,7 +482,7 @@ reset_hdf5(void) */ static H5T_conv_ret_t except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { H5T_conv_ret_t ret = H5T_CONV_HANDLED; @@ -509,19 +509,19 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return ret; } - + /*------------------------------------------------------------------------- - * Function: some_dummy_func + * Function: some_dummy_func * - * Purpose: A dummy function to help check for overflow. + * Purpose: A dummy function to help check for overflow. * - * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT - * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW - * CHECKING. + * Note: DO NOT DECLARE THIS FUNCTION STATIC OR THE COMPILER MIGHT + * PROMOTE ARGUMENT `x' TO DOUBLE AND DEFEAT THE OVERFLOW + * CHECKING. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * *------------------------------------------------------------------------- @@ -529,21 +529,21 @@ except_func(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 void some_dummy_func(float x) { - char s[128]; + char s[128]; HDsnprintf(s, sizeof(s), "%g", (double)x); } - + /*------------------------------------------------------------------------- - * Function: generates_sigfpe + * Function: generates_sigfpe * - * Purpose: Determines if SIGFPE is generated from overflows. We must be - * able to fork() and waitpid() in order for this test to work - * properly. Sets skip_overflow_tests_g to non-zero if they - * would generate SIGBUS, zero otherwise. + * Purpose: Determines if SIGFPE is generated from overflows. We must be + * able to fork() and waitpid() in order for this test to work + * properly. Sets skip_overflow_tests_g to non-zero if they + * would generate SIGBUS, zero otherwise. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, July 21, 1998 * * Modifications: @@ -554,38 +554,38 @@ static void generates_sigfpe(void) { #if defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID) - pid_t pid; - int status; - size_t i, j; - double d; + pid_t pid; + int status; + size_t i, j; + double d; unsigned char *dp = (unsigned char*)&d; - float f; + float f; HDfflush(stdout); HDfflush(stderr); if ((pid=fork()) < 0) { - HDperror("fork"); - HDexit(EXIT_FAILURE); + HDperror("fork"); + HDexit(EXIT_FAILURE); } else if (0==pid) { - for (i=0; i<2000; i++) { - for(j = 0; j < sizeof(double); j++) + for (i=0; i<2000; i++) { + for(j = 0; j < sizeof(double); j++) dp[j] = (unsigned char)HDrand(); - f = (float)d; - some_dummy_func((float)f); - } - HDexit(EXIT_SUCCESS); + f = (float)d; + some_dummy_func((float)f); + } + HDexit(EXIT_SUCCESS); } while (pid!=waitpid(pid, &status, 0)) /*void*/; if (WIFEXITED(status) && 0==WEXITSTATUS(status)) { - HDputs("Floating-point overflow cases will be tested."); - skip_overflow_tests_g = FALSE; + HDputs("Floating-point overflow cases will be tested."); + skip_overflow_tests_g = FALSE; } else if (WIFSIGNALED(status) && SIGFPE==WTERMSIG(status)) { - HDputs("Floating-point overflow cases cannot be safely tested."); - skip_overflow_tests_g = TRUE; - /* delete the core dump file that SIGFPE may have created */ - HDunlink("core"); + HDputs("Floating-point overflow cases cannot be safely tested."); + skip_overflow_tests_g = TRUE; + /* delete the core dump file that SIGFPE may have created */ + HDunlink("core"); } #else HDputs("Cannot determine if floating-point overflows generate a SIGFPE;"); @@ -595,7 +595,7 @@ generates_sigfpe(void) #endif } - + /*------------------------------------------------------------------------- * Function: test_hard_query * @@ -621,7 +621,7 @@ test_hard_query(void) /* Verify the conversion from int to float is a hard conversion. */ if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } @@ -630,7 +630,7 @@ test_hard_query(void) H5Tunregister(H5T_PERS_HARD, NULL, H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != FALSE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } @@ -639,7 +639,7 @@ test_hard_query(void) H5Tregister(H5T_PERS_HARD, "int_flt", H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (H5T_conv_t)((void (*) (void))H5T__conv_int_float)); if(H5Tcompiler_conv(H5T_NATIVE_INT, H5T_NATIVE_FLOAT) != TRUE) { H5_FAILED(); - printf("Can't query conversion function\n"); + HDprintf("Can't query conversion function\n"); goto error; } @@ -660,16 +660,16 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: expt_handle + * Function: expt_handle * - * Purpose: Gets called from test_particular_fp_integer() for data type + * Purpose: Gets called from test_particular_fp_integer() for data type * conversion exceptions. * - * Return: H5T_CONV_HANDLED 1 + * Return: H5T_CONV_HANDLED 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Sept 7, 2005 * * Modifications: @@ -678,7 +678,7 @@ error: */ static H5T_conv_ret_t expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, void H5_ATTR_UNUSED *src_buf, - void *dst_buf, void *user_data) + void *dst_buf, void *user_data) { signed char fill_value1 = 7; int fill_value2 = 13; @@ -694,7 +694,7 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return H5T_CONV_HANDLED; } - + /*------------------------------------------------------------------------- * Function: test_particular_fp_integer * @@ -714,12 +714,6 @@ expt_handle(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 * Return: Success: 0 * * Failure: number of errors - * - * Programmer: Raymond Lu - * Sept 7, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_particular_fp_integer(void) @@ -735,7 +729,7 @@ static int test_particular_fp_integer(void) float src_f = (float)INT_MAX; int dst_i; int fill_value = 13; - int endian; /*endianess */ + int endian; /*endianess */ unsigned int fails_this_test = 0; size_t j; @@ -743,7 +737,7 @@ static int test_particular_fp_integer(void) if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } @@ -754,25 +748,25 @@ static int test_particular_fp_integer(void) buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); saved_buf1 = (unsigned char*)HDcalloc((size_t)1, (size_t)MAX(src_size1, dst_size1)); - memcpy(buf1, &src_d, src_size1); - memcpy(saved_buf1, &src_d, src_size1); + HDmemcpy(buf1, &src_d, src_size1); + HDmemcpy(saved_buf1, &src_d, src_size1); /* Register exception handling function and signal the destination is "signed char". */ flag = 1; if(H5Pset_type_conv_cb(dxpl_id, expt_handle, &flag) < 0) { H5_FAILED(); - printf("Can't register conversion callback\n"); + HDprintf("Can't register conversion callback\n"); goto error; } /* Do conversion */ if(H5Tconvert(H5T_NATIVE_DOUBLE, H5T_NATIVE_SCHAR, (size_t)1, buf1, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } - memcpy(&dst_c, buf1, dst_size1); + HDmemcpy(&dst_c, buf1, dst_size1); /* Print errors */ if(dst_c != SCHAR_MAX) { @@ -782,20 +776,20 @@ static int test_particular_fp_integer(void) if(0 == fails_this_test++) H5_FAILED(); - printf(" test double to signed char:\n"); - printf(" src = "); + HDprintf(" test double to signed char:\n"); + HDprintf(" src = "); for (j=0; j derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1127,43 +1121,43 @@ test_derived_flt(void) *--------------------------------------------------------------------------*/ if(H5Tset_fields(tid2, (size_t)23, (size_t)16, (size_t)7, (size_t)0, (size_t)16) < 0) { H5_FAILED(); - printf("Can't set fields\n"); + HDprintf("Can't set fields\n"); goto error; } if(H5Tset_offset(tid2, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_precision(tid2, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision 2\n"); + HDprintf("Can't set precision 2\n"); goto error; } if(H5Tset_size(tid2, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_ebias(tid2, (size_t)63) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_pad(tid2, H5T_PAD_ZERO, H5T_PAD_ZERO) < 0) { H5_FAILED(); - printf("Can't set padding\n"); + HDprintf("Can't set padding\n"); goto error; } if(H5Tcommit2(file, "new float type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't set inpad\n"); + HDprintf("Can't set inpad\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1171,33 +1165,33 @@ test_derived_flt(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_fields(tid2, &spos, &epos, &esize, &mpos, &msize) < 0) { H5_FAILED(); - printf("Can't get fields\n"); + HDprintf("Can't get fields\n"); goto error; } if(spos != 23 || epos != 16 || esize != 7 || mpos != 0 || msize != 16) { H5_FAILED(); - printf("Wrong field values\n"); + HDprintf("Wrong field values\n"); goto error; } if(H5Tget_precision(tid2) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2)!=0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if((size = H5Tget_size(tid2))!=3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_ebias(tid2)!=63) { H5_FAILED(); - printf("Can't get exponent bias or wrong bias\n"); + HDprintf("Can't get exponent bias or wrong bias\n"); goto error; } @@ -1221,13 +1215,13 @@ test_derived_flt(void) * the precision and exponent power. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 1st back to the 2nd derived floating-point type. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1249,22 +1243,22 @@ test_derived_flt(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived floating-point -> derived floating-point conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1277,25 +1271,25 @@ test_derived_flt(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1304,7 +1298,7 @@ test_derived_flt(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1328,7 +1322,7 @@ test_derived_flt(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- * Function: test_derived_integer * @@ -1353,11 +1347,11 @@ test_derived_integer(void) char filename[1024]; size_t src_size, dst_size; unsigned char *buf=NULL, *saved_buf=NULL; - int endian; /*endianess */ + int endian; /*endianess */ size_t nelmts = NTESTELEM; unsigned int fails_this_test = 0; - const size_t max_fails=40; /*max number of failures*/ - char str[256]; /*message string */ + const size_t max_fails=40; /*max number of failures*/ + char str[256]; /*message string */ unsigned int i, j; TESTING("user-define and query functions of integer types"); @@ -1366,25 +1360,25 @@ test_derived_integer(void) h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf("Can't create file\n"); + HDprintf("Can't create file\n"); goto error; } if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { H5_FAILED(); - printf("Can't create data transfer property list\n"); + HDprintf("Can't create data transfer property list\n"); goto error; } if((tid1 = H5Tcopy(H5T_STD_I32LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } if((tid2 = H5Tcopy(H5T_STD_U64LE)) < 0) { H5_FAILED(); - printf("Can't copy data type\n"); + HDprintf("Can't copy data type\n"); goto error; } @@ -1402,37 +1396,37 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_offset(tid1, (size_t)0) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_size(tid1, (size_t)3) < 0) { H5_FAILED(); - printf("Can't set size\n"); + HDprintf("Can't set size\n"); goto error; } if(H5Tset_precision(tid1, (size_t)24) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_order(tid1, H5T_ORDER_BE) < 0) { H5_FAILED(); - printf("Can't set order\n"); + HDprintf("Can't set order\n"); goto error; } if(H5Tcommit2(file, "new integer type 1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1440,22 +1434,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid1) != 24) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid1) != 0) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid1) != 3) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_order(tid1)!=H5T_ORDER_BE) { H5_FAILED(); - printf("Can't get order or wrong order\n"); + HDprintf("Can't get order or wrong order\n"); goto error; } @@ -1469,31 +1463,31 @@ test_derived_integer(void) *--------------------------------------------------------------------------*/ if(H5Tset_precision(tid2, (size_t)48) < 0) { H5_FAILED(); - printf("Can't set precision\n"); + HDprintf("Can't set precision\n"); goto error; } if(H5Tset_offset(tid2, (size_t)10) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tset_sign(tid2, H5T_SGN_2) < 0) { H5_FAILED(); - printf("Can't set offset\n"); + HDprintf("Can't set offset\n"); goto error; } if(H5Tcommit2(file, "new integer type 2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit data type\n"); + HDprintf("Can't commit data type\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } @@ -1501,22 +1495,22 @@ test_derived_integer(void) FAIL_PUTS_ERROR("Can't open datatype") if(H5Tget_precision(tid2) != 48) { H5_FAILED(); - printf("Can't get precision or wrong precision\n"); + HDprintf("Can't get precision or wrong precision\n"); goto error; } if(H5Tget_offset(tid2) != 10) { H5_FAILED(); - printf("Can't get offset or wrong offset\n"); + HDprintf("Can't get offset or wrong offset\n"); goto error; } if(H5Tget_size(tid2) != 8) { H5_FAILED(); - printf("Can't get size or wrong size\n"); + HDprintf("Can't get size or wrong size\n"); goto error; } if(H5Tget_sign(tid2)!=H5T_SGN_2) { H5_FAILED(); - printf("Can't get sign or wrong sign\n"); + HDprintf("Can't get sign or wrong sign\n"); goto error; } @@ -1540,13 +1534,13 @@ test_derived_integer(void) * the 1st type's precision. */ if(H5Tconvert(tid1, tid2, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } /* Convert data from the 2nd back to the 1st derived integer type. */ if(H5Tconvert(tid2, tid1, nelmts, buf, NULL, dxpl_id) < 0) { H5_FAILED(); - printf("Can't convert data\n"); + HDprintf("Can't convert data\n"); goto error; } @@ -1560,22 +1554,22 @@ test_derived_integer(void) /* Print errors */ if (0==fails_this_test++) { - HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); - printf("%-70s", str); - HDfflush(stdout); + HDsnprintf(str, sizeof(str), "\nTesting random sw derived integer -> derived integer conversions"); + HDprintf("%-70s", str); + HDfflush(stdout); H5_FAILED(); } - printf(" test %u elmt %u: \n", 1, (unsigned)i); + HDprintf(" test %u elmt %u: \n", 1, (unsigned)i); - printf(" src = "); + HDprintf(" src = "); for (j=0; j=max_fails) { HDputs(" maximum failures reached, aborting test..."); @@ -1585,25 +1579,25 @@ test_derived_integer(void) if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } if(H5Pclose(dxpl_id) < 0) { H5_FAILED(); - printf("Can't close property list\n"); + HDprintf("Can't close property list\n"); goto error; } if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -1615,7 +1609,7 @@ test_derived_integer(void) /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); - reset_hdf5(); /*print statistics*/ + reset_hdf5(); /*print statistics*/ return 0; @@ -1638,24 +1632,24 @@ test_derived_integer(void) return MAX((int)fails_this_test, 1); } - + /*------------------------------------------------------------------------- - * Function: test_conv_int_1 + * Function: test_conv_int_1 * - * Purpose: Test conversion of integer values from SRC to DST. - * These types should be any combination of: + * Purpose: Test conversion of integer values from SRC to DST. + * These types should be any combination of: * - * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR - * H5T_NATIVE_SHORT H5T_NATIVE_USHORT - * H5T_NATIVE_INT H5T_NATIVE_UINT - * H5T_NATIVE_LONG H5T_NATIVE_ULONG - * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG + * H5T_NATIVE_SCHAR H5T_NATIVE_UCHAR + * H5T_NATIVE_SHORT H5T_NATIVE_USHORT + * H5T_NATIVE_INT H5T_NATIVE_UINT + * H5T_NATIVE_LONG H5T_NATIVE_ULONG + * H5T_NATIVE_LLONG H5T_NATIVE_ULLONG * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -1665,121 +1659,121 @@ test_derived_integer(void) static int test_conv_int_1(const char *name, hid_t src, hid_t dst) { - size_t nelmts=0; /*num values per test */ - const size_t max_fails=8; /*max number of failures*/ - size_t fails_all_tests=0; /*number of failures */ - size_t fails_this_test; /*fails for this test */ - char str[256]; /*hello string */ - dtype_t src_type, dst_type; /*data types */ - const char *src_type_name=NULL; /*source type name */ - const char *dst_type_name=NULL; /*destination type name */ - int endian; /*machine endianess */ - size_t src_size, dst_size; /*type sizes */ - unsigned char *buf=NULL; /*buffer for conversion */ - unsigned char *saved=NULL; /*original values */ - size_t j, k; /*counters */ - unsigned char *hw=NULL; /*hardware conv result */ - unsigned char src_bits[32]; /*src value in LE order */ - unsigned char dst_bits[32]; /*dest value in LE order*/ - size_t src_nbits; /*source length in bits */ - size_t dst_nbits; /*dst length in bits */ + size_t nelmts=0; /*num values per test */ + const size_t max_fails=8; /*max number of failures*/ + size_t fails_all_tests=0; /*number of failures */ + size_t fails_this_test; /*fails for this test */ + char str[256]; /*hello string */ + dtype_t src_type, dst_type; /*data types */ + const char *src_type_name=NULL; /*source type name */ + const char *dst_type_name=NULL; /*destination type name */ + int endian; /*machine endianess */ + size_t src_size, dst_size; /*type sizes */ + unsigned char *buf=NULL; /*buffer for conversion */ + unsigned char *saved=NULL; /*original values */ + size_t j, k; /*counters */ + unsigned char *hw=NULL; /*hardware conv result */ + unsigned char src_bits[32]; /*src value in LE order */ + unsigned char dst_bits[32]; /*dest value in LE order*/ + size_t src_nbits; /*source length in bits */ + size_t dst_nbits; /*dst length in bits */ H5T_sign_t src_sign; /*source sign type */ H5T_sign_t dst_sign; /*dst sign type */ - void *aligned=NULL; /*aligned temp buffer */ - signed char hw_char; - unsigned char hw_uchar; - short hw_short; - unsigned short hw_ushort; - int hw_int; - unsigned hw_uint; - long hw_long; - unsigned long hw_ulong; - long long hw_llong; - unsigned long long hw_ullong; + void *aligned=NULL; /*aligned temp buffer */ + signed char hw_char; + unsigned char hw_uchar; + short hw_short; + unsigned short hw_ushort; + int hw_int; + unsigned hw_uint; + long hw_long; + unsigned long hw_ulong; + long long hw_llong; + unsigned long long hw_ullong; /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_SCHAR)) { - src_type_name = "signed char"; - src_type = INT_SCHAR; + src_type_name = "signed char"; + src_type = INT_SCHAR; } else if (H5Tequal(src, H5T_NATIVE_UCHAR)) { - src_type_name = "unsigned char"; - src_type = INT_UCHAR; + src_type_name = "unsigned char"; + src_type = INT_UCHAR; } else if (H5Tequal(src, H5T_NATIVE_SHORT)) { - src_type_name = "short"; - src_type = INT_SHORT; + src_type_name = "short"; + src_type = INT_SHORT; } else if (H5Tequal(src, H5T_NATIVE_USHORT)) { - src_type_name = "unsigned short"; - src_type = INT_USHORT; + src_type_name = "unsigned short"; + src_type = INT_USHORT; } else if (H5Tequal(src, H5T_NATIVE_INT)) { - src_type_name = "int"; - src_type = INT_INT; + src_type_name = "int"; + src_type = INT_INT; } else if (H5Tequal(src, H5T_NATIVE_UINT)) { - src_type_name = "unsigned int"; - src_type = INT_UINT; + src_type_name = "unsigned int"; + src_type = INT_UINT; } else if (H5Tequal(src, H5T_NATIVE_LONG)) { - src_type_name = "long"; - src_type = INT_LONG; + src_type_name = "long"; + src_type = INT_LONG; } else if (H5Tequal(src, H5T_NATIVE_ULONG)) { - src_type_name = "unsigned long"; - src_type = INT_ULONG; + src_type_name = "unsigned long"; + src_type = INT_ULONG; } else if (H5Tequal(src, H5T_NATIVE_LLONG)) { - src_type_name = "long long"; - src_type = INT_LLONG; + src_type_name = "long long"; + src_type = INT_LLONG; } else if (H5Tequal(src, H5T_NATIVE_ULLONG)) { - src_type_name = "unsigned long long"; - src_type = INT_ULLONG; + src_type_name = "unsigned long long"; + src_type = INT_ULLONG; } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_SCHAR)) { - dst_type_name = "signed char"; - dst_type = INT_SCHAR; + dst_type_name = "signed char"; + dst_type = INT_SCHAR; } else if (H5Tequal(dst, H5T_NATIVE_UCHAR)) { - dst_type_name = "unsigned char"; - dst_type = INT_UCHAR; + dst_type_name = "unsigned char"; + dst_type = INT_UCHAR; } else if (H5Tequal(dst, H5T_NATIVE_SHORT)) { - dst_type_name = "short"; - dst_type = INT_SHORT; + dst_type_name = "short"; + dst_type = INT_SHORT; } else if (H5Tequal(dst, H5T_NATIVE_USHORT)) { - dst_type_name = "unsigned short"; - dst_type = INT_USHORT; + dst_type_name = "unsigned short"; + dst_type = INT_USHORT; } else if (H5Tequal(dst, H5T_NATIVE_INT)) { - dst_type_name = "int"; - dst_type = INT_INT; + dst_type_name = "int"; + dst_type = INT_INT; } else if (H5Tequal(dst, H5T_NATIVE_UINT)) { - dst_type_name = "unsigned int"; - dst_type = INT_UINT; + dst_type_name = "unsigned int"; + dst_type = INT_UINT; } else if (H5Tequal(dst, H5T_NATIVE_LONG)) { - dst_type_name = "long"; - dst_type = INT_LONG; + dst_type_name = "long"; + dst_type = INT_LONG; } else if (H5Tequal(dst, H5T_NATIVE_ULONG)) { - dst_type_name = "unsigned long"; - dst_type = INT_ULONG; + dst_type_name = "unsigned long"; + dst_type = INT_ULONG; } else if (H5Tequal(dst, H5T_NATIVE_LLONG)) { - dst_type_name = "long long"; - dst_type = INT_LLONG; + dst_type_name = "long long"; + dst_type = INT_LLONG; } else if (H5Tequal(dst, H5T_NATIVE_ULLONG)) { - dst_type_name = "unsigned long long"; - dst_type = INT_ULLONG; + dst_type_name = "unsigned long long"; + dst_type = INT_ULLONG; } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ if (OTHER==src_type || OTHER==dst_type) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -2462,44 +2456,44 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) /* Print errors */ if (0==fails_this_test++) H5_FAILED(); - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k0) { - while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; - if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { - return 0; /*child exit after catching SIGFPE*/ - } else if (WIFEXITED(status)) { - return WEXITSTATUS(status); - } else if (WIFSIGNALED(status)) { - HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); - HDputs(str); - return 1; /*child exit after catching non-SIGFPE signal */ - } else { - HDputs(" Child didn't exit normally."); - return 1; - } + while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; + if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { + return 0; /*child exit after catching SIGFPE*/ + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + HDsnprintf(str, sizeof(str), " Child caught signal %d.", WTERMSIG(status)); + HDputs(str); + return 1; /*child exit after catching non-SIGFPE signal */ + } else { + HDputs(" Child didn't exit normally."); + return 1; + } } #endif @@ -2916,35 +2910,35 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) /* What are the names of the source and destination types */ if (H5Tequal(src, H5T_NATIVE_FLOAT)) { - src_type_name = "float"; - src_type = FLT_FLOAT; + src_type_name = "float"; + src_type = FLT_FLOAT; } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) { - src_type_name = "double"; - src_type = FLT_DOUBLE; + src_type_name = "double"; + src_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) { - src_type_name = "long double"; - src_type = FLT_LDOUBLE; + src_type_name = "long double"; + src_type = FLT_LDOUBLE; #endif } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; + src_type_name = "UNKNOWN"; + src_type = OTHER; } if (H5Tequal(dst, H5T_NATIVE_FLOAT)) { - dst_type_name = "float"; - dst_type = FLT_FLOAT; + dst_type_name = "float"; + dst_type = FLT_FLOAT; } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) { - dst_type_name = "double"; - dst_type = FLT_DOUBLE; + dst_type_name = "double"; + dst_type = FLT_DOUBLE; #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) { - dst_type_name = "long double"; - dst_type = FLT_LDOUBLE; + dst_type_name = "long double"; + dst_type = FLT_LDOUBLE; #endif } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; + dst_type_name = "UNKNOWN"; + dst_type = OTHER; } /* Sanity checks */ @@ -2952,22 +2946,22 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER==src_type || OTHER==dst_type) { if(!strcmp(name, "noop")) - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_SPECIAL) - HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_NORMAL) - HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s normalized %s -> %s conversions", + name, src_type_name, dst_type_name); else if(run_test==TEST_DENORM) - HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", - name, src_type_name, dst_type_name); + HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", + name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } else { if(!strcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", @@ -2982,7 +2976,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test = 0; } @@ -3199,18 +3193,18 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) * the SGI compiler assigns the dst's maximal value. */ { - double check_mant[2]; - int check_expo[2]; + double check_mant[2]; + int check_expo[2]; if (FLT_FLOAT==dst_type) { float x; HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(float), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexpf(x, check_expo+0); check_mant[1] = HDfrexpf(hw_f, check_expo+1); } else if (FLT_DOUBLE==dst_type) { @@ -3218,10 +3212,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) - continue; /* all underflowed, no error */ + continue; /* all underflowed, no error */ if (overflow && my_isinf(dendian, buf+j*sizeof(double), dst_size, dst_mpos, dst_msize, dst_epos, dst_esize)) - continue; /* all overflowed, no error */ + continue; /* all overflowed, no error */ check_mant[0] = HDfrexp(x, check_expo+0); check_mant[1] = HDfrexp(hw_d, check_expo+1); #if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE) @@ -3264,20 +3258,20 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u\n", (unsigned)j); + HDprintf(" elmt %u\n", (unsigned)j); - printf(" src ="); + HDprintf(" src ="); for (k=0; k %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; } if ((INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3566,12 +3560,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && FLT_LDOUBLE!=dst_type #endif )) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 1. Not an integer-float conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 1. Not an integer-float conversion."); + goto error; } if ((FLT_FLOAT==src_type || FLT_DOUBLE==src_type @@ -3583,12 +3577,12 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) && INT_USHORT!=dst_type && INT_INT!=dst_type && INT_UINT!=dst_type && INT_LONG!=dst_type && INT_ULONG!=dst_type && INT_LLONG!=dst_type && INT_ULLONG!=dst_type)) { - HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" 2. Not a float-integer conversion."); - goto error; + HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", + name, src_type_name, dst_type_name); + HDprintf("%-70s", str); + H5_FAILED(); + HDputs(" 2. Not a float-integer conversion."); + goto error; } if (INT_SCHAR==src_type || INT_UCHAR==src_type || INT_SHORT==src_type || @@ -3597,7 +3591,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) INT_ULLONG==src_type) { HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } else { @@ -3610,7 +3604,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) else HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, src_type_name, dst_type_name); - printf("%-70s", str); + HDprintf("%-70s", str); HDfflush(stdout); fails_this_test=0; } @@ -4347,44 +4341,44 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) H5_WARNING(); } } - printf(" elmt %u: \n", (unsigned)j); + HDprintf(" elmt %u: \n", (unsigned)j); - printf(" src = "); + HDprintf(" src = "); for (k=0; k %s conversions", name, "long double", "float"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4915,11 +4909,11 @@ run_fp_tests(const char *name) nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "float or double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -4934,15 +4928,15 @@ done: return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_int_fp_conv + * Function: run_int_fp_conv * - * Purpose: Runs all integer-float tests. + * Purpose: Runs all integer-float tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -4952,7 +4946,7 @@ done: static int run_int_fp_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_FLOAT); nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_SCHAR, H5T_NATIVE_DOUBLE); @@ -5001,11 +4995,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE); #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "(unsigned) long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5020,11 +5014,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler error in handling conversion."); } @@ -5033,11 +5027,11 @@ run_int_fp_conv(const char *name) nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULLONG, H5T_NATIVE_LDOUBLE); #else /* H5_LLONG_TO_LDOUBLE_CORRECT */ { - char str[256]; /*hello string */ + char str[256]; /*hello string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "unsigned long long", "long double"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); HDputs(" Test skipped due to compiler not handling conversion."); } @@ -5048,15 +5042,15 @@ run_int_fp_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- - * Function: run_fp_int_conv + * Function: run_fp_int_conv * - * Purpose: Runs all float-integer tests. + * Purpose: Runs all float-integer tests. * - * Return: Number of errors + * Return: Number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Monday, November 10, 2003 * * Modifications: @@ -5066,7 +5060,7 @@ run_int_fp_conv(const char *name) static int run_fp_int_conv(const char *name) { - int nerrors = 0; + int nerrors = 0; int test_values; for(test_values = TEST_NORMAL; test_values <= TEST_SPECIAL; test_values++) { @@ -5111,7 +5105,7 @@ run_fp_int_conv(const char *name) #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE if(test_values != TEST_SPECIAL) { - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); @@ -5119,18 +5113,18 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); } else { #ifndef H5_DISABLE_SOME_LDOUBLE_CONV - nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); + nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT); #else - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions", name, "long double", "signed and unsigned char, short, int, long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu."); @@ -5152,11 +5146,11 @@ run_fp_int_conv(const char *name) } #else { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "(unsigned) long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to the special algorithm of hardware conversion."); @@ -5172,11 +5166,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5189,11 +5183,11 @@ run_fp_int_conv(const char *name) nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULLONG); #else /*H5_LDOUBLE_TO_LLONG_ACCURATE*/ { - char str[256]; /*string */ + char str[256]; /*string */ HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, "long double", "unsigned long long"); - printf("%-70s", str); + HDprintf("%-70s", str); SKIPPED(); #if H5_SIZEOF_LONG_DOUBLE!=0 HDputs(" Test skipped due to hardware conversion error."); @@ -5209,7 +5203,7 @@ run_fp_int_conv(const char *name) return nerrors; } - + /*------------------------------------------------------------------------- * Function: main * @@ -5233,7 +5227,7 @@ run_fp_int_conv(const char *name) int main(void) { - unsigned long nerrors = 0; + unsigned long nerrors = 0; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -5241,7 +5235,7 @@ main(void) reset_hdf5(); if (ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ @@ -5310,11 +5304,11 @@ main(void) h5_restore_err(); if (nerrors) { - printf("***** %lu FAILURE%s! *****\n", + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } - printf("All data type tests passed.\n"); + HDprintf("All data type tests passed.\n"); return 0; } diff --git a/test/earray.c b/test/earray.c index bb258c7..57df4d5 100644 --- a/test/earray.c +++ b/test/earray.c @@ -530,10 +530,10 @@ verify_cparam(const H5EA_t *ea, const H5EA_create_t *cparam) TEST_ERROR /* Success */ - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* verify_cparam() */ diff --git a/test/th5o.c b/test/th5o.c index 0aa589f..099bb92 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -378,7 +378,7 @@ test_h5o_refcount(void) { hid_t fid; /* HDF5 File ID */ hid_t grp, dset, dtype, dspace; /* Object identifiers */ - H5O_info_t oinfo; /* Object info struct */ + H5O_info_t oinfo; /* Object info struct */ hsize_t dims[RANK]; herr_t ret; /* Value returned from API calls */ @@ -850,7 +850,7 @@ test_h5o_link(void) /* Verify the data */ for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++) VERIFY(wdata[i], rdata[i], "H5Dread"); - + /* Create a group with no name*/ group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT); CHECK(group_id, FAIL, "H5Gcreate_anon"); @@ -1254,7 +1254,7 @@ test_h5o_getinfo_same_file(void) { hid_t fid1, fid2; /* HDF5 File ID */ hid_t gid1, gid2; /* Group IDs */ - H5O_info_t oinfo1, oinfo2; /* Object info structs */ + H5O_info_t oinfo1, oinfo2; /* Object info structs */ herr_t ret; /* Value returned from API calls */ /* Create a new HDF5 file */ @@ -1491,29 +1491,29 @@ test_h5o(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Objects\n")); - test_h5o_open(); /* Test generic open function */ - test_h5o_open_by_addr(); /* Test opening objects by address */ - test_h5o_close(); /* Test generic close function */ - test_h5o_refcount(); /* Test incrementing and decrementing reference count */ - test_h5o_plist(); /* Test object creation properties */ - test_h5o_link(); /* Test object link routine */ - test_h5o_comment(); /* Test routines for comment */ - test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_open(); /* Test generic open function */ + test_h5o_open_by_addr(); /* Test opening objects by address */ + test_h5o_close(); /* Test generic close function */ + test_h5o_refcount(); /* Test incrementing and decrementing reference count */ + test_h5o_plist(); /* Test object creation properties */ + test_h5o_link(); /* Test object link routine */ + test_h5o_comment(); /* Test routines for comment */ + test_h5o_comment_by_name(); /* Test routines for comment by name */ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ #ifndef H5_NO_DEPRECATED_SYMBOLS - test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ + test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */ #endif } /* test_h5o() */ /*------------------------------------------------------------------------- - * Function: cleanup_h5o + * Function: cleanup_h5o * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: James Laird + * Programmer: James Laird * June 3, 2006 * *------------------------------------------------------------------------- diff --git a/test/titerate.c b/test/titerate.c index 716654d..7bc3bf7 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -946,7 +946,7 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_ if (searched_err == NULL) return H5_ITER_ERROR; - + /* If the searched error message is found, stop the iteration */ if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) { -- cgit v0.12 From 605889fde8a92ed902bb4c5207912d1d687f7a99 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 30 Jul 2019 15:34:53 -0500 Subject: Add H5Sselect_shape_same and H5Sselect_intersect_block API routines, along with tests and minor cleanups and refactorings. --- src/H5Dchunk.c | 10 +- src/H5Dio.c | 4 +- src/H5Fint.c | 2 +- src/H5Pdcpl.c | 4 +- src/H5Sall.c | 48 +- src/H5Shyper.c | 114 ++--- src/H5Snone.c | 51 +- src/H5Spkg.h | 13 +- src/H5Spoint.c | 76 ++- src/H5Sprivate.h | 14 +- src/H5Spublic.h | 3 + src/H5Sselect.c | 168 ++++++- src/H5Stest.c | 44 -- test/objcopy.c | 90 +--- test/th5s.c | 42 +- test/tselect.c | 1310 +++++++++++++++++++++++++++---------------------- testpar/t_shapesame.c | 225 +++------ testpar/t_span_tree.c | 53 +- 18 files changed, 1238 insertions(+), 1033 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 7a07225..ec8ea4d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1245,7 +1245,7 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf } /* end else */ /* Build the memory selection for each chunk */ - if(sel_hyper_flag && H5S_select_shape_same(file_space, mem_space) == TRUE) { + if(sel_hyper_flag && H5S_SELECT_SHAPE_SAME(file_space, mem_space) == TRUE) { /* Reset chunk template information */ fm->mchunk_tmpl = NULL; @@ -1811,7 +1811,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t while(sel_points) { /* Check for intersection of current chunk and file selection */ /* (Casting away const OK - QAK) */ - if(TRUE == H5S_hyper_intersect_block((H5S_t *)fm->file_space, coords, end)) { + if(TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) { H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ hssize_t schunk_points; /* Number of elements in chunk selection */ @@ -2030,12 +2030,8 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) /* Sanity check */ HDassert(H5S_SEL_HYPERSLABS == chunk_sel_type); - /* Release the current selection */ - if(H5S_SELECT_RELEASE(chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection") - /* Copy the file chunk's selection */ - if(H5S_select_copy(chunk_info->mspace, chunk_info->fspace, FALSE) < 0) + if(H5S_SELECT_COPY(chunk_info->mspace, chunk_info->fspace, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection") /* Compute the adjustment for this chunk */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 9343b80..cdb73e3 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -490,7 +490,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * Note that in general, this requires us to touch up the memory buffer as * well. */ - if(TRUE == H5S_select_shape_same(mem_space, file_space) && + if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) && H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) { void *adj_buf = NULL; /* Pointer to the location in buf corresponding */ /* to the beginning of the projected mem space. */ @@ -725,7 +725,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * Note that in general, this requires us to touch up the memory buffer * as well. */ - if(TRUE == H5S_select_shape_same(mem_space, file_space) && + if(TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) && H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) { void *adj_buf = NULL; /* Pointer to the location in buf corresponding */ /* to the beginning of the projected mem space. */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 758900b..7ed3ca8 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -868,7 +868,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) /* The file is an hdf5 file if the hdf5 file signature can be found */ if(H5FD_locate_signature(file, &sig_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") ret_value = (HADDR_UNDEF != sig_addr); done: diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 6b9edf1..721ba89 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -827,7 +827,7 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, if((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) HGOTO_DONE(-1) if(!equal) HGOTO_DONE(1) - if((equal = H5S_select_shape_same(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) HGOTO_DONE(-1) + if((equal = H5S_SELECT_SHAPE_SAME(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) HGOTO_DONE(-1) if(!equal) HGOTO_DONE(1) @@ -847,7 +847,7 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, if((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) HGOTO_DONE(-1) if(!equal) HGOTO_DONE(1) - if((equal = H5S_select_shape_same(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) HGOTO_DONE(-1) + if((equal = H5S_SELECT_SHAPE_SAME(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) HGOTO_DONE(-1) if(!equal) HGOTO_DONE(1) } /* end for */ diff --git a/src/H5Sall.c b/src/H5Sall.c index fbe7041..9d0a65a 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -28,11 +28,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -63,6 +63,8 @@ static htri_t H5S__all_is_contiguous(const H5S_t *space); static htri_t H5S__all_is_single(const H5S_t *space); static htri_t H5S__all_is_regular(const H5S_t *space); static htri_t H5S__all_shape_same(const H5S_t *space1, const H5S_t *space2); +static htri_t H5S__all_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); static herr_t H5S__all_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__all_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__all_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); @@ -108,6 +110,7 @@ const H5S_select_class_t H5S_sel_all[1] = {{ H5S__all_is_single, H5S__all_is_regular, H5S__all_shape_same, + H5S__all_intersect_block, H5S__all_adjust_u, H5S__all_project_scalar, H5S__all_project_simple, @@ -976,6 +979,41 @@ done: /*-------------------------------------------------------------------------- NAME + H5S__all_intersect_block + PURPOSE + Detect intersections of selection with block + USAGE + htri_t H5S__all_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace with selection to use + const hsize_t *start; IN: Starting coordinate for block + const hsize_t *end; IN: Ending coordinate for block + RETURNS + Non-negative TRUE / FALSE on success, negative on failure + DESCRIPTION + Quickly detect intersections with a block + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S__all_intersect_block(const H5S_t H5_ATTR_UNUSED *space, + const hsize_t H5_ATTR_UNUSED *start, const hsize_t H5_ATTR_UNUSED *end) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(space); + HDassert(H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); + HDassert(start); + HDassert(end); + + FUNC_LEAVE_NOAPI(TRUE) +} /* end H5S__all_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__all_adjust_u PURPOSE Adjust an "all" selection by subtracting an offset diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 2acc135..492cd9e 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -28,30 +28,20 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ /* Local Macros */ /****************/ -/* Macro for checking if two ranges overlap one another */ -/* - * Check for the inverse of whether the ranges are disjoint. If they are - * disjoint, then the low bound of one of the ranges must be greater than the - * high bound of the other. - */ -/* (Assumes that low & high bounds are _inclusive_) */ -#define H5S_RANGE_OVERLAP(L1, H1, L2, H2) \ - (!((L1) > (H2) || (L2) > (H1))) - /* Flags for which hyperslab fragments to compute */ #define H5S_HYPER_COMPUTE_B_NOT_A 0x01 #define H5S_HYPER_COMPUTE_A_AND_B 0x02 @@ -197,6 +187,8 @@ static htri_t H5S__hyper_is_contiguous(const H5S_t *space); static htri_t H5S__hyper_is_single(const H5S_t *space); static htri_t H5S__hyper_is_regular(const H5S_t *space); static htri_t H5S__hyper_shape_same(const H5S_t *space1, const H5S_t *space2); +static htri_t H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); static herr_t H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__hyper_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); @@ -242,6 +234,7 @@ const H5S_select_class_t H5S_sel_hyper[1] = {{ H5S__hyper_is_single, H5S__hyper_is_regular, H5S__hyper_shape_same, + H5S__hyper_intersect_block, H5S__hyper_adjust_u, H5S__hyper_project_scalar, H5S__hyper_project_simple, @@ -4829,7 +4822,6 @@ static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { const hsize_t *low_bounds, *high_bounds; /* Pointers to the correct pair of low & high bounds */ - unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -4849,22 +4841,32 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) high_bounds = space->select.sel_info.hslab->span_lst->high_bounds; } /* end else */ - /* Loop over dimensions */ - for(u = 0; u < space->extent.rank; u++) { - /* Sanity check */ - HDassert(low_bounds[u] <= high_bounds[u]); + /* Check for offset set */ + if(space->select.offset_changed) { + unsigned u; /* Local index variable */ - /* Check for offset moving selection negative */ - if(((hssize_t)low_bounds[u] + space->select.offset[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + /* Loop over dimensions */ + for(u = 0; u < space->extent.rank; u++) { + /* Sanity check */ + HDassert(low_bounds[u] <= high_bounds[u]); - /* Set the low & high bounds in this dimension */ - start[u] = (hsize_t)((hssize_t)low_bounds[u] + space->select.offset[u]); - if((int)u == space->select.sel_info.hslab->unlim_dim) - end[u] = H5S_UNLIMITED; - else - end[u] = (hsize_t)((hssize_t)high_bounds[u] + space->select.offset[u]); - } /* end for */ + /* Check for offset moving selection negative */ + if(((hssize_t)low_bounds[u] + space->select.offset[u]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + + /* Set the low & high bounds in this dimension */ + start[u] = (hsize_t)((hssize_t)low_bounds[u] + space->select.offset[u]); + if((int)u == space->select.sel_info.hslab->unlim_dim) + end[u] = H5S_UNLIMITED; + else + end[u] = (hsize_t)((hssize_t)high_bounds[u] + space->select.offset[u]); + } /* end for */ + } /* end if */ + else { + /* Offset vector is still zeros, just copy low & high bounds */ + H5MM_memcpy(start, low_bounds, sizeof(hsize_t) * space->extent.rank); + H5MM_memcpy(end, high_bounds, sizeof(hsize_t) * space->extent.rank); + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -6240,32 +6242,31 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_hyper_intersect_block + H5S__hyper_intersect_block PURPOSE - Detect intersections in span trees + Detect intersections of selection with block USAGE - htri_t H5S_hyper_intersect_block(space, start, end) - H5S_t *space; IN: First dataspace to operate on span tree - hssize_t *start; IN: Starting coordinate for block - hssize_t *end; IN: Ending coordinate for block + htri_t H5S__hyper_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace with selection to use + const hsize_t *start; IN: Starting coordinate for block + const hsize_t *end; IN: Ending coordinate for block RETURNS - Non-negative on success, negative on failure + Non-negative TRUE / FALSE on success, negative on failure DESCRIPTION - Quickly detect intersections between span tree and block + Quickly detect intersections between both regular hyperslabs and span trees + with a block GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS Does not use selection offset. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t -H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end) +static htri_t +H5S__hyper_intersect_block(const H5S_t *space, const hsize_t *start, const hsize_t *end) { - const hsize_t *low_bounds, *high_bounds; /* Pointers to the correct pair of low & high bounds */ - unsigned u; /* Local index variable */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(space); @@ -6277,27 +6278,12 @@ H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end * to be impossible. */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_NO) - H5S__hyper_rebuild(space); - - /* Check which set of low & high bounds we should be using */ - if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { - low_bounds = space->select.sel_info.hslab->diminfo.low_bounds; - high_bounds = space->select.sel_info.hslab->diminfo.high_bounds; - } /* end if */ - else { - low_bounds = space->select.sel_info.hslab->span_lst->low_bounds; - high_bounds = space->select.sel_info.hslab->span_lst->high_bounds; - } /* end else */ - - /* Loop over selection bounds and block, checking for overlap */ - for(u = 0; u < space->extent.rank; u++) - /* If selection bounds & block don't overlap, can leave now */ - if(!H5S_RANGE_OVERLAP(low_bounds[u], high_bounds[u], start[u], end[u])) - HGOTO_DONE(FALSE) + H5S__hyper_rebuild((H5S_t *)space); /* Casting away const OK -QAK */ /* Check for regular hyperslab intersection */ if(space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { hbool_t single_block; /* Whether the regular selection is a single block */ + unsigned u; /* Local index variable */ /* Check for a single block */ /* For a regular hyperslab to be single, it must have only one block @@ -6381,7 +6367,7 @@ H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S_hyper_intersect_block() */ +} /* end H5S__hyper_intersect_block() */ /*-------------------------------------------------------------------------- diff --git a/src/H5Snone.c b/src/H5Snone.c index 9d64e9d..c262d18 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -28,11 +28,11 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -63,9 +63,12 @@ static htri_t H5S__none_is_contiguous(const H5S_t *space); static htri_t H5S__none_is_single(const H5S_t *space); static htri_t H5S__none_is_regular(const H5S_t *space); static htri_t H5S__none_shape_same(const H5S_t *space1, const H5S_t *space2); +static htri_t H5S__none_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); static herr_t H5S__none_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__none_project_scalar(const H5S_t *space, hsize_t *offset); -static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset); +static herr_t H5S__none_project_simple(const H5S_t *space, H5S_t *new_space, + hsize_t *offset); static herr_t H5S__none_iter_init(const H5S_t *space, H5S_sel_iter_t *iter); /* Selection iteration callbacks */ @@ -108,6 +111,7 @@ const H5S_select_class_t H5S_sel_none[1] = {{ H5S__none_is_single, H5S__none_is_regular, H5S__none_shape_same, + H5S__none_intersect_block, H5S__none_adjust_u, H5S__none_project_scalar, H5S__none_project_simple, @@ -886,6 +890,41 @@ H5S__none_shape_same(const H5S_t H5_ATTR_UNUSED *space1, /*-------------------------------------------------------------------------- NAME + H5S__none_intersect_block + PURPOSE + Detect intersections of selection with block + USAGE + htri_t H5S__none_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace with selection to use + const hsize_t *start; IN: Starting coordinate for block + const hsize_t *end; IN: Ending coordinate for block + RETURNS + Non-negative TRUE / FALSE on success, negative on failure + DESCRIPTION + Quickly detect intersections with a block + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S__none_intersect_block(const H5S_t H5_ATTR_UNUSED *space, + const hsize_t H5_ATTR_UNUSED *start, const hsize_t H5_ATTR_UNUSED *end) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(space); + HDassert(H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); + HDassert(start); + HDassert(end); + + FUNC_LEAVE_NOAPI(FALSE) +} /* end H5S__none_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__none_adjust_u PURPOSE Adjust an "none" selection by subtracting an offset diff --git a/src/H5Spkg.h b/src/H5Spkg.h index 4752c59..278f08d 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -91,6 +91,15 @@ * H5S_UNLIMITED) */ #define H5S_MAX_SIZE ((hsize_t)(hssize_t)(-2)) +/* Macro for checking if two ranges overlap one another */ +/* + * Check for the inverse of whether the ranges are disjoint. If they are + * disjoint, then the low bound of one of the ranges must be greater than the + * high bound of the other. + */ +/* (Assumes that low & high bounds are _inclusive_) */ +#define H5S_RANGE_OVERLAP(L1, H1, L2, H2) (!((L1) > (H2) || (L2) > (H1))) + /* * Dataspace extent information @@ -240,6 +249,8 @@ typedef htri_t (*H5S_sel_is_single_func_t)(const H5S_t *space); typedef htri_t (*H5S_sel_is_regular_func_t)(const H5S_t *space); /* Method to determine if two dataspaces' selections are the same shape */ typedef htri_t (*H5S_sel_shape_same_func_t)(const H5S_t *space1, const H5S_t *space2); +/* Method to determine if selection intersects a block */ +typedef htri_t (*H5S_sel_intersect_block_func_t)(const H5S_t *space, const hsize_t *start, const hsize_t *end); /* Method to adjust a selection by an offset */ typedef herr_t (*H5S_sel_adjust_u_func_t)(H5S_t *space, const hsize_t *offset); /* Method to construct single element projection onto scalar dataspace */ @@ -268,6 +279,7 @@ typedef struct { H5S_sel_is_single_func_t is_single; /* Method to determine if current selection is a single block */ H5S_sel_is_regular_func_t is_regular; /* Method to determine if current selection is "regular" */ H5S_sel_shape_same_func_t shape_same; /* Method to determine if two dataspaces' selections are the same shape */ + H5S_sel_intersect_block_func_t intersect_block; /* Method to determine if a dataspaces' selection intersects a block */ H5S_sel_adjust_u_func_t adjust_u; /* Method to adjust a selection by an offset */ H5S_sel_project_scalar project_scalar; /* Method to construct scalar dataspace projection */ H5S_sel_project_simple project_simple; /* Method to construct simple dataspace projection */ @@ -369,7 +381,6 @@ H5_DLL herr_t H5S__hyper_project_intersection(const H5S_t *src_space, /* Testing functions */ #ifdef H5S_TESTING -H5_DLL htri_t H5S__select_shape_same_test(hid_t sid1, hid_t sid2); H5_DLL herr_t H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1, H5S_diminfo_valid_t *status2); H5_DLL herr_t H5S__get_diminfo_status_test(hid_t space_id, diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 875c018..8e1175a 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -28,14 +28,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* ID Functions */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Spkg.h" /* Dataspace functions */ -#include "H5VMprivate.h" /* Vector functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* ID Functions */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Spkg.h" /* Dataspace functions */ +#include "H5VMprivate.h" /* Vector functions */ /****************/ @@ -75,6 +75,8 @@ static htri_t H5S__point_is_contiguous(const H5S_t *space); static htri_t H5S__point_is_single(const H5S_t *space); static htri_t H5S__point_is_regular(const H5S_t *space); static htri_t H5S__point_shape_same(const H5S_t *space1, const H5S_t *space2); +static htri_t H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); static herr_t H5S__point_adjust_u(H5S_t *space, const hsize_t *offset); static herr_t H5S__point_project_scalar(const H5S_t *space, hsize_t *offset); static herr_t H5S__point_project_simple(const H5S_t *space, H5S_t *new_space, @@ -124,6 +126,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{ H5S__point_is_single, H5S__point_is_regular, H5S__point_shape_same, + H5S__point_intersect_block, H5S__point_adjust_u, H5S__point_project_scalar, H5S__point_project_simple, @@ -1998,6 +2001,63 @@ done: /*-------------------------------------------------------------------------- NAME + H5S__point_intersect_block + PURPOSE + Detect intersections of selection with block + USAGE + htri_t H5S__point_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace with selection to use + const hsize_t *start; IN: Starting coordinate for block + const hsize_t *end; IN: Ending coordinate for block + RETURNS + Non-negative TRUE / FALSE on success, negative on failure + DESCRIPTION + Quickly detect intersections with a block + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5S__point_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end) +{ + H5S_pnt_node_t *pnt; /* Point information node */ + htri_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(space); + HDassert(H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); + HDassert(start); + HDassert(end); + + /* Loop over points */ + pnt = space->select.sel_info.pnt_lst->head; + while(pnt) { + unsigned u; /* Local index variable */ + + /* Verify that the point is within the block */ + for(u = 0; u < space->extent.rank; u++) + if(pnt->pnt[u] < start[u] || pnt->pnt[u] > end[u]) + break; + + /* Check if point was within block for all dimensions */ + if(u == space->extent.rank) + HGOTO_DONE(TRUE) + + /* Advance to next point */ + pnt = pnt->next; + } /* end while */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S__point_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME H5S__point_adjust_u PURPOSE Adjust a "point" selection by subtracting an offset diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 6646f84..0a9d2e7 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -30,15 +30,6 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ -/* Flags for H5S_find */ -#define H5S_CONV_PAR_IO_POSSIBLE 0x0001 -/* The storage options are mutually exclusive */ -/* (2-bits reserved for storage type currently) */ -#define H5S_CONV_STORAGE_COMPACT 0x0000 /* i.e. '0' */ -#define H5S_CONV_STORAGE_CONTIGUOUS 0x0002 /* i.e. '1' */ -#define H5S_CONV_STORAGE_CHUNKED 0x0004 /* i.e. '2' */ -#define H5S_CONV_STORAGE_MASK 0x0006 - /* Forward references of package typedefs */ typedef struct H5S_extent_t H5S_extent_t; typedef struct H5S_pnt_node_t H5S_pnt_node_t; @@ -192,6 +183,8 @@ typedef struct H5S_sel_iter_op_t { #endif /* H5S_MODULE */ /* Handle these callbacks in a special way, since they have prologs that need to be executed */ #define H5S_SELECT_COPY(DST,SRC,SHARE) (H5S_select_copy(DST,SRC,SHARE)) +#define H5S_SELECT_SHAPE_SAME(S1,S2) (H5S_select_shape_same(S1,S2)) +#define H5S_SELECT_INTERSECT_BLOCK(S,START,END) (H5S_select_intersect_block(S,START,END)) #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) #define H5S_SELECT_DESERIALIZE(S,BUF) (H5S_select_deserialize(S,BUF)) @@ -252,6 +245,8 @@ H5_DLL herr_t H5S_get_select_num_elem_non_unlim(const H5S_t *space, H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset); H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2); +H5_DLL htri_t H5S_select_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end); H5_DLL herr_t H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, unsigned new_space_rank, const void *buf, void const **adj_buf_ptr, hsize_t element_size); @@ -287,7 +282,6 @@ H5_DLL herr_t H5S_combine_hyperslab(H5S_t *old_space, H5S_seloper_t op, const hsize_t *block, H5S_t **new_space); H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords); -H5_DLL htri_t H5S_hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *end); H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset); H5_DLL htri_t H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset); H5_DLL herr_t H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 23e6846..9e76b4b 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -145,6 +145,9 @@ H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); H5_DLL htri_t H5Sselect_valid(hid_t spaceid); H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]); +H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id); +H5_DLL htri_t H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, + const hsize_t *end); H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset); H5_DLL herr_t H5Sselect_all(hid_t spaceid); H5_DLL herr_t H5Sselect_none(hid_t spaceid); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index c383fed..8b84e2c 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -250,11 +250,15 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) HDassert(dst); HDassert(src); + /* Release the current selection */ + if(H5S_SELECT_RELEASE(dst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection") + /* Copy regular fields */ dst->select = src->select; /* Perform correct type of copy based on the type of selection */ - if((ret_value = (*src->select.type->copy)(dst,src,share_selection)) < 0) + if((ret_value = (*src->select.type->copy)(dst, src, share_selection)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection specific information") done: @@ -281,7 +285,7 @@ done: herr_t H5S_select_release(H5S_t *ds) { - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1689,9 +1693,12 @@ H5S_get_select_type(const H5S_t *space) DESCRIPTION Checks to see if the current selection in the dataspaces are the same dimensionality and shape. + This is primarily used for reading the entire selection in one swoop. GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS + This routine participates in the "Inlining C function pointers" pattern, + don't call it directly, use the appropriate macro defined in H5Sprivate.h. EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ @@ -1945,6 +1952,163 @@ done: /*-------------------------------------------------------------------------- NAME + H5Sselect_shape_same + PURPOSE + Check if two selections are the same shape + USAGE + htri_t H5Sselect_shape_same(space1_id, space2_id) + hid_t space1_id; IN: ID of 1st Dataspace pointer to compare + hid_t space2_id; IN: ID of 2nd Dataspace pointer to compare + RETURNS + TRUE/FALSE/FAIL + DESCRIPTION + Checks to see if the current selection in the dataspaces are the same + dimensionality and shape. + This is primarily used for reading the entire selection in one swoop. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5Sselect_shape_same(hid_t space1_id, hid_t space2_id) +{ + H5S_t *space1, *space2; /* Dataspaces to compare */ + htri_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("t", "ii", space1_id, space2_id); + + if(NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + + if((ret_value = H5S_select_shape_same(space1, space2)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selections") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_shape_same() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_select_intersect_block + PURPOSE + Check if current selection intersects with a block + USAGE + htri_t H5S_select_intersect_block(space, start, end) + const H5S_t *space; IN: Dataspace to compare + const hsize_t *start; IN: Starting coordinate of block + const hsize_t *end; IN: Opposite ("ending") coordinate of block + RETURNS + TRUE / FALSE / FAIL + DESCRIPTION + Checks to see if the current selection in the dataspace intersects with + the block given. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Assumes that start & end block bounds are _inclusive_, so start == end + value OK. + + This routine participates in the "Inlining C function pointers" pattern, + don't call it directly, use the appropriate macro defined in H5Sprivate.h. +--------------------------------------------------------------------------*/ +htri_t +H5S_select_intersect_block(const H5S_t *space, const hsize_t *start, + const hsize_t *end) +{ + htri_t ret_value = TRUE; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check args */ + HDassert(space); + HDassert(start); + HDassert(end); + + /* If selections aren't "none", compare their bounds */ + if(H5S_SEL_NONE != H5S_GET_SELECT_TYPE(space)) { + hsize_t low[H5S_MAX_RANK]; /* Low bound of selection in dataspace */ + hsize_t high[H5S_MAX_RANK]; /* High bound of selection in dataspace */ + unsigned u; /* Local index variable */ + + /* Get low & high bounds for dataspace selection */ + if(H5S_SELECT_BOUNDS(space, low, high) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for dataspace") + + /* Loop over selection bounds and block, checking for overlap */ + for(u = 0; u < space->extent.rank; u++) + /* If selection bounds & block don't overlap, can leave now */ + if(!H5S_RANGE_OVERLAP(low[u], high[u], start[u], end[u])) + HGOTO_DONE(FALSE) + } /* end if */ + + /* Call selection type's intersect routine */ + if((ret_value = (*space->select.type->intersect_block)(space, start, end)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't intersect block with selection") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S_select_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME + H5Sselect_intersect_block + PURPOSE + Check if current selection intersects with a block + USAGE + htri_t H5Sselect_intersect_block(space_id, start, end) + hid_t space1_id; IN: ID of dataspace pointer to compare + const hsize_t *start; IN: Starting coordinate of block + const hsize_t *end; IN: Opposite ("ending") coordinate of block + RETURNS + TRUE / FALSE / FAIL + DESCRIPTION + Checks to see if the current selection in the dataspace intersects with + the block given. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Assumes that start & end block bounds are _inclusive_, so start == end + value OK. + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +htri_t +H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *end) +{ + H5S_t *space; /* Dataspace to query */ + unsigned u; /* Local index value */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + /* Check arguments */ + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == start) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block start array pointer is NULL") + if(NULL == end) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block end array pointer is NULL") + + /* Range check start & end values */ + for(u = 0; u < space->extent.rank; u++) + if(start[u] > end[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "block start[%u] (%llu) > end[%u] (%llu)", u, (unsigned long long)start[u], u, (unsigned long long)end[u]) + + /* Call internal routine to do comparison */ + if((ret_value = H5S_select_intersect_block(space, start, end)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selection and block") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_intersect_block() */ + + +/*-------------------------------------------------------------------------- + NAME H5S_select_construct_projection PURPOSE diff --git a/src/H5Stest.c b/src/H5Stest.c index 2c42713..b61b6bf 100644 --- a/src/H5Stest.c +++ b/src/H5Stest.c @@ -66,50 +66,6 @@ /*-------------------------------------------------------------------------- NAME - H5S__select_shape_same_test - PURPOSE - Determine if two dataspace selections are the same shape - USAGE - htri_t H5S__select_shape_same_test(sid1, sid2) - hid_t sid1; IN: 1st dataspace to compare - hid_t sid2; IN: 2nd dataspace to compare - RETURNS - Non-negative TRUE/FALSE on success, negative on failure - DESCRIPTION - Checks to see if the current selection in the dataspaces are the same - dimensionality and shape. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -htri_t -H5S__select_shape_same_test(hid_t sid1, hid_t sid2) -{ - H5S_t *space1; /* Pointer to 1st dataspace */ - H5S_t *space2; /* Pointer to 2nd dataspace */ - htri_t ret_value = FAIL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Get dataspace structures */ - if(NULL == (space1 = (H5S_t *)H5I_object_verify(sid1, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - if(NULL == (space2 = (H5S_t *)H5I_object_verify(sid2, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") - - /* Check if the dataspace selections are the same shape */ - if((ret_value = H5S_select_shape_same(space1, space2)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "unable to compare dataspace selections") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5S__select_shape_same_test() */ - - -/*-------------------------------------------------------------------------- - NAME H5S__get_rebuild_status_test PURPOSE Determine the status of the diminfo_valid field (whether we know the diff --git a/test/objcopy.c b/test/objcopy.c index 1f89e16..94a2b36 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -284,8 +284,6 @@ addr_reset(void) * Programmer: Peter Cao * Friday, August 4, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -345,8 +343,6 @@ error: * Programmer: Peter Cao * Monday, March 5, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -422,8 +418,6 @@ error: * Programmer: Peter Cao * Friday, August 4, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -517,8 +511,6 @@ error: * Programmer: Peter Cao * Saturday, December 17, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -579,8 +571,6 @@ done: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -856,10 +846,6 @@ error: * Note: This isn't very general, the attributes are assumed to be * those written in test_copy_attach_attributes(). * - * Modifier: Peter Cao - * Wednesday, March 21, 2007 - * Change to compare any attributes of two objects - * *------------------------------------------------------------------------- */ static int @@ -1167,7 +1153,7 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if((obj2_sid = H5Rget_region(parent2, H5R_DATASET_REGION, ref_buf2)) < 0) TEST_ERROR /* Check if dataspaces are the same shape */ - if(H5S__select_shape_same_test(obj1_sid, obj2_sid) < 0) TEST_ERROR + if(H5Sselect_shape_same(obj1_sid, obj2_sid) < 0) TEST_ERROR /* Close dataspaces */ if(H5Sclose(obj1_sid) < 0) TEST_ERROR @@ -1213,8 +1199,8 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) hssize_t nelmts; /* # of elements in dataspace */ void *rbuf = NULL; /* Buffer for reading raw data */ void *rbuf2 = NULL; /* Buffer for reading raw data */ - H5D_space_status_t space_status; /* Dataset's raw data space status */ - H5D_space_status_t space_status2; /* Dataset's raw data space status */ + H5D_space_status_t space_status; /* Dataset's raw dataspace status */ + H5D_space_status_t space_status2; /* Dataset's raw dataspace status */ /* Check the datatypes are equal */ @@ -1569,8 +1555,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1858,8 +1842,6 @@ error: * Programmer: Neil * Friday, March 11, 2011 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1999,8 +1981,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2294,8 +2274,6 @@ error: * Programmer: Neil Fortner * Thursday, January 15, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2519,8 +2497,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -2651,8 +2627,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4396,8 +4370,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -6281,8 +6253,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -6376,8 +6346,6 @@ error: * Programmer: Peter Cao * August 8, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -6509,8 +6477,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -7024,12 +6990,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * Neil Fortner - * Tuesday, February 16, 2010 - * Modified test to test flags for expanding soft and external - * links. - * *------------------------------------------------------------------------- */ static int @@ -8017,7 +7977,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* make a copy of the datatype for later use */ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR - /* named data type */ + /* named datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create and set compact plist */ @@ -8171,7 +8131,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* make a copy of the datatype for later use */ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR - /* named data type */ + /* named datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -8326,7 +8286,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* make a copy of the datatype for later use */ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR - /* named data type */ + /* named datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create and set chunk plist */ @@ -8487,7 +8447,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* make a copy of the datatype for later use */ if((tid_copy = H5Tcopy(tid)) < 0)TEST_ERROR - /* named data type */ + /* named datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_VL, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create and set chunk plist */ @@ -10289,7 +10249,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid_src1, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -10313,7 +10273,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid_src2, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -10524,7 +10484,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset */ @@ -10551,7 +10511,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset */ @@ -10796,7 +10756,7 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -10823,7 +10783,7 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "a" */ + /* committed datatype "a" */ if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -10832,7 +10792,7 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "b" */ + /* committed datatype "b" */ if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -11027,7 +10987,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -11057,7 +11017,7 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* create anonymous committed data type */ + /* create anonymous committed datatype */ if((H5Tcommit_anon(fid_dst, tid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create attribute at SRC file */ @@ -12817,7 +12777,7 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* named data type */ + /* named datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -12847,7 +12807,7 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "a" */ + /* committed datatype "a" */ if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -12856,7 +12816,7 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "b" */ + /* committed datatype "b" */ if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -13176,7 +13136,7 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type */ + /* committed datatype */ if((H5Tcommit2(fid_src, NAME_DATATYPE_SIMPLE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* create dataset at SRC file */ @@ -13206,7 +13166,7 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "a" */ + /* committed datatype "a" */ if((H5Tcommit2(fid_dst, "/a", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -13215,7 +13175,7 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* create datatype */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)TEST_ERROR - /* committed data type "b" */ + /* committed datatype "b" */ if((H5Tcommit2(fid_dst, "/b", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* close the datatype */ @@ -13499,8 +13459,6 @@ error: * Programmer: Peter Cao * March 11, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -13817,8 +13775,6 @@ error: * Programmer: Vailin Choi * Feb 7, 2012 * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -14138,8 +14094,6 @@ error: * Programmer: Peter Cao * Friday, September 30, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ int diff --git a/test/th5s.c b/test/th5s.c index a48979b..f0365de 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -187,7 +187,7 @@ test_h5s_basic(void) CHECK(ret, FAIL, "H5Sclose"); /* - * Check to be sure we can't create a simple data space that has too many + * Check to be sure we can't create a simple dataspace that has too many * dimensions. */ H5E_BEGIN_TRY { @@ -318,7 +318,7 @@ test_h5s_basic(void) /**************************************************************** ** -** test_h5s_null(): Test NULL data space +** test_h5s_null(): Test NULL dataspace ** ****************************************************************/ static void @@ -460,7 +460,7 @@ test_h5s_null(void) CHECK(ret, FAIL, "H5Fclose"); /*============================================ - * Reopen the file to check the data space + * Reopen the file to check the dataspace *============================================ */ fid = H5Fopen(NULLFILE, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -1078,7 +1078,7 @@ test_h5s_zero_dim(void) CHECK(ret, FAIL, "H5Fclose"); /*============================================ - * Reopen the file to check the data space + * Reopen the file to check the dataspace *============================================ */ fid1 = H5Fopen(ZEROFILE, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -1227,7 +1227,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* Encode simple data space in a buffer with the fapl setting */ + /* Encode simple dataspace in a buffer with the fapl setting */ ret = H5Sencode2(sid1, NULL, &sbuf_size, fapl); CHECK(ret, FAIL, "H5Sencode2"); @@ -1242,7 +1242,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) } H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Sdecode"); - /* Encode the simple data space in a buffer with the fapl setting */ + /* Encode the simple dataspace in a buffer with the fapl setting */ ret = H5Sencode2(sid1, sbuf, &sbuf_size, fapl); CHECK(ret, FAIL, "H5Sencode"); @@ -1289,7 +1289,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) sid2 = H5Screate(H5S_NULL); CHECK(sid2, FAIL, "H5Screate"); - /* Encode null data space in a buffer */ + /* Encode null dataspace in a buffer */ ret = H5Sencode2(sid2, NULL, &null_size, fapl); CHECK(ret, FAIL, "H5Sencode"); @@ -1298,7 +1298,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) CHECK(null_sbuf, NULL, "HDcalloc"); } - /* Encode the null data space in the buffer */ + /* Encode the null dataspace in the buffer */ ret = H5Sencode2(sid2, null_sbuf, &null_size, fapl); CHECK(ret, FAIL, "H5Sencode2"); @@ -1325,7 +1325,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) sid3 = H5Screate(H5S_SCALAR); CHECK(sid3, FAIL, "H5Screate_simple"); - /* Encode scalar data space in a buffer */ + /* Encode scalar dataspace in a buffer */ ret = H5Sencode2(sid3, NULL, &scalar_size, fapl); CHECK(ret, FAIL, "H5Sencode"); @@ -1334,7 +1334,7 @@ test_h5s_encode(H5F_libver_t low, H5F_libver_t high) CHECK(scalar_buf, NULL, "HDcalloc"); } - /* Encode the scalar data space in the buffer */ + /* Encode the scalar dataspace in the buffer */ ret = H5Sencode2(sid3, scalar_buf, &scalar_size, fapl); CHECK(ret, FAIL, "H5Sencode2"); @@ -1419,7 +1419,7 @@ test_h5s_encode1(void) ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* Encode simple data space in a buffer with the fapl setting */ + /* Encode simple dataspace in a buffer with the fapl setting */ ret = H5Sencode1(sid1, NULL, &sbuf_size); CHECK(ret, FAIL, "H5Sencode2"); @@ -1434,7 +1434,7 @@ test_h5s_encode1(void) } H5E_END_TRY; VERIFY(ret_id, FAIL, "H5Sdecode"); - /* Encode the simple data space in a buffer */ + /* Encode the simple dataspace in a buffer */ ret = H5Sencode1(sid1, sbuf, &sbuf_size); CHECK(ret, FAIL, "H5Sencode"); @@ -1481,7 +1481,7 @@ test_h5s_encode1(void) sid2 = H5Screate(H5S_NULL); CHECK(sid2, FAIL, "H5Screate"); - /* Encode null data space in a buffer */ + /* Encode null dataspace in a buffer */ ret = H5Sencode1(sid2, NULL, &null_size); CHECK(ret, FAIL, "H5Sencode"); @@ -1490,7 +1490,7 @@ test_h5s_encode1(void) CHECK(null_sbuf, NULL, "HDcalloc"); } - /* Encode the null data space in the buffer */ + /* Encode the null dataspace in the buffer */ ret = H5Sencode1(sid2, null_sbuf, &null_size); CHECK(ret, FAIL, "H5Sencode2"); @@ -1515,9 +1515,9 @@ test_h5s_encode1(void) */ /* Create scalar dataspace */ sid3 = H5Screate(H5S_SCALAR); - CHECK(sid3, FAIL, "H5Screate_simple"); + CHECK(sid3, FAIL, "H5Screate"); - /* Encode scalar data space in a buffer */ + /* Encode scalar dataspace in a buffer */ ret = H5Sencode1(sid3, NULL, &scalar_size); CHECK(ret, FAIL, "H5Sencode"); @@ -1526,7 +1526,7 @@ test_h5s_encode1(void) CHECK(scalar_buf, NULL, "HDcalloc"); } - /* Encode the scalar data space in the buffer */ + /* Encode the scalar dataspace in the buffer */ ret = H5Sencode1(sid3, scalar_buf, &scalar_size); CHECK(ret, FAIL, "H5Sencode2"); @@ -1622,8 +1622,8 @@ test_h5s_check_encoding(hid_t in_fapl, hid_t in_sid, VERIFY(H5Sget_select_npoints(in_sid), H5Sget_select_npoints(d_sid), "Compare npoints"); /* Verify if the two dataspace selections (in_sid, d_sid) are the same shape */ - check = H5S__select_shape_same_test(in_sid, d_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(in_sid, d_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare the starting/ending coordinates of the bounding box for in_sid and d_sid */ ret = H5Sget_select_bounds(in_sid, in_low_bounds, in_high_bounds); @@ -2127,7 +2127,7 @@ test_h5s_encode_length(void) ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, &start, &stride, &count, &block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* Encode simple data space in a buffer */ + /* Encode simple dataspace in a buffer */ ret = H5Sencode2(sid, NULL, &sbuf_size, H5P_DEFAULT); CHECK(ret, FAIL, "H5Sencode"); @@ -2493,7 +2493,7 @@ test_h5s_chunk(void) status = H5Pset_chunk(plist_id, 2, csize); CHECK(status, FAIL, "H5Pset_chunk"); - /* Create the data space */ + /* Create the dataspace */ dims[0] = 50000; dims[1] = 3; space_id = H5Screate_simple(2, dims, NULL); diff --git a/test/tselect.c b/test/tselect.c index bbab868..4a47929 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -869,7 +869,7 @@ test_select_all_hyper(hid_t xfer_plist) /* Select no extent for disk dataset */ ret = H5Sselect_none(sid1); - CHECK(ret, FAIL, "H5Sselect_all"); + CHECK(ret, FAIL, "H5Sselect_none"); /* Read selection from disk (should fail with no selection defined) */ ret=H5Dread(dataset,H5T_NATIVE_UCHAR,sid2,sid1,xfer_plist,rbuf); @@ -890,7 +890,7 @@ test_select_all_hyper(hid_t xfer_plist) /* A quick check to make certain that iterating through a "none" selection works */ ret = H5Sselect_none(sid2); - CHECK(ret, FAIL, "H5Sselect_all"); + CHECK(ret, FAIL, "H5Sselect_none"); ret = H5Diterate(rbuf,H5T_NATIVE_UCHAR,sid2,test_select_none_iter1,&tbuf); CHECK(ret, FAIL, "H5Diterate"); @@ -1662,7 +1662,7 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, ** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace) ** selection code with contiguous source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5Sselect_shape_same in isolation, so now we try to do ** I/O. ** ****************************************************************/ @@ -1846,11 +1846,11 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* first, verify that we can read from disk correctly using selections - * of different rank that H5S_select_shape_same() views as being of the + * of different rank that H5Sselect_shape_same() views as being of the * same shape. * * Start by reading small_rank-D slice from the on disk large cube, and - * verifying that the data read is correct. Verify that H5S_select_shape_same() + * verifying that the data read is correct. Verify that H5Sselect_shape_same() * returns true on the memory and file selections. */ @@ -1894,12 +1894,11 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(small_cube_sid, - file_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(small_cube_sid, file_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Read selection from disk */ ret = H5Dread(large_cube_dataset, @@ -1971,12 +1970,11 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(small_cube_sid, - mem_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(small_cube_sid, mem_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Read selection from disk */ @@ -2038,12 +2036,12 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank D slices from the in memory large cube, to * the the on disk small cube dataset. After each write, read the small * cube dataset back from disk, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on the + * data. Verify that H5Sselect_shape_same() returns true on the * memory and file selections. */ @@ -2087,13 +2085,12 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory slice through the cube selection and the * on disk full small cube selections as having the same shape. */ - check = H5S__select_shape_same_test(small_cube_sid, - mem_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(small_cube_sid, mem_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* write the slice from the in memory large cube to the on disk small cube */ @@ -2145,7 +2142,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, /* Now write the contents of the in memory small cube to slices of * the on disk cube. After each write, read the on disk cube * into memeory, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on + * data. Verify that H5Sselect_shape_same() returns true on * the memory and file selections. */ @@ -2197,14 +2194,13 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, CHECK(ret, FAIL, "H5Sselect_hyperslab"); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory full selection of the small cube and the * on disk slice through the large cube selection * as having the same shape. */ - check = H5S__select_shape_same_test(small_cube_sid, - file_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(small_cube_sid, file_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* write the cube from memory to the target slice of the disk cube */ @@ -2309,7 +2305,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, ** test_select_hyper_contig_dr(): Test H5S (dataspace) ** selection code with contiguous source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5Sselect_shape_same in isolation, so now we try to do ** I/O. ** ****************************************************************/ @@ -2375,7 +2371,7 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) /**************************************************************** ** ** test_select_hyper_checker_board_dr__select_checker_board(): -** Given an n-cube data space with each edge of length +** Given an n-cube dataspace with each edge of length ** edge_size, and a checker_edge_size either select a checker ** board selection of the entire cube(if sel_rank == n), ** or select a checker board selection of a @@ -2567,8 +2563,8 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, /* Wierdness alert: * * Some how, it seems that selections can extend beyond the - * boundaries of the target data space -- hence the following - * code to manually clip the selection back to the data space + * boundaries of the target dataspace -- hence the following + * code to manually clip the selection back to the dataspace * proper. */ for(u = 0; u < SS_DR_MAX_RANK; u++) { @@ -2732,7 +2728,7 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, ** test_select_hyper_checker_board_dr__run_test(): Test H5S ** (dataspace) selection code with checker board source and ** target selections having different ranks but the same -** shape. We have already tested H5S_shape_same in +** shape. We have already tested H5Sselect_shape_same in ** isolation, so now we try to do I/O. ** ****************************************************************/ @@ -2938,11 +2934,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* first, verify that we can read from disk correctly using selections - * of different rank that H5S_select_shape_same() views as being of the + * of different rank that H5Sselect_shape_same() views as being of the * same shape. * * Start by reading small_rank-D slice from the on disk large cube, and - * verifying that the data read is correct. Verify that H5S_select_shape_same() + * verifying that the data read is correct. Verify that H5Sselect_shape_same() * returns true on the memory and file selections. * * The first step is to set up the needed checker board selection in the @@ -3004,12 +3000,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(mem_small_cube_sid, - file_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mem_small_cube_sid, file_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* zero the buffer that we will be using for reading */ HDmemset(small_cube_buf_1, 0, sizeof(*small_cube_buf_1) * small_cube_size); @@ -3111,12 +3106,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(file_small_cube_sid, - mem_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(file_small_cube_sid, mem_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* zero out the in memory large cube */ @@ -3195,12 +3189,12 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank D slices from the in memory large cube, to * the the on disk small cube dataset. After each write, read the small * cube dataset back from disk, and verify that it contains the expected - * data. Verify that H5S_select_shape_same() returns true on the + * data. Verify that H5Sselect_shape_same() returns true on the * memory and file selections. */ @@ -3264,12 +3258,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(file_small_cube_sid, - mem_large_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(file_small_cube_sid, mem_large_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* write the slice from the in memory large cube to the @@ -3332,7 +3325,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ * small cube to slices of the on disk cube. After each write, * read the on disk large cube * into memeory, and verify that * it contains the expected * data. Verify that - * H5S_select_shape_same() returns true on the memory and file + * H5Sselect_shape_same() returns true on the memory and file * selections. */ @@ -3396,12 +3389,11 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ sel_start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(file_large_cube_sid, - mem_small_cube_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(file_large_cube_sid, mem_small_cube_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* write the checker board selection of the in memory @@ -3537,7 +3529,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ ** test_select_hyper_checker_board_dr(): Test H5S (dataspace) ** selection code with checkerboard source and target having ** different ranks but the same shape. We have already -** tested H5S_shape_same in isolation, so now we try to do +** tested H5Sselect_shape_same in isolation, so now we try to do ** I/O. ** ** This is just an initial smoke check, so we will work @@ -6133,7 +6125,7 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) CHECK(file, FAIL, "H5Fcreate"); /* - * Describe the size of the array and create the data space for fixed + * Describe the size of the array and create the dataspace for fixed * size dataset. */ dimsf[0] = X; @@ -7874,7 +7866,7 @@ test_scalar_select2(void) /* Select all elements in memory & file with "all" selection */ ret = H5Sselect_all(sid); - CHECK(ret, FAIL, "H5Sselect_none"); + CHECK(ret, FAIL, "H5Sselect_all"); /* Close disk dataspace */ ret = H5Sclose(sid); @@ -8202,294 +8194,294 @@ test_shape_same(void) /* Compare "all" selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(all_sid,all_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid ,all_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(all_sid); + tmp_sid = H5Scopy(all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "none" selection */ - check = H5S__select_shape_same_test(all_sid,none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against single point selection */ - check = H5S__select_shape_same_test(all_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, single_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against multiple point selection */ - check = H5S__select_shape_same_test(all_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "plain" single hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "all" single hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,single_hyper_all_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, single_hyper_all_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(all_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "all" hyperslab selection */ - check = H5S__select_shape_same_test(all_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "none" hyperslab selection */ - check = H5S__select_shape_same_test(all_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(all_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare "none" selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(none_sid,none_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, none_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(none_sid); + tmp_sid = H5Scopy(none_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(none_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S__select_shape_same_test(none_sid,all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against single point selection */ - check = H5S__select_shape_same_test(none_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, single_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against multiple point selection */ - check = H5S__select_shape_same_test(none_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "plain" single hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "all" single hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(none_sid,none_hyper_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, none_hyper_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against scalar "all" hyperslab selection */ - check = H5S__select_shape_same_test(none_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "none" hyperslab selection */ - check = H5S__select_shape_same_test(none_sid, scalar_none_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(none_sid, scalar_none_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare single point selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(single_pt_sid,single_pt_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, single_pt_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_pt_sid); + tmp_sid = H5Scopy(single_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(single_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S__select_shape_same_test(single_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "none" selection */ - check = H5S__select_shape_same_test(single_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against multiple point selection */ - check = H5S__select_shape_same_test(single_pt_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "plain" single hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "all" single hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, single_hyper_pt_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "all" hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid, scalar_all_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, scalar_all_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against scalar "none" hyperslab selection */ - check = H5S__select_shape_same_test(single_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare multiple point selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(mult_pt_sid,mult_pt_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, mult_pt_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(mult_pt_sid); + tmp_sid = H5Scopy(mult_pt_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(mult_pt_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S__select_shape_same_test(mult_pt_sid,all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "none" selection */ - check = H5S__select_shape_same_test(mult_pt_sid,none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against single point selection */ - check = H5S__select_shape_same_test(mult_pt_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, single_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "plain" single hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "all" single hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "all" hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "none" hyperslab selection */ - check = H5S__select_shape_same_test(mult_pt_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(mult_pt_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare single "normal" hyperslab selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, single_hyper_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_sid); + tmp_sid = H5Scopy(single_hyper_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S__select_shape_same_test(single_hyper_sid,all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "none" selection */ - check = H5S__select_shape_same_test(single_hyper_sid,none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against single point selection */ - check = H5S__select_shape_same_test(single_hyper_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, single_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against multiple point selection */ - check = H5S__select_shape_same_test(single_hyper_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "all" single hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, single_hyper_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the - * H5S_select_shape_same() routine is just not this sophisticated yet and it + * H5Sselect_shape_same() routine is just not this sophisticated yet and it * would take too much effort to make this work. The worst case is that the * non-optimized chunk mapping routines will be invoked instead of the more * optimized routines, so this only hurts performance, not correctness @@ -8500,17 +8492,19 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ - for(u=1; u<(SPACE9_DIM1-1); u++) { - for(v=1; v<(SPACE9_DIM2-1); v++) { - coord2[v-1][0]=u; coord2[v-1][1]=v; + for(u = 1; u < (SPACE9_DIM1 - 1); u++) { + for(v = 1; v < (SPACE9_DIM2 - 1); v++) { + coord2[v - 1][0] = u; + coord2[v - 1][1] = v; } /* end for */ - ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),coord2); + + ret = H5Sselect_elements(tmp_sid, H5S_SELECT_APPEND, (SPACE9_DIM2 - 2), coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ /* Compare against hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); @@ -8526,80 +8520,80 @@ test_shape_same(void) CHECK(ret, FAIL, "H5Sselect_none"); /* Select sequence of rows for hyperslab selection */ - for(u=1; u<(SPACE9_DIM1-1); u++) { - start[0]=u; start[1]=1; - stride[0]=1; stride[1]=1; - count[0]=1; count[1]=1; - block[0]=1; block[1]=(SPACE9_DIM2-2); - ret = H5Sselect_hyperslab(tmp_sid,H5S_SELECT_OR,start,stride,count,block); + for(u = 1; u < (SPACE9_DIM1 - 1); u++) { + start[0] = u; start[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = 1; block[1] = (SPACE9_DIM2 - 2); + ret = H5Sselect_hyperslab(tmp_sid, H5S_SELECT_OR, start, stride, count, block); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ /* Compare against hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against scalar "all" hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid, scalar_all_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, scalar_all_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against scalar "none" hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_sid, scalar_none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_sid, scalar_none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare single "all" hyperslab selection to all the selections created */ /* Compare against itself */ - check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_all_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_all_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against copy of itself */ - tmp_sid=H5Scopy(single_hyper_all_sid); + tmp_sid = H5Scopy(single_hyper_all_sid); CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__select_shape_same_test(single_hyper_all_sid,tmp_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, tmp_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); ret = H5Sclose(tmp_sid); CHECK(ret, FAIL, "H5Sclose"); /* Compare against "all" selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,all_sid); - VERIFY(check, TRUE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, all_sid); + VERIFY(check, TRUE, "H5Sselect_shape_same"); /* Compare against "none" selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,none_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, none_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against single point selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,single_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, single_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against multiple point selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,mult_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, mult_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "plain" single hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "single point" single hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,single_hyper_pt_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, single_hyper_pt_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against regular, strided hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,regular_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, regular_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against irregular hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,irreg_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, irreg_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); /* Compare against "no" hyperslab selection */ - check = H5S__select_shape_same_test(single_hyper_all_sid,none_hyper_sid); - VERIFY(check, FALSE, "H5S__select_shape_same_test"); + check = H5Sselect_shape_same(single_hyper_all_sid, none_hyper_sid); + VERIFY(check, FALSE, "H5Sselect_shape_same"); #ifdef NOT_YET /* In theory, these two selections are the same shape, but the @@ -8614,17 +8608,18 @@ test_shape_same(void) CHECK(tmp_sid, FAIL, "H5Screate_simple"); /* Select sequence of points for point selection */ - for(u=0; u n) in a call to H5S_select_shape_same(). +** of a full n-cube dataspace vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5Sselect_shape_same(). ** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if +** H5Sselect_shape_same() should always return FALSE if ** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional @@ -10634,15 +10628,15 @@ test_shape_same_dr__full_space_vs_slice(int test_num, block_ptr = &(block[i]); - /* select the hyper slab */ + /* select the hyperslab */ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* setup is done -- run the test: */ - check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); - VERIFY(check, expected_result, "test_shape_same_dr__full_space_vs_slice"); + check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid); + VERIFY(check, expected_result, "H5Sselect_shape_same"); /* Close dataspaces */ @@ -10651,7 +10645,6 @@ test_shape_same_dr__full_space_vs_slice(int test_num, ret = H5Sclose(n_cube_1_sid); CHECK(ret, FAIL, "H5Sclose"); - } /* test_shape_same_dr__full_space_vs_slice() */ @@ -10659,10 +10652,10 @@ test_shape_same_dr__full_space_vs_slice(int test_num, ** ** test_shape_same_dr__run_full_space_vs_slice_tests(): ** -** Run the est_shape_same_dr__full_space_vs_slice() test +** Run the test_shape_same_dr__full_space_vs_slice() test ** over a variety of ranks and offsets. ** -** At present, we test H5S_select_shape_same() with +** At present, we test H5Sselect_shape_same() with ** fully selected 1, 2, 3, and 4 cubes as one parameter, and ** 1, 2, 3, and 4 dimensional slices through a n-cube of rank ** no more than 5 (and at least the rank of the slice). @@ -10670,7 +10663,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, ** sufficient. ** ** All the n-cubes will have lengths of the same size, so -** H5S_select_shape_same() should return true iff: +** H5Sselect_shape_same() should return true iff: ** ** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the @@ -10800,20 +10793,19 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) } while((v < 2) && (large_rank >= 5)); } /* end for */ } /* end for */ - } /* test_shape_same_dr__run_full_space_vs_slice_tests() */ /**************************************************************** ** ** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube data space vs +** "checker board" subset of a full n-cube dataspace vs ** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5Sselect_shape_same(). ** ** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if +** H5Sselect_shape_same() should always return FALSE if ** they don't). ** ** Per Quincey's suggestion, only test up to 5 dimensional @@ -11016,8 +11008,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * * Some how, it seems that selections can extend beyond the - * boundaries of the target data space -- hence the following - * code to manually clip the selection back to the data space + * boundaries of the target dataspace -- hence the following + * code to manually clip the selection back to the dataspace * proper. */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -11078,7 +11070,7 @@ test_shape_same_dr__checkerboard(int test_num, count_ptr = &(count[i]); block_ptr = &(block[i]); - /* select the hyper slab */ + /* select the hyperslab */ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_SET, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); @@ -11117,8 +11109,8 @@ test_shape_same_dr__checkerboard(int test_num, /* Wierdness alert: * * Again, it seems that selections can extend beyond the - * boundaries of the target data space -- hence the following - * code to manually clip the selection back to the data space + * boundaries of the target dataspace -- hence the following + * code to manually clip the selection back to the dataspace * proper. */ for(i = 0; i < SS_DR_MAX_RANK; i++) { @@ -11133,8 +11125,8 @@ test_shape_same_dr__checkerboard(int test_num, CHECK(ret, FAIL, "H5Sselect_hyperslab"); /* setup is done -- run the test: */ - check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); - VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); + check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid); + VERIFY(check, expected_result, "H5Sselect_shape_same"); /* Close dataspaces */ @@ -11143,7 +11135,6 @@ test_shape_same_dr__checkerboard(int test_num, ret = H5Sclose(n_cube_1_sid); CHECK(ret, FAIL, "H5Sclose"); - } /* test_shape_same_dr__checkerboard() */ @@ -11151,14 +11142,14 @@ test_shape_same_dr__checkerboard(int test_num, ** ** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5S_select_shape_same() +** In this set of tests, we test H5Sselect_shape_same() ** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as ** one parameter, and 1, 2, 3, and 4 dimensional checkerboard ** slices through a n-cube of rank no more than 5 (and at ** least the rank of the slice). ** ** All the n-cubes will have lengths of the same size, so -** H5S_select_shape_same() should return true iff: +** H5Sselect_shape_same() should return true iff: ** ** 1) the rank of the n cube equals the number of dimensions ** selected in the checker board slice through the m-cube @@ -11414,7 +11405,6 @@ test_shape_same_dr__run_checkerboard_tests(void) } while((v < 2) && (large_rank >= 5)); } /* end for */ } /* end for */ - } /* test_shape_same_dr__run_checkerboard_tests() */ @@ -11423,13 +11413,13 @@ test_shape_same_dr__run_checkerboard_tests(void) ** test_shape_same_dr__irregular(): ** ** Tests selection of an "irregular" subset of a full -** n-cube data space vs an identical "irregular" subset +** n-cube dataspace vs an identical "irregular" subset ** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5S_select_shape_same(). +** in a call to H5Sselect_shape_same(). ** ** Note that this test does not require the n-cube and the ** n-dimensional slice to have the same rank (although -** H5S_select_shape_same() should always return FALSE if +** H5Sselect_shape_same() should always return FALSE if ** they don't). ** ****************************************************************/ @@ -11588,7 +11578,7 @@ test_shape_same_dr__irregular(int test_num, * Note that is this case, since the edge size is fixed, * the pattern does not change. However, we do use the * displacement parameter to allow it to be moved around - * within the n-cube or hyper slab. + * within the n-cube or hyperslab. */ /* first, ensure that the small n-cube has no selection */ @@ -11664,13 +11654,13 @@ test_shape_same_dr__irregular(int test_num, } /* end else */ } /* end for */ - /* select the hyper slab */ + /* select the hyperslab */ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_OR, start_ptr, stride_ptr, count_ptr, block_ptr); CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* end for */ - /* it is possible that the selection extends beyond the data space. + /* it is possible that the selection extends beyond the dataspace. * clip the selection to ensure that it doesn't. */ ret = H5Sselect_hyperslab(n_cube_1_sid, H5S_SELECT_AND, @@ -11679,8 +11669,8 @@ test_shape_same_dr__irregular(int test_num, /* setup is done -- run the test: */ - check = H5S__select_shape_same_test(n_cube_0_sid, n_cube_1_sid); - VERIFY(check, expected_result, "test_shape_same_dr__checkerboard"); + check = H5Sselect_shape_same(n_cube_0_sid, n_cube_1_sid); + VERIFY(check, expected_result, "H5Sselect_shape_same"); /* Close dataspaces */ @@ -11689,7 +11679,6 @@ test_shape_same_dr__irregular(int test_num, ret = H5Sclose(n_cube_1_sid); CHECK(ret, FAIL, "H5Sclose"); - } /* test_shape_same_dr__irregular() */ @@ -11697,7 +11686,7 @@ test_shape_same_dr__irregular(int test_num, ** ** test_shape_same_dr__run_irregular_tests(): ** -** In this set of tests, we test H5S_select_shape_same() +** In this set of tests, we test H5Sselect_shape_same() ** with an "irregular" subselection of 1, 2, 3, and 4 cubes as ** one parameter, and irregular subselections of 1, 2, 3, ** and 4 dimensional slices through a n-cube of rank no more @@ -11706,7 +11695,7 @@ test_shape_same_dr__irregular(int test_num, ** the n-cube and the slice. ** ** All the irregular selections will be identical (modulo rank) -** so H5S_select_shape_same() should return true iff: +** so H5Sselect_shape_same() should return true iff: ** ** 1) the rank of the n cube equals the number of dimensions ** selected in the irregular slice through the m-cube @@ -11904,7 +11893,6 @@ test_shape_same_dr__run_irregular_tests(void) } while((v < 2 ) && (large_rank >= 5)); } /* end for */ } /* end for */ - } /* test_shape_same_dr__run_irregular_tests() */ @@ -11921,19 +11909,16 @@ test_shape_same_dr(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Same Shape/Different Rank Comparisons\n")); - /* first run some smoke checks */ test_shape_same_dr__smoke_check_1(); test_shape_same_dr__smoke_check_2(); test_shape_same_dr__smoke_check_3(); test_shape_same_dr__smoke_check_4(); - /* now run more intensive tests. */ test_shape_same_dr__run_full_space_vs_slice_tests(); test_shape_same_dr__run_checkerboard_tests(); test_shape_same_dr__run_irregular_tests(); - } /* test_shape_same_dr() */ @@ -12042,8 +12027,8 @@ test_space_rebuild(void) } /* end if */ if(ret != FAIL) { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S__select_shape_same_test(sid_reg1,sid_reg_ori1); - CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); + rebuild_check = H5Sselect_shape_same(sid_reg1, sid_reg_ori1); + CHECK(rebuild_check, FALSE, "H5Sselect_shape_same"); } /* end if */ /* For irregular hyperslab */ @@ -12130,8 +12115,8 @@ test_space_rebuild(void) } /* end if */ if(ret != FAIL) { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S__select_shape_same_test(sid_reg2,sid_reg_ori2); - CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); + rebuild_check = H5Sselect_shape_same(sid_reg2, sid_reg_ori2); + CHECK(rebuild_check, FALSE, "H5Sselect_shape_same"); } /* end if */ /* 2-D irregular case */ @@ -12228,8 +12213,8 @@ test_space_rebuild(void) } /* end if */ if(ret != FAIL) { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S__select_shape_same_test(sid_reg3,sid_reg_ori3); - CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); + rebuild_check = H5Sselect_shape_same(sid_reg3, sid_reg_ori3); + CHECK(rebuild_check, FALSE, "H5Sselect_shape_same"); } /* end if */ sid_irreg3 = H5Screate_simple(SPACERE3_RANK,dims3,NULL); @@ -12339,8 +12324,8 @@ test_space_rebuild(void) } /* end if */ if(ret != FAIL) { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S__select_shape_same_test(sid_reg4,sid_reg_ori4); - CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); + rebuild_check = H5Sselect_shape_same(sid_reg4, sid_reg_ori4); + CHECK(rebuild_check, FALSE, "H5Sselect_shape_same"); } /* end if */ /* Testing irregular selection */ @@ -12465,8 +12450,8 @@ test_space_rebuild(void) } /* end if */ if(ret != FAIL) { /* In this case, rebuild_check should be TRUE. */ - rebuild_check = H5S__select_shape_same_test(sid_reg5,sid_reg_ori5); - CHECK(rebuild_check,FALSE,"H5S_hyper_rebuild"); + rebuild_check = H5Sselect_shape_same(sid_reg5, sid_reg_ori5); + CHECK(rebuild_check, FALSE, "H5Sselect_shape_same"); } /* end if */ sid_irreg5 = H5Screate_simple(SPACERE5_RANK,dims5,NULL); @@ -15189,6 +15174,148 @@ test_sel_iter(void) CHECK(ret, FAIL, "H5Sclose"); } /* test_sel_iter() */ +/**************************************************************** +** +** test_select_intersect_block(): Test selections on dataspace, +** verify that "intersect block" routine is working correctly. +** +****************************************************************/ +static void +test_select_intersect_block(void) +{ + hid_t sid; /* Dataspace ID */ + hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ + hsize_t block_start[] = {1, 3}; /* Start offset for block */ + hsize_t block_end[] = {2, 5}; /* End offset for block */ + hsize_t block_end2[] = {0, 5}; /* Bad end offset for block */ + hsize_t block_end3[] = {2, 2}; /* Another bad end offset for block */ + hsize_t block_end4[] = {1, 3}; /* End offset that makes a single element block */ + hsize_t coord[10][2]; /* Coordinates for point selection */ + hsize_t start[2]; /* Starting location of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Element count of hyperslab */ + hsize_t block[2]; /* Block size of hyperslab */ + htri_t status; /* Intersection status */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(6, ("Testing Dataspace Selection Block Intersection\n")); + + /* Create dataspace */ + sid = H5Screate_simple(2, dims1, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + + /* Try intersection calls with bad parameters */ + H5E_BEGIN_TRY { /* Bad dataspace ID */ + status = H5Sselect_intersect_block(H5I_INVALID_HID, block_start, block_end); + } H5E_END_TRY; + VERIFY(status, FAIL, "H5Sselect_intersect_block"); + H5E_BEGIN_TRY { /* Bad start pointer */ + status = H5Sselect_intersect_block(sid, NULL, block_end); + } H5E_END_TRY; + VERIFY(status, FAIL, "H5Sselect_intersect_block"); + H5E_BEGIN_TRY { /* Bad end pointer */ + status = H5Sselect_intersect_block(sid, block_start, NULL); + } H5E_END_TRY; + VERIFY(status, FAIL, "H5Sselect_intersect_block"); + H5E_BEGIN_TRY { /* Invalid block */ + status = H5Sselect_intersect_block(sid, block_start, block_end2); + } H5E_END_TRY; + VERIFY(status, FAIL, "H5Sselect_intersect_block"); + H5E_BEGIN_TRY { /* Another invalid block */ + status = H5Sselect_intersect_block(sid, block_start, block_end3); + } H5E_END_TRY; + VERIFY(status, FAIL, "H5Sselect_intersect_block"); + + + /* Set selection to 'none' */ + ret = H5Sselect_none(sid); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Test block intersection with 'none' selection (always false) */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, FALSE, "H5Sselect_intersect_block"); + + + /* Set selection to 'all' */ + ret = H5Sselect_all(sid); + CHECK(ret, FAIL, "H5Sselect_all"); + + /* Test block intersection with 'all' selection (always true) */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, TRUE, "H5Sselect_intersect_block"); + + + /* Select sequence of ten points */ + coord[0][0] = 0; coord[0][1] = 10; + coord[1][0] = 1; coord[1][1] = 2; + coord[2][0] = 2; coord[2][1] = 4; + coord[3][0] = 0; coord[3][1] = 6; + coord[4][0] = 1; coord[4][1] = 8; + coord[5][0] = 2; coord[5][1] = 11; + coord[6][0] = 0; coord[6][1] = 4; + coord[7][0] = 1; coord[7][1] = 0; + coord[8][0] = 2; coord[8][1] = 1; + coord[9][0] = 0; coord[9][1] = 3; + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)10, (const hsize_t *)coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Test block intersection with 'point' selection */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, TRUE, "H5Sselect_intersect_block"); + status = H5Sselect_intersect_block(sid, block_start, block_end4); + VERIFY(status, FALSE, "H5Sselect_intersect_block"); + + + /* Select single 4x6 hyperslab block at (2,1) */ + start[0] = 2; start[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 4; count[1] = 6; + block[0] = 1; block[1] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Test block intersection with single 'hyperslab' selection */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, TRUE, "H5Sselect_intersect_block"); + status = H5Sselect_intersect_block(sid, block_start, block_end4); + VERIFY(status, FALSE, "H5Sselect_intersect_block"); + + /* 'OR' another hyperslab block in, making an irregular hyperslab selection */ + start[0] = 3; start[1] = 2; + stride[0] = 1; stride[1] = 1; + count[0] = 4; count[1] = 6; + block[0] = 1; block[1] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_OR, start, stride, count, block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Test block intersection with 'hyperslab' selection */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, TRUE, "H5Sselect_intersect_block"); + status = H5Sselect_intersect_block(sid, block_start, block_end4); + VERIFY(status, FALSE, "H5Sselect_intersect_block"); + + /* Select regular, strided hyperslab selection */ + start[0] = 2; start[1] = 1; + stride[0] = 2; stride[1] = 2; + count[0] = 2; count[1] = 4; + block[0] = 1; block[1] = 1; + ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, stride, count, block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Test block intersection with single 'hyperslab' selection */ + status = H5Sselect_intersect_block(sid, block_start, block_end); + VERIFY(status, TRUE, "H5Sselect_intersect_block"); + status = H5Sselect_intersect_block(sid, block_start, block_end4); + VERIFY(status, FALSE, "H5Sselect_intersect_block"); + + + /* Close dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_select_intersect_block() */ + /**************************************************************** ** @@ -15369,6 +15496,9 @@ test_select(void) /* Test selection iterators */ test_sel_iter(); + + /* Test selection intersection with block */ + test_select_intersect_block(); } /* test_select() */ @@ -15382,8 +15512,6 @@ test_select(void) * Programmer: Albert Cheng * July 2, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ void diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index f5282bd..b65e219 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -110,10 +110,6 @@ struct hs_dr_pio_test_vars_t * * Programmer: JRM -- 8/9/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -573,7 +569,7 @@ hs_dr_pio_test__setup(const int test_num, tv_ptr->block); VRFY((ret >= 0), "H5Sselect_hyperslab(file_large_ds_sid_0, set) suceeded"); - /* In passing, setup the process slice data spaces as well */ + /* In passing, setup the process slice dataspaces as well */ ret = H5Sselect_hyperslab(tv_ptr->mem_large_ds_process_slice_sid, H5S_SELECT_SET, @@ -685,10 +681,6 @@ hs_dr_pio_test__setup(const int test_num, * * Programmer: JRM -- 9/18/09 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -791,22 +783,18 @@ hs_dr_pio_test__takedown( struct hs_dr_pio_test_vars_t * tv_ptr) * selections of different rank in the parallel. * * Verify that we can read from disk correctly using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * In this function, we test this by reading small_rank - 1 * slices from the on disk large cube, and verifying that the - * data read is correct. Verify that H5S_select_shape_same() + * data read is correct. Verify that H5Sselect_shape_same() * returns true on the memory and file selections. * * Return: void * * Programmer: JRM -- 9/10/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -831,7 +819,7 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) mpi_rank = tv_ptr->mpi_rank; - /* We have already done a H5Sselect_all() on the data space + /* We have already done a H5Sselect_all() on the dataspace * small_ds_slice_sid in the initialization phase, so no need to * call H5Sselect_all() again. */ @@ -945,12 +933,11 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) "H5Sselect_hyperslab(file_large_cube_sid) succeeded"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid, - tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* Read selection from disk */ @@ -1032,7 +1019,7 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * selections of different rank in the parallel. * * Verify that we can read from disk correctly using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * In this function, we test this by reading slices of the @@ -1044,10 +1031,6 @@ contig_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * * Programmer: JRM -- 8/10/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1213,12 +1196,11 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) "H5Sselect_hyperslab(mem_large_ds_sid) succeeded"); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, - tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* Read selection from disk */ @@ -1315,24 +1297,20 @@ contig_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * selections of different rank in the parallel. * * Verify that we can write from memory to file using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * Do this by writing small_rank - 1 dimensional slices from * the in memory large data set to the on disk small cube * dataset. After each write, read the slice of the small * dataset back from disk, and verify that it contains - * the expected data. Verify that H5S_select_shape_same() + * the expected data. Verify that H5Sselect_shape_same() * returns true on the memory and file selections. * * Return: void * * Programmer: JRM -- 8/10/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -1361,12 +1339,12 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank - 1 dimensional slices from the in memory large * data set to the on disk small cube dataset. After each write, read the * slice of the small dataset back from disk, and verify that it contains - * the expected data. Verify that H5S_select_shape_same() returns true on + * the expected data. Verify that H5Sselect_shape_same() returns true on * the memory and file selections. */ @@ -1527,13 +1505,12 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) "H5Sselect_hyperslab() mem_large_ds_sid succeeded."); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory slice through the cube selection and the * on disk full square selections as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, - tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed."); + check = H5Sselect_shape_same(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed."); /* write the slice from the in memory large data set to the @@ -1643,7 +1620,7 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * selections of different rank in the parallel. * * Verify that we can write from memory to file using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * Do this by writing the contents of the process's slice of @@ -1652,17 +1629,13 @@ contig_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * slice of the large data set back into memory, and verify * that it contains the expected data. * - * Verify that H5S_select_shape_same() returns true on the + * Verify that H5Sselect_shape_same() returns true on the * memory and file selections. * * Return: void * * Programmer: JRM -- 8/10/11 * - * Modifications: - * - * None - * *------------------------------------------------------------------------- */ @@ -1692,7 +1665,7 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * small data set to slices of the on disk large data set. After * each write, read the process's slice of the large data set back * into memory, and verify that it contains the expected data. - * Verify that H5S_select_shape_same() returns true on the memory + * Verify that H5Sselect_shape_same() returns true on the memory * and file selections. */ @@ -1859,14 +1832,13 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) "H5Sselect_hyperslab() target large ds slice succeeded"); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory small data set slice selection and the * on disk slice through the large data set selection * as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid, - tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_0); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* write the small data set slice from memory to the @@ -1986,21 +1958,6 @@ contig_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * * Programmer: JRM -- 9/18/09 * - * Modifications: - * - * JRM -- 9/16/10 - * Added express_test parameter. Use it to control whether - * we set up the chunks so that no chunk is shared between - * processes, and also whether we set an alignment when we - * create the test file. - * - * JRM -- 8/11/11 - * Refactored function heavily & broke it into six functions. - * Added the skips_ptr, max_skips, total_tests_ptr, - * tests_run_ptr, and tests_skiped_ptr parameters to support - * skipping portions of the test according to the express - * test value. - * *------------------------------------------------------------------------- */ @@ -2108,12 +2065,12 @@ contig_hs_dr_pio_test__run_test(const int test_num, #endif /* CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG */ /* first, verify that we can read from disk correctly using selections - * of different rank that H5S_select_shape_same() views as being of the + * of different rank that H5Sselect_shape_same() views as being of the * same shape. * * Start by reading small_rank - 1 dimensional slice from the on disk * large cube, and verifying that the data read is correct. Verify that - * H5S_select_shape_same() returns true on the memory and file selections. + * H5Sselect_shape_same() returns true on the memory and file selections. */ #if CONTIG_HS_DR_PIO_TEST__RUN_TEST__DEBUG @@ -2139,12 +2096,12 @@ contig_hs_dr_pio_test__run_test(const int test_num, /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank - 1 D slices from the in memory large data * set to the on disk small cube dataset. After each write, read the * slice of the small dataset back from disk, and verify that it contains - * the expected data. Verify that H5S_select_shape_same() returns true on + * the expected data. Verify that H5Sselect_shape_same() returns true on * the memory and file selections. */ @@ -2160,7 +2117,7 @@ contig_hs_dr_pio_test__run_test(const int test_num, * small data set to slices of the on disk large data set. After * each write, read the process's slice of the large data set back * into memory, and verify that it contains the expected data. - * Verify that H5S_select_shape_same() returns true on the memory + * Verify that H5Sselect_shape_same() returns true on the memory * and file selections. */ @@ -2208,20 +2165,6 @@ contig_hs_dr_pio_test__run_test(const int test_num, * * Programmer: JRM -- 9/18/09 * - * Modifications: - * - * Modified function to take a sample of the run times - * of the different tests, and skip some of them if - * run times are too long. - * - * We need to do this because Lustre runns very slowly - * if two or more processes are banging on the same - * block of memory. - * JRM -- 9/10/10 - * Break this one big test into 4 smaller tests according - * to {independent,collective}x{contigous,chunked} datasets. - * AKC -- 2010/01/14 - * *------------------------------------------------------------------------- */ @@ -2395,18 +2338,18 @@ contig_hs_dr_pio_test(ShapeSameTestMethods sstest_type) /**************************************************************** ** ** ckrbrd_hs_dr_pio_test__slct_ckrbrd(): -** Given a data space of tgt_rank, and dimensions: +** Given a dataspace of tgt_rank, and dimensions: ** ** (mpi_size + 1), edge_size, ... , edge_size ** ** edge_size, and a checker_edge_size, select a checker ** board selection of a sel_rank (sel_rank < tgt_rank) -** dimensional slice through the data space parallel to the +** dimensional slice through the dataspace parallel to the ** sel_rank fastest changing indicies, with origin (in the ** higher indicies) as indicated by the start array. ** ** Note that this function, like all its relatives, is -** hard coded to presume a maximum data space rank of 5. +** hard coded to presume a maximum dataspace rank of 5. ** While this maximum is declared as a constant, increasing ** it will require extensive coding in addition to changing ** the value of the constant. @@ -2707,7 +2650,7 @@ ckrbrd_hs_dr_pio_test__slct_ckrbrd(const int mpi_rank, fcnName, mpi_rank, (int)H5Sget_select_npoints(tgt_sid)); #endif /* CKRBRD_HS_DR_PIO_TEST__SELECT_CHECKER_BOARD__DEBUG */ - /* Clip the selection back to the data space proper. */ + /* Clip the selection back to the dataspace proper. */ for ( i = 0; i < test_max_rank; i++ ) { @@ -2956,22 +2899,18 @@ ckrbrd_hs_dr_pio_test__verify_data(uint32_t * buf_ptr, * * Verify that we can read from disk correctly using checker * board selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * - * In this function, we test this by reading small_rank - 1 + * In this function, we test this by reading small_rank - 1 * checker board slices from the on disk large cube, and * verifying that the data read is correct. Verify that - * H5S_select_shape_same() returns true on the memory and + * H5Sselect_shape_same() returns true on the memory and * file selections. * * Return: void * * Programmer: JRM -- 9/15/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -2997,12 +2936,12 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* first, verify that we can read from disk correctly using selections - * of different rank that H5S_select_shape_same() views as being of the + * of different rank that H5Sselect_shape_same() views as being of the * same shape. * * Start by reading a (small_rank - 1)-D checker board slice from this * processes slice of the on disk large data set, and verifying that the - * data read is correct. Verify that H5S_select_shape_same() returns + * data read is correct. Verify that H5Sselect_shape_same() returns * true on the memory and file selections. * * The first step is to set up the needed checker board selection in the @@ -3146,12 +3085,11 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) tv_ptr->start ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->small_ds_slice_sid, - tv_ptr->file_large_ds_sid_0); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->small_ds_slice_sid, tv_ptr->file_large_ds_sid_0); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* Read selection from disk */ @@ -3231,7 +3169,7 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * selections of different rank in the parallel. * * Verify that we can read from disk correctly using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * In this function, we test this by reading checker board @@ -3243,10 +3181,6 @@ ckrbrd_hs_dr_pio_test__d2m_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * * Programmer: JRM -- 8/15/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3412,12 +3346,11 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) ); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_0, - tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->file_small_ds_sid_0, tv_ptr->mem_large_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* Read selection from disk */ @@ -3561,24 +3494,20 @@ ckrbrd_hs_dr_pio_test__d2m_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * * Verify that we can write from memory to file using checker * board selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Do this by writing small_rank - 1 dimensional checker * board slices from the in memory large data set to the on * disk small cube dataset. After each write, read the * slice of the small dataset back from disk, and verify * that it contains the expected data. Verify that - * H5S_select_shape_same() returns true on the memory and + * H5Sselect_shape_same() returns true on the memory and * file selections. * * Return: void * * Programmer: JRM -- 8/15/11 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ @@ -3609,12 +3538,12 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank - 1 D slices from the in memory large data * set to the on disk small dataset. After each write, read the slice of * the small dataset back from disk, and verify that it contains the - * expected data. Verify that H5S_select_shape_same() returns true on + * expected data. Verify that H5Sselect_shape_same() returns true on * the memory and file selections. */ @@ -3795,14 +3724,13 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) ); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory checkerboard selection of the slice through the * large dataset and the checkerboard selection of the process * slice of the small data set as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->file_small_ds_sid_1, - tv_ptr->mem_large_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed."); + check = H5Sselect_shape_same(tv_ptr->file_small_ds_sid_1, tv_ptr->mem_large_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed."); /* write the checker board selection of the slice from the in @@ -3922,7 +3850,7 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * board hyperslab selections of different rank in the parallel. * * Verify that we can write from memory to file using - * selections of different rank that H5S_select_shape_same() + * selections of different rank that H5Sselect_shape_same() * views as being of the same shape. * * Do this by writing checker board selections of the contents @@ -3931,17 +3859,13 @@ ckrbrd_hs_dr_pio_test__m2d_l2s(struct hs_dr_pio_test_vars_t * tv_ptr) * read the process's slice of the large data set back into * memory, and verify that it contains the expected data. * - * Verify that H5S_select_shape_same() returns true on the + * Verify that H5Sselect_shape_same() returns true on the * memory and file selections. * * Return: void * * Programmer: JRM -- 8/15/11 * - * Modifications: - * - * None - * *------------------------------------------------------------------------- */ @@ -3974,7 +3898,7 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * small data set to slices of the on disk large data set. After * each write, read the process's slice of the large data set back * into memory, and verify that it contains the expected data. - * Verify that H5S_select_shape_same() returns true on the memory + * Verify that H5Sselect_shape_same() returns true on the memory * and file selections. */ @@ -4150,14 +4074,13 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) ); - /* verify that H5S_select_shape_same() reports the in + /* verify that H5Sselect_shape_same() reports the in * memory small data set slice selection and the * on disk slice through the large data set selection * as having the same shape. */ - check = H5S__select_shape_same_test(tv_ptr->mem_small_ds_sid, - tv_ptr->file_large_ds_sid_1); - VRFY((check == TRUE), "H5S__select_shape_same_test passed"); + check = H5Sselect_shape_same(tv_ptr->mem_small_ds_sid, tv_ptr->file_large_ds_sid_1); + VRFY((check == TRUE), "H5Sselect_shape_same passed"); /* write the small data set slice from memory to the @@ -4287,14 +4210,6 @@ ckrbrd_hs_dr_pio_test__m2d_s2l(struct hs_dr_pio_test_vars_t * tv_ptr) * * Programmer: JRM -- 10/10/09 * - * Modifications: - * - * JRM -- 9/16/10 - * Added the express_test parameter. Use it to control - * whether we set an alignment, and whether we allocate - * chunks such that no two processes will normally touch - * the same chunk. - * *------------------------------------------------------------------------- */ @@ -4409,12 +4324,12 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, /* first, verify that we can read from disk correctly using selections - * of different rank that H5S_select_shape_same() views as being of the + * of different rank that H5Sselect_shape_same() views as being of the * same shape. * * Start by reading a (small_rank - 1)-D slice from this processes slice * of the on disk large data set, and verifying that the data read is - * correct. Verify that H5S_select_shape_same() returns true on the + * correct. Verify that H5Sselect_shape_same() returns true on the * memory and file selections. * * The first step is to set up the needed checker board selection in the @@ -4434,12 +4349,12 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, /* now we go in the opposite direction, verifying that we can write * from memory to file using selections of different rank that - * H5S_select_shape_same() views as being of the same shape. + * H5Sselect_shape_same() views as being of the same shape. * * Start by writing small_rank - 1 D slices from the in memory large data * set to the on disk small dataset. After each write, read the slice of * the small dataset back from disk, and verify that it contains the - * expected data. Verify that H5S_select_shape_same() returns true on + * expected data. Verify that H5Sselect_shape_same() returns true on * the memory and file selections. */ @@ -4450,7 +4365,7 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, * small data set to slices of the on disk large data set. After * each write, read the process's slice of the large data set back * into memory, and verify that it contains the expected data. - * Verify that H5S_select_shape_same() returns true on the memory + * Verify that H5Sselect_shape_same() returns true on the memory * and file selections. */ @@ -4494,20 +4409,6 @@ ckrbrd_hs_dr_pio_test__run_test(const int test_num, * * Programmer: JRM -- 9/18/09 * - * Modifications: - * - * Modified function to take a sample of the run times - * of the different tests, and skip some of them if - * run times are too long. - * - * We need to do this because Lustre runns very slowly - * if two or more processes are banging on the same - * block of memory. - * JRM -- 9/10/10 - * Break this one big test into 4 smaller tests according - * to {independent,collective}x{contigous,chunked} datasets. - * AKC -- 2010/01/17 - * *------------------------------------------------------------------------- */ diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index cc79af2..352a089 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -60,8 +60,6 @@ static void coll_read_test(int chunk_factor); * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -87,8 +85,6 @@ coll_irregular_cont_write(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -113,8 +109,6 @@ coll_irregular_cont_read(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -140,8 +134,6 @@ coll_irregular_simple_chunk_write(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -165,8 +157,6 @@ coll_irregular_simple_chunk_read(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -192,8 +182,6 @@ coll_irregular_complex_chunk_write(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void @@ -219,8 +207,6 @@ coll_irregular_complex_chunk_read(void) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: Oct 18th, 2005 - * *------------------------------------------------------------------------- */ void coll_write_test(int chunk_factor) @@ -694,9 +680,6 @@ void coll_write_test(int chunk_factor) * Programmer: Unknown * Dec 2nd, 2004 * - * Modifications: Oct 18th, 2005 - * Note: This test must be used with the correpsonding - coll_write_test. *------------------------------------------------------------------------- */ static void @@ -948,18 +931,18 @@ coll_read_test(int chunk_factor) ** ** lower_dim_size_comp_test__select_checker_board(): ** -** Given a data space of tgt_rank, and dimensions: +** Given a dataspace of tgt_rank, and dimensions: ** ** (mpi_size + 1), edge_size, ... , edge_size ** ** edge_size, and a checker_edge_size, select a checker ** board selection of a sel_rank (sel_rank < tgt_rank) -** dimensional slice through the data space parallel to the +** dimensional slice through the dataspace parallel to the ** sel_rank fastest changing indicies, with origin (in the ** higher indicies) as indicated by the start array. ** ** Note that this function, is hard coded to presume a -** maximum data space rank of 5. +** maximum dataspace rank of 5. ** ** While this maximum is declared as a constant, increasing ** it will require extensive coding in addition to changing @@ -1304,7 +1287,7 @@ lower_dim_size_comp_test__select_checker_board( } #endif /* LOWER_DIM_SIZE_COMP_TEST__SELECT_CHECKER_BOARD__DEBUG */ - /* Clip the selection back to the data space proper. */ + /* Clip the selection back to the dataspace proper. */ for ( i = 0; i < test_max_rank; i++ ) { @@ -1564,15 +1547,13 @@ lower_dim_size_comp_test__verify_data(uint32_t * buf_ptr, * Function: lower_dim_size_comp_test__run_test() * * Purpose: Verify that a bug in the computation of the size of the - * lower dimensions of a data space in H5S_obtain_datatype() + * lower dimensions of a dataspace in H5S_obtain_datatype() * has been corrected. * * Return: void * * Programmer: JRM -- 11/11/09 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -1763,7 +1744,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, } #endif - /* create data spaces */ + /* create dataspaces */ full_mem_small_ds_sid = H5Screate_simple(5, small_dims, NULL); VRFY((full_mem_small_ds_sid != 0), @@ -2177,7 +2158,7 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, #endif /* LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG */ } - /* try clipping the selection back to the large data space proper */ + /* try clipping the selection back to the large dataspace proper */ start[0] = start[1] = start[2] = start[3] = start[4] = (hsize_t)0; stride[0] = (hsize_t)(2 * (mpi_size + 1)); @@ -2331,12 +2312,11 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, large_sel_start); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(mem_large_ds_sid, - file_small_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed (1)"); + check = H5Sselect_shape_same(mem_large_ds_sid, file_small_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed (1)"); ret = H5Dread(small_dataset, @@ -2452,12 +2432,11 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, large_sel_start); - /* verify that H5S_select_shape_same() reports the two + /* verify that H5Sselect_shape_same() reports the two * selections as having the same shape. */ - check = H5S__select_shape_same_test(mem_small_ds_sid, - file_large_ds_sid); - VRFY((check == TRUE), "H5S__select_shape_same_test passed (2)"); + check = H5Sselect_shape_same(mem_small_ds_sid, file_large_ds_sid); + VRFY((check == TRUE), "H5Sselect_shape_same passed (2)"); ret = H5Dread(large_dataset, @@ -2613,8 +2592,6 @@ lower_dim_size_comp_test__run_test(const int chunk_edge_size, * * Programmer: JRM -- 11/11/09 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2672,8 +2649,6 @@ lower_dim_size_comp_test(void) * * Programmer: JRM -- 12/16/09 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -2737,7 +2712,7 @@ link_chunk_collective_io_test(void) /* setup dims */ dims[0] = ((hsize_t)mpi_size) * ((hsize_t)(LINK_CHUNK_COLLECTIVE_IO_TEST_CHUNK_SIZE)); - /* setup mem and file data spaces */ + /* setup mem and file dataspaces */ write_mem_ds_sid = H5Screate_simple(1, chunk_dims, NULL); VRFY((write_mem_ds_sid != 0), "H5Screate_simple() write_mem_ds_sid succeeded"); -- cgit v0.12 From 41537eeb3c3012d2aefda6c115818b6921ac07ff Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 30 Jul 2019 16:08:22 -0500 Subject: Updated H5TRACE macro. --- src/H5Sselect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 8b84e2c..af93feb 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2084,6 +2084,7 @@ H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *e herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) + H5TRACE3("t", "i*h*h", space_id, start, end); /* Check arguments */ if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) -- cgit v0.12 From ab6679315c5027576c3a80d0ea3b67fd2fa58ff0 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 30 Jul 2019 16:37:57 -0500 Subject: Update COPYING file. Remove hdfs from list of vfds for check-vfd testing as it is read-only. --- COPYING | 32 ++++++++++++++++---------------- test/Makefile.am | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/COPYING b/COPYING index 560e8c4..659bf1c 100644 --- a/COPYING +++ b/COPYING @@ -3,10 +3,10 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright (c) 2006-2018, The HDF Group. +Copyright 2006 by The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright (c) 1998-2006, The Board of Trustees of the University of Illinois. +Copyright 1998-2006 by The Board of Trustees of the University of Illinois. All rights reserved. @@ -80,20 +80,20 @@ and/or accompanying materials: for the operation of UC LLNL. DISCLAIMER: - This work was prepared as an account of work sponsored by an agency of - the United States Government. Neither the United States Government nor - the University of California nor any of their employees, makes any - warranty, express or implied, or assumes any liability or responsibility - for the accuracy, completeness, or usefulness of any information, - apparatus, product, or process disclosed, or represents that its use - would not infringe privately- owned rights. Reference herein to any - specific commercial products, process, or service by trade name, - trademark, manufacturer, or otherwise, does not necessarily constitute - or imply its endorsement, recommendation, or favoring by the United - States Government or the University of California. The views and - opinions of authors expressed herein do not necessarily state or reflect - those of the United States Government or the University of California, - and shall not be used for advertising or product endorsement purposes. + THIS WORK WAS PREPARED AS AN ACCOUNT OF WORK SPONSORED BY AN AGENCY OF + THE UNITED STATES GOVERNMENT. NEITHER THE UNITED STATES GOVERNMENT NOR + THE UNIVERSITY OF CALIFORNIA NOR ANY OF THEIR EMPLOYEES, MAKES ANY + WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY OR RESPONSIBILITY + FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, + APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE + WOULD NOT INFRINGE PRIVATELY- OWNED RIGHTS. REFERENCE HEREIN TO ANY + SPECIFIC COMMERCIAL PRODUCTS, PROCESS, OR SERVICE BY TRADE NAME, + TRADEMARK, MANUFACTURER, OR OTHERWISE, DOES NOT NECESSARILY CONSTITUTE + OR IMPLY ITS ENDORSEMENT, RECOMMENDATION, OR FAVORING BY THE UNITED + STATES GOVERNMENT OR THE UNIVERSITY OF CALIFORNIA. THE VIEWS AND + OPINIONS OF AUTHORS EXPRESSED HEREIN DO NOT NECESSARILY STATE OR REFLECT + THOSE OF THE UNITED STATES GOVERNMENT OR THE UNIVERSITY OF CALIFORNIA, + AND SHALL NOT BE USED FOR ADVERTISING OR PRODUCT ENDORSEMENT PURPOSES. ----------------------------------------------------------------------------- diff --git a/test/Makefile.am b/test/Makefile.am index dbee9c2..aa6afee 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -145,7 +145,7 @@ ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \ ttsafe_acreate.c cache_image_SOURCES=cache_image.c genall5.c -VFD_LIST = hdfs sec2 stdio core core_paged split multi family +VFD_LIST = sec2 stdio core core_paged split multi family if DIRECT_VFD_CONDITIONAL VFD_LIST += direct endif -- cgit v0.12 From 905d40aa6f6eb603c5507e7967130760e3a2e43c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 31 Jul 2019 09:34:01 -0500 Subject: Fix return type for H5Sselect_intersect_block(). --- src/H5Sselect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index af93feb..e632b11 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -2081,7 +2081,7 @@ H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *e { H5S_t *space; /* Dataspace to query */ unsigned u; /* Local index value */ - herr_t ret_value = SUCCEED; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("t", "i*h*h", space_id, start, end); -- cgit v0.12 From 0ee5526c2c95dd77ee61b917b16adfcacbd3a540 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 31 Jul 2019 09:08:16 -0700 Subject: Fixed typo in optimization. --- config/gnu-fflags | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index 90a3656..d6d0b39 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -111,11 +111,11 @@ if test "X-gfortran" = "X-$f9x_vendor"; then ################ if test $f9x_vers_major -le 4; then - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS= + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= else - HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-Og" + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-Og" fi NO_OPT_FCFLAGS="-O0" -- cgit v0.12 From 519dfe549a4b8ffb4bd5d4c72a3f5fb61b80143f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 31 Jul 2019 15:06:33 -0500 Subject: Mostly whitespace cleanup and consistent test format --- test/links.c | 3832 ++++++++++++++++++++++------------------------------------ 1 file changed, 1413 insertions(+), 2419 deletions(-) diff --git a/test/links.c b/test/links.c index b7eb6af..f8be2b5 100644 --- a/test/links.c +++ b/test/links.c @@ -12,9 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Friday, April 10, 1998 - * * Purpose: Tests hard, soft (symbolic) & external links. */ @@ -34,10 +31,10 @@ #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ +#include "H5FDpkg.h" /* File drivers */ +#include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -62,55 +59,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10",/* 30: */ - TMPDIR "extlinks11",/* 31: */ - TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13",/* 34: */ - TMPDIR "extlinks14",/* 35: */ - TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B",/* 46: */ - TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D",/* 49: */ - TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10", /* 30: */ + TMPDIR "extlinks11", /* 31: */ + TMPDIR "extlinks12", /* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13", /* 34: */ + TMPDIR "extlinks14", /* 35: */ + TMPDIR "extlinks15", /* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B", /* 46: */ + TMPDIR2 "extlinks21C", /* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D", /* 49: */ + TMPDIR "extlinks21E", /* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -326,43 +323,32 @@ static hid_t dcpl_g; /* for [un]minimized dataset object headers */ * path name of Unix and Windows. * * Return: void - * - * Programmer: Raymond Lu - * 14 Jan. 2009 *------------------------------------------------------------------------- */ static void fix_ext_filename(char *path_name, char *cwd, const char *file_name) { HDstrcpy(path_name, cwd); - HDstrcat(path_name, "/"); HDstrcat(path_name, file_name); } /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * * Purpose: Build a file with assorted links. * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: - * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int mklinks(hid_t fapl, hbool_t new_format) { hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -399,10 +385,10 @@ mklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -412,14 +398,7 @@ mklinks(hid_t fapl, hbool_t new_format) * Purpose: Build a file with assorted links for different locations. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Friday, April 19, 2002 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -429,8 +408,8 @@ new_links(hid_t fapl, hbool_t new_format) hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); hid_t scalar=(-1); hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; - hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; if(new_format) TESTING("H5Lcreate functions (w/new group format)") @@ -488,7 +467,7 @@ new_links(hid_t fapl, hbool_t new_format) if(H5Fclose(file_b) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -502,36 +481,29 @@ new_links(hid_t fapl, hbool_t new_format) H5Fclose(file_a); H5Fclose(file_b); } H5E_END_TRY; - return -1; + return FAIL; } /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * * Purpose: Open the file created in the first step and check that the - * links look correct. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: + * links look correct. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +518,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -573,83 +545,83 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -659,10 +631,10 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -673,20 +645,15 @@ error: * links look correct. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Thursday, April 25, 2002 - * *------------------------------------------------------------------------- */ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -698,34 +665,31 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -735,25 +699,18 @@ error: * Purpose: Build a file with long names * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, April 16, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ - char *objname = NULL; /* Name of object [Long] */ - size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t gid2 = -1; /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -792,7 +749,7 @@ long_links(hid_t fapl, hbool_t new_format) HDfree(objname); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -801,7 +758,7 @@ long_links(hid_t fapl, hbool_t new_format) H5Fclose (fid); } H5E_END_TRY; HDfree(objname); - return -1; + return FAIL; } @@ -811,23 +768,16 @@ long_links(hid_t fapl, hbool_t new_format) * Purpose: Build a file with too many symbolic links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +867,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -940,7 +890,7 @@ toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -948,7 +898,7 @@ toomany(hid_t fapl, hbool_t new_format) H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end toomany() */ @@ -959,26 +909,20 @@ toomany(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_lcpl(hid_t fapl, hbool_t new_format) { - hid_t file_id=-1; - hid_t group_id=-1; - hid_t space_id=-1; - hid_t dset_id=-1; - hid_t type_id=-1; - hid_t lcpl_id=-1; - H5L_info_t linfo; - char filename[1024]; - hsize_t dims[2]; + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info_t linfo; + char filename[1024]; + hsize_t dims[2]; if(new_format) TESTING("link creation property lists (w/new group format)") @@ -1097,7 +1041,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1118,22 +1062,15 @@ error: * Purpose: Tests H5Lmove() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1142,11 +1079,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1154,99 +1089,75 @@ test_move(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Move a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a soft link across files. Should succeed. */ - if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move an external link across files. Should succeed. */ - if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) - TEST_ERROR + if( H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is no longer in the original location */ H5E_BEGIN_TRY { moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ - if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ - if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ - if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is in no previous locations */ H5E_BEGIN_TRY { - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR } H5E_END_TRY; H5Gclose(grp_1); @@ -1256,17 +1167,17 @@ test_move(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1278,21 +1189,14 @@ test_move(hid_t fapl, hbool_t new_format) * Purpose: Tests H5Lcopy() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; char filename[1024]; if(new_format) @@ -1302,11 +1206,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1314,111 +1216,76 @@ test_copy(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a soft link across files. Should succeed. */ - if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Copy an external link across files. Should succeed. */ - if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ - if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ - if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ - if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR H5Gclose(grp_1); H5Gclose(grp_2); @@ -1427,17 +1294,17 @@ test_copy(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1451,12 +1318,6 @@ test_copy(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1604,13 +1465,13 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; @@ -1625,12 +1486,6 @@ error: * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Wednesday, April 26 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1756,7 +1611,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1775,25 +1630,18 @@ error: * Purpose: Build a file with external link to root group in external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, May 25, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; const char *file; /* File from external link */ const char *path; /* Path from external link */ @@ -1824,21 +1672,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,28 +1696,27 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1941,15 +1788,15 @@ external_link_root(hid_t fapl, hbool_t new_format) H5F_sfile_assert_num(0); PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_root() */ @@ -1960,24 +1807,17 @@ external_link_root(hid_t fapl, hbool_t new_format) * external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2049,15 +1889,15 @@ external_link_path(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_path() */ @@ -2068,26 +1908,19 @@ external_link_path(hid_t fapl, hbool_t new_format) * external file links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1, fid2 = -1; /* File IDs */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2213,15 +2046,15 @@ external_link_mult(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_mult() */ @@ -2231,26 +2064,19 @@ external_link_mult(hid_t fapl, hbool_t new_format) * Purpose: Build a file with external link to itself * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Wednesday, July 12, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lcpl_id = -1; /* Link Creation Property List ID */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2311,8 +2137,8 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ /* Create file2 with an external link to file1 */ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -2336,7 +2162,6 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Close file1 */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -2361,16 +2186,16 @@ external_link_self(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Pclose(lcpl_id); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_self() */ @@ -2401,11 +2226,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2417,7 +2242,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2432,7 +2257,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2444,7 +2269,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2465,7 +2290,6 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -2484,15 +2308,15 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_pingpong() */ @@ -2523,24 +2347,17 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) * file1:/link17 -> file2: /final * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 8, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2575,7 +2392,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2596,16 +2413,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2628,15 +2445,15 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_toomany() */ @@ -2647,23 +2464,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) * missing files and missing objects. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t rid = (-1); /* Root Group ID */ - hid_t status = (-1); /* Status */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t rid = -1; /* Root Group ID */ + hid_t status = -1; /* Status */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -2677,7 +2487,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create dangling external links */ if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2687,26 +2497,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file (for dangling object test) */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Get root group ID */ - if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2524,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2736,14 +2546,14 @@ external_link_dangling(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_dangling() */ @@ -2751,32 +2561,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t gapl_id = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2796,8 +2600,8 @@ external_link_prefix(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2805,7 +2609,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file (without the absolute path) */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2821,9 +2625,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2831,14 +2635,14 @@ external_link_prefix(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_prefix() */ @@ -2846,25 +2650,19 @@ external_link_prefix(hid_t fapl, hbool_t new_format) * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -2925,14 +2723,14 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abs_mainpath() */ @@ -2940,25 +2738,19 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) * Function: external_link_rel_mainpath: test 4 * * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -2980,8 +2772,8 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2989,7 +2781,7 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3001,9 +2793,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3011,45 +2803,37 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_rel_mainpath() */ /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory - * + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 3. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via current working directory(w/new group format)") @@ -3093,9 +2877,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3103,46 +2887,39 @@ external_link_cwd(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_cwd() */ - /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's absolute path (w/new group format)") @@ -3175,7 +2952,6 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3189,9 +2965,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3199,39 +2975,33 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar() */ /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -3256,7 +3026,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3269,7 +3039,6 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3283,9 +3052,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3293,14 +3062,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar_cur() */ @@ -3308,25 +3077,19 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -3339,8 +3102,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name: "tmp/extlinks8" */ /* set up name for external linked target file: "tmp/extlinks8" */ @@ -3363,9 +3125,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3373,14 +3135,14 @@ external_link_reltar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_reltar() */ @@ -3396,19 +3158,13 @@ external_link_reltar(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -3424,8 +3180,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name ("tmp/extlinks9") */ h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); @@ -3438,9 +3193,8 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3460,9 +3214,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3470,14 +3224,14 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_chdir() */ @@ -3485,10 +3239,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. + * different from the parent can be successfully opened. * * 1. target link: "extlinks16" - * 2. target file: "extlinks16" + * 2. target file: "extlinks16" * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" * 4. Create target file A to be a "family" file: extlinks16A * 4. Create target file B to be a "multi" file: extlinks16B @@ -3499,12 +3253,6 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -3514,18 +3262,18 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) hid_t fidA=(-1), fidB=(-1); hid_t gidA=(-1), gidB=(-1); hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hid_t fam_fapl=-1, multi_fapl=-1; hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][64]; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,7 +3281,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: @@ -3545,8 +3293,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "family" fapl */ fam_fapl = h5_fileaccess(); - if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) - TEST_ERROR; + if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; /* set up name for external linked target file A: "extlinks16A" */ /* set up name for target file A: "extlinks16A" */ @@ -3560,8 +3307,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3595,8 +3342,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "multi" fapl */ multi_fapl = h5_fileaccess(); - if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) - TEST_ERROR; + if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) TEST_ERROR; /* set up name for external linked target file B: "extlinks16B" */ /* set up name for target file B: "extlinks16B" */ @@ -3620,11 +3366,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file A:/A */ - if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create external link to target file B:/B */ - if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3379,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3393,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3664,21 +3408,21 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl1() */ @@ -3686,45 +3430,39 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. * * 1. target link: "extlinks17" * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 7. Should succeed in opening the target dataset: ext_link + * 8. Write data to the target dataset + * 9. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hsize_t dims[2]; - int points[NUM40][NUM40]; + hid_t gid = (-1); /* Group IDs */ + hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hsize_t dims[2]; + int points[NUM40][NUM40]; + int i, j, n; h5_stat_size_t filesize, new_filesize; - int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3474,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3744,8 +3482,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR /* set up name for external linked target file: "extlinks17" */ /* set up name for target file: "extlinks17" */ @@ -3768,8 +3505,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ - if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3785,12 +3521,10 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ - if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* create fapl to be a "core" file without backing store */ - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR /* Set file access property list for link access to use the "core" driver */ if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR @@ -3810,8 +3544,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) points[i][j] = n++; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR if(H5Pclose(dapl_id) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -3825,20 +3558,20 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pclose(core_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl2() */ @@ -3846,17 +3579,17 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl * 10. Verify that the copied link access's fapl is the core driver * 11. Get the fapl property value of the copied link access * 12. H5Premove() the fapl property from the copied link access @@ -3865,18 +3598,12 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl3(hbool_t new_format) { - hid_t core_fapl = -1, stdio_fapl = -1; + hid_t core_fapl = -1, stdio_fapl = -1; hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) @@ -3886,12 +3613,10 @@ external_set_elink_fapl3(hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR stdio_fapl = h5_fileaccess(); - if(H5Pset_fapl_stdio(stdio_fapl) < 0) - TEST_ERROR + if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR /* Set file access property list for link access to use the "stdio" driver */ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3932,9 +3657,9 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pclose(stdio_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(l_fapl); H5Pclose(lapl_id); @@ -3942,7 +3667,7 @@ external_set_elink_fapl3(hbool_t new_format) H5Pclose(core_fapl); H5Pclose(stdio_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl3() */ @@ -3953,12 +3678,6 @@ external_set_elink_fapl3(hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4153,9 +3872,9 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Gclose(subgroup); @@ -4163,7 +3882,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo H5Fclose(file2); H5Pclose(gapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_acc_flags() */ @@ -4174,12 +3893,6 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ /* User data structure for callback function */ @@ -4217,7 +3930,7 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, if (op_data->code == 2) *flags = H5F_ACC_DEFAULT; - return 0; + return SUCCEED; } /* Main test function */ @@ -4226,7 +3939,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver; set_elink_cb_t op_data, - *op_data_p; + *op_data_p; H5L_elink_traverse_t cb; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -4319,9 +4032,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Fclose(file1); @@ -4330,7 +4043,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) H5Pclose(ret_fapl); H5Pclose(fam_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_cb() */ @@ -4342,12 +4055,6 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Apr. 9, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4385,13 +4092,13 @@ external_reset_register(void) if(HDremove(filename) != 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_reset_register() */ @@ -4401,31 +4108,25 @@ external_reset_register(void) * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" - * 2. main file: "extlinks0" - * 3. target file: "extlinks10" - * Should be able to find the target file via main file's current drive/rel path + * 1. target link: "/CWD/tmp/extlinks10" + * 2. main file: "extlinks0" + * 3. target file: "extlinks10" + * Should be able to find the target file via main file's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") @@ -4455,7 +4156,6 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4469,9 +4169,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4479,14 +4179,14 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win1() */ @@ -4495,30 +4195,24 @@ external_link_win1(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") @@ -4563,9 +4257,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4573,14 +4267,14 @@ external_link_win2(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win2() */ @@ -4589,30 +4283,24 @@ external_link_win2(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April i15 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4656,9 +4344,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4666,45 +4354,39 @@ external_link_win3(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win3() */ /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" + * 1. target link: ":extlinks13" * 2. main file: ":tmp/extlinks0" * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4724,16 +4406,15 @@ external_link_win4(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4745,9 +4426,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4755,14 +4436,14 @@ external_link_win4(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win4() */ @@ -4771,31 +4452,25 @@ external_link_win4(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)") @@ -4831,7 +4506,6 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4845,9 +4519,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,14 +4529,14 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win5() */ @@ -4871,30 +4545,24 @@ external_link_win5(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4921,16 +4589,15 @@ external_link_win6(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[36], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4942,9 +4609,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4952,14 +4619,14 @@ external_link_win6(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win6() */ @@ -4970,7 +4637,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4979,8 +4646,8 @@ external_link_win6(hid_t fapl, hbool_t new_format) static int external_link_win7(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5015,7 +4682,6 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5039,14 +4705,14 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win7() */ @@ -5057,7 +4723,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\:\CWD\extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" - * Should be able to access the target file directly (abs drive/abs path) + * Should be able to access the target file directly (abs drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -5067,9 +4733,9 @@ external_link_win7(hid_t fapl, hbool_t new_format) static int external_link_win8(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5084,12 +4750,10 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* create tmp directory */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target link: ":\CWD\extlinks10" */ drive = HDgetdrive(); @@ -5107,7 +4771,6 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5131,14 +4794,14 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win8() */ @@ -5149,7 +4812,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -5158,13 +4821,13 @@ external_link_win8(hid_t fapl, hbool_t new_format) static int external_link_win9(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)") @@ -5174,8 +4837,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ @@ -5194,7 +4856,6 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5218,14 +4879,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win9() */ #endif /* H5_HAVE_WINDOW_PATH */ @@ -5238,20 +4899,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5262,7 +4917,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create recursive external links */ if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -5270,33 +4925,31 @@ external_link_recursive(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_recursive() */ @@ -5308,25 +4961,19 @@ external_link_recursive(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5339,7 +4986,7 @@ external_link_query(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link */ /* (add a few extra '/'s to make certain library normalizes external link object names) */ @@ -5349,16 +4996,16 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create object to link to */ if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -5367,7 +5014,6 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -5375,9 +5021,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5393,9 +5039,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5406,27 +5052,27 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_query() */ @@ -5437,17 +5083,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -5479,9 +5121,6 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5504,7 +5143,7 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5512,7 +5151,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_compact() */ @@ -5523,25 +5162,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("unlinking external link in dense group (w/new group format)") @@ -5606,9 +5241,6 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5650,7 +5282,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5658,7 +5290,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_dense() */ @@ -5669,20 +5301,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, December 5, 2005 - * *------------------------------------------------------------------------- */ -static int -external_link_move(hid_t fapl, hbool_t new_format) -{ - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ +static int +external_link_move(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5712,9 +5340,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Move external link to different name within same group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5798,7 +5424,6 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Move external link back to original group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5841,7 +5466,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5849,7 +5474,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_move() */ @@ -5861,25 +5486,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("external link along for the ride (w/new group format)") @@ -6026,7 +5647,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6035,7 +5656,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_ride() */ @@ -6047,10 +5668,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Wednesday, August 16, 2006 - * *------------------------------------------------------------------------- */ static int @@ -6060,11 +5677,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6254,7 +5871,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6268,7 +5885,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* external_link_closing() */ @@ -6281,19 +5898,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lapl_id = (-1); /* Prop List ID */ - const char *pathbuf = H5_get_srcdir(); /* Path to the files */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lapl_id = -1; /* Prop List ID */ + const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; if(new_format) @@ -6335,7 +5948,7 @@ external_link_endian(hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6343,7 +5956,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } @@ -6355,10 +5968,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, March 5, 2007 - * *------------------------------------------------------------------------- */ static int @@ -6368,7 +5977,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6417,7 +6026,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) if(H5Pclose(my_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6428,7 +6037,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_strong() */ @@ -6440,10 +6049,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Nov. 23, 2009 - * *------------------------------------------------------------------------- */ static int @@ -6452,17 +6057,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6518,7 +6123,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); - /* Create file #1 in current directory */ if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6528,7 +6132,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(file2) < 0) TEST_ERROR @@ -6548,7 +6151,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #2 */ if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6564,7 +6166,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #3 */ if(H5Fclose(file3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6580,7 +6181,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #4 */ if(H5Fclose(file4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6591,7 +6191,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #5 */ if(H5Fclose(file5) < 0) TEST_ERROR - /* Actual tests... */ /* Reopen file #1 */ @@ -6616,17 +6215,16 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group5); H5Gclose(group4); @@ -6638,12 +6236,12 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; - return -1; + return FAIL; #else /* H5_HAVE_SYMLINK */ SKIPPED(); HDputs(" Current file system or operating system doesn't support symbolic links"); - return 0; + return SUCCEED; #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ @@ -6658,18 +6256,14 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_copy_invalid_object(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t ocpyplid = (-1); /* Object copy plist ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t ocpyplid = -1; /* Object copy plist ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6708,7 +6302,7 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) if(H5Pclose(ocpyplid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6717,7 +6311,7 @@ error: H5Pclose(ocpyplid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_copy_invalid_object */ @@ -6730,18 +6324,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_dont_fail_to_source(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t oid = (-1); /* Object ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t oid = -1; /* Object ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6772,7 +6362,7 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6781,7 +6371,7 @@ error: H5Fclose(fid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_dont_fail_to_source */ @@ -6794,21 +6384,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Thursday, January 13, 2011 - * *------------------------------------------------------------------------- */ static int external_file_cache(hid_t fapl, hbool_t new_format) { - hid_t my_fapl = (-1); /* Temporary FAPL */ - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t fid3 = (-1); /* File ID */ - hid_t fid4 = (-1); /* File ID */ - hid_t oid = (-1); /* Object ID */ + hid_t my_fapl = -1; /* Temporary FAPL */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t fid3 = -1; /* File ID */ + hid_t fid4 = -1; /* File ID */ + hid_t oid = -1; /* Object ID */ unsigned efc_size; char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -6827,333 +6413,229 @@ external_file_cache(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4); /* Verify that the default EFC size is 0 */ - if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 0) FAIL_PUTS_ERROR("default external file cache size is not 0") /* Copy FAPL and enable external file caching */ - if((my_fapl = H5Pcopy(fapl)) < 0) - TEST_ERROR - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR /* Verify that the external file cache size has been set */ - if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 8) FAIL_PUTS_ERROR("external file cache size different from expected") - - /* - * Test 1: One file caches another - */ + /* Test 1: One file caches another */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: One file caches another, release parent's EFC - */ + /* Test 2: One file caches another, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only the parent file is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: "Y" shaped tree - */ + /* Test 3: "Y" shaped tree */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: "Y" shaped tree, release parent's EFC - */ + /* Test 4: "Y" shaped tree, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - /* - * Test 5: 3 file cycle - */ + /* Test 5: 3 file cycle */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 6: 3 file cycle, release parent's EFC - */ + /* Test 6: 3 file cycle, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); @@ -7162,7 +6644,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) H5Pclose(my_fapl); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7174,7 +6656,7 @@ error: H5Pclose(my_fapl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_file_cache */ @@ -7186,21 +6668,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Saturday, April 30, 2011 - * *------------------------------------------------------------------------- */ static int external_open_twice(hid_t fapl, hbool_t new_format) { - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t oid1 = (-1); /* Object ID */ - hid_t oid2 = (-1); /* Object ID */ - hid_t type = (-1); /* Datatype ID */ - hid_t space = (-1); /* Dataspace ID */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t oid1 = -1; /* Object ID */ + hid_t oid2 = -1; /* Object ID */ + hid_t type = -1; /* Datatype ID */ + hid_t space = -1; /* Dataspace ID */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -7213,192 +6691,123 @@ external_open_twice(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - - /* - * Test 1: Open root group twice - */ + /* Test 1: Open root group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: Open group twice - */ + /* Test 2: Open group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target group */ - if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - TEST_ERROR - if(H5Gclose(oid1) < 0) - TEST_ERROR + if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(oid1) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: Open dataset twice - */ + /* Test 3: Open dataset twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target dataset */ - if((space = H5Screate(H5S_SCALAR)) < 0) - TEST_ERROR - if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(oid1) < 0) - TEST_ERROR - if(H5Sclose(space) < 0) - TEST_ERROR + if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(oid1) < 0) TEST_ERROR + if(H5Sclose(space) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: Open datatype twice - */ + /* Test 4: Open datatype twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create target datatype */ - if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) - TEST_ERROR - if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) - < 0) - TEST_ERROR - if(H5Tclose(type) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create target datatype */ + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7410,7 +6819,7 @@ error: H5Sclose(space); } H5E_END_TRY - return -1; + return FAIL; } /* end external_open_twice() */ @@ -7437,23 +6846,23 @@ static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ char filename1[NAME_BUF_SIZE]; /* File name for main file */ char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7464,209 +6873,157 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - /* Main file */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create external link from main file to target file */ - if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - + if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create target file */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create group in target file */ - if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid2) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid2) < 0) - FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a copy of integer datatype */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Commit the datatype to the main file root group */ - if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR + if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR + if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR /* Attach an attribute with the committed datatype to the group */ - if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write data to the attribute */ - if(H5Awrite(aid, tid, &wdata) < 0) - FAIL_STACK_ERROR + if(H5Awrite(aid, tid, &wdata) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Create a chunked dataset */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) - FAIL_STACK_ERROR + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR if (dcpl_g == H5P_DEFAULT) dcpl = H5Pcreate(H5P_DATASET_CREATE); else dcpl = H5Pcopy(dcpl_g); if (0 > dcpl) FAIL_STACK_ERROR - if(H5Pset_chunk(dcpl, 2, chunks) < 0) - FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ - if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write to the dataset */ - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - FAIL_STACK_ERROR + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the dataset creation property list */ - if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Close the dataspaces */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - if(H5Sclose(sid2) < 0) - FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - + if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR /* Open the mainfile */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open the committed datatype in the mainfile */ - if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify the datatype is committed */ - if(H5Tcommitted(tid) == FALSE) - FAIL_STACK_ERROR + if(H5Tcommitted(tid) == FALSE) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open the attribute attached to the group */ - if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the attribute's datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Delete the attribute */ - if(H5Adelete(gid1, "myAttribute") < 0) - FAIL_STACK_ERROR + if(H5Adelete(gid1, "myAttribute") < 0) FAIL_STACK_ERROR /* Open the dataset in the group */ - if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the dataset's datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Read the dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR /* Compare the data read should be the same as wbuf */ - if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) - FAIL_STACK_ERROR + if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7685,10 +7042,10 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_link_with_committed_datatype() */ @@ -7700,10 +7057,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD hard links. */ @@ -7770,7 +7123,7 @@ done: case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7787,7 +7140,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, hid_t ret_value = -1; if(udata_size != sizeof(haddr_t)) - return -1; + return FAIL; addr = *((const haddr_t *) udata); @@ -7859,7 +7212,7 @@ done: case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7881,12 +7234,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7920,7 +7273,6 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined "hard link" to the group using the address we got * from H5Lget_info */ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -7958,9 +7310,9 @@ ud_hard_links(hid_t fapl) /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been a UD hard link"); + goto error; } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be @@ -7987,15 +7339,15 @@ ud_hard_links(hid_t fapl) if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_hard_links() */ @@ -8007,10 +7359,6 @@ ud_hard_links(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* A traversal function that ignores any udata and simply opens an object @@ -8028,7 +7376,7 @@ UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_rereg_traverse() */ /* This link class has the same ID number as the UD hard links but @@ -8048,23 +7396,23 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - h5_stat_size_t empty_size; /* Size of an empty file */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Get the size of the empty file for reference */ if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -8103,9 +7451,9 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + TEST_ERROR } H5E_END_TRY /* Register a new kind of link with the same ID number */ @@ -8173,15 +7521,15 @@ ud_link_reregister(hid_t fapl) if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_reregister() */ @@ -8193,10 +7541,6 @@ ud_link_reregister(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD "callback" links. */ @@ -8214,10 +7558,10 @@ UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_create() */ static hid_t @@ -8241,7 +7585,7 @@ UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, return ret_value; error: - return -1; + return FAIL; } /* end UD_cb_traverse() */ /* Callback for when the link is moved or renamed */ @@ -8257,10 +7601,10 @@ UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8276,10 +7620,10 @@ UD_cb_delete(const char *link_name, hid_t file, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_delete() */ /* Callback for when the link is queried */ @@ -8303,7 +7647,7 @@ UD_cb_query(const char * link_name, const void *udata, size_t udata_size, return 16; error: - return -1; + return FAIL; } /* end UD_cb_query() */ const H5L_class_t UD_cb_class[1] = {{ @@ -8321,12 +7665,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t lcpl = (-1); /* Link Creation PL */ - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8349,8 +7693,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) * no problems. */ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Register user-defined link class. This is the one we'll actually - * be using. */ + /* Register user-defined link class. This is the one we'll actually be using. */ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR /* Check that registered link classes are, and unregistered ones aren't */ @@ -8392,7 +7735,6 @@ ud_callbacks(hid_t fapl, hbool_t new_format) /* Remove UD link */ if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR - /* Test that the callbacks don't work if the link class is not registered */ /* Create a new link. Just for fun, give it a non-default character @@ -8430,7 +7772,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8438,7 +7780,7 @@ error: H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_callbacks() */ @@ -8450,10 +7792,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static hid_t @@ -8469,13 +7807,12 @@ UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, /* Get the name of the target from the property list. */ if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) TEST_ERROR return ret_value; error: - return -1; + return FAIL; } /* end UD_plist_traverse() */ const H5L_class_t UD_plist_class[1] = {{ @@ -8493,12 +7830,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist_id = -1; /* Property List ID */ + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8569,16 +7906,16 @@ lapl_udata(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose (plist_id); H5Gclose (gid); H5Gclose (gid2); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_udata() */ @@ -8590,10 +7927,6 @@ lapl_udata(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -8601,10 +7934,9 @@ UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { /* Check to make sure that this "soft link" has a target */ - if(udata_size < 1 || !udata) - return -1; + if(udata_size < 1 || !udata) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbsucc_create() */ static hid_t @@ -8622,7 +7954,7 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_cbsucc_traverse() */ /* Failure callback for when the link is moved or renamed */ @@ -8631,7 +7963,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_move() */ /* SuccessCallback for when the link is moved or renamed */ @@ -8640,7 +7972,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always succeed. */ - return 0; + return SUCCEED; } /* end UD_cbsucc_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8649,7 +7981,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This callback will always succeed */ - return 0; + return SUCCEED; } /* end UD_cbsucc_delete() */ /* Callback for when the link is deleted. Also called during move */ @@ -8659,7 +7991,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file { /* This traversal function will always fail. */ /* Note: un-deletable links are in general a very bad idea! */ - return -1; + return FAIL; } /* end UD_cbfail_delete() */ /* Callback for when the link is queried */ @@ -8668,7 +8000,7 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_query() */ /* Callback for when the link is queried */ @@ -8681,10 +8013,9 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT * fails */ - if(buf != NULL) - return -1; + if(buf != NULL) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbfail_on_write_query() */ /* Callback for when the link is queried */ @@ -8791,12 +8122,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8809,10 +8140,10 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to register some invalid link classes */ H5E_BEGIN_TRY { - if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR } H5E_END_TRY /* Register the UD plist class. */ @@ -8827,16 +8158,13 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to create internally defined links with H5Lcreate_ud */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY; /* Create a user-defined link to the group. */ @@ -8904,14 +8232,14 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_errors() */ @@ -8922,28 +8250,21 @@ error: * by the user using the Link Access Property List. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ - hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ - hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -8958,7 +8279,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create group with short name in file (used as target for links) */ if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -8987,7 +8308,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create LAPL with higher-than-usual nlinks value */ /* Create a non-default lapl with udata set to point to the first group */ @@ -9041,7 +8362,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR if(HDstrcmp(objname, "/soft4")) TEST_ERROR - /* Test other functions that should use a LAPL */ nlinks = 20; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR @@ -9074,7 +8394,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Close plist */ if(H5Pclose(plist) < 0) TEST_ERROR - /* Create a datatype and dataset as targets inside the group */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9133,9 +8452,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(gapl); H5Pclose(dapl); @@ -9148,7 +8467,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) H5Pclose(plist); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_nlinks() */ @@ -9159,21 +8478,17 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t tid = (-1); /* Type ID */ - hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9226,16 +8541,16 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Tclose (tid); H5Dclose (did); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end linkinfo() */ @@ -9251,10 +8566,6 @@ linkinfo(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Thursday, August 17, 2006 - * *------------------------------------------------------------------------- */ static int @@ -9274,8 +8585,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) * To check this, try to create every file used in this test. If * a file is already open, creating it will fail. */ - for(x=0; FILENAME[x] != NULL && x < stopat; x++) - { + for(x=0; FILENAME[x] != NULL && x < stopat; x++) { h5_fixname(FILENAME[x], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -9283,17 +8593,15 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end check_all_closed() */ - - /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9301,10 +8609,6 @@ error: * * Return: Success: >0, File ID for file built * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static hid_t @@ -9312,9 +8616,9 @@ build_visit_file(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - hid_t sid = (-1); /* Dataspace ID */ - hid_t did = (-1); /* Dataset ID */ - hid_t tid = (-1); /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hid_t tid = -1; /* Datatype ID */ char filename[NAME_BUF_SIZE]; const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ @@ -9333,7 +8637,6 @@ build_visit_file(hid_t fapl) if(H5Gclose(gid2) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - /* Create soft links to groups created */ if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9341,7 +8644,6 @@ build_visit_file(hid_t fapl) /* Create dangling soft link */ if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create hard links to all groups */ if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9390,7 +8692,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end build_visit_file() */ @@ -9401,15 +8703,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, - void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -9431,10 +8728,6 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9464,7 +8757,6 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9478,19 +8770,18 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit() */ @@ -9501,10 +8792,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9534,7 +8821,6 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; @@ -9556,19 +8842,18 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit_by_name() */ @@ -9579,15 +8864,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, - void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9609,10 +8889,6 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9642,7 +8918,6 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9656,19 +8931,18 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit() */ @@ -9679,10 +8953,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9712,7 +8982,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; @@ -9724,7 +8993,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -9735,19 +9003,18 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_by_name() */ @@ -9757,15 +9024,10 @@ error: * Purpose: Callback routine for visiting objects in a file * * Return: 1 (H5_ITER_STOP) - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, - void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9784,10 +9046,6 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int @@ -9817,7 +9075,7 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) /* Same test with H5Ovisit_by_name */ nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9825,13 +9083,13 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_stop() */ @@ -9843,10 +9101,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Tuesday, June 16, 2009 - * *------------------------------------------------------------------------- */ static enum { @@ -9859,14 +9113,11 @@ static enum { static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 1; + if(link_filter_state >= LFS_ENCODED) return 1; - if(link_filter_state != LFS_INIT) - return -1; + if(link_filter_state != LFS_INIT) return -1; link_filter_state = LFS_CAN_APPLY_CALLED; @@ -9875,14 +9126,11 @@ static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 0; + if(link_filter_state >= LFS_ENCODED) return 0; - if(link_filter_state != LFS_CAN_APPLY_CALLED) - return -1; + if(link_filter_state != LFS_CAN_APPLY_CALLED) return -1; link_filter_state = LFS_SET_LOCAL_CALLED; @@ -9893,19 +9141,16 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { - if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) - return 0; + if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0; - if(link_filter_state == LFS_DECODED) - return nbytes; + if(link_filter_state == LFS_DECODED) return nbytes; if(flags & H5Z_FLAG_REVERSE) { - if(link_filter_state != LFS_ENCODED) - return 0; + if(link_filter_state != LFS_ENCODED) return 0; link_filter_state = LFS_DECODED; - } else { - if(link_filter_state < LFS_SET_LOCAL_CALLED) - return 0; + } + else { + if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0; link_filter_state = LFS_ENCODED; } /* end else */ @@ -9926,7 +9171,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -9944,8 +9189,7 @@ link_filters(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create gcpl, force use of dense storage */ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR @@ -9973,8 +9217,7 @@ link_filters(hid_t fapl, hbool_t new_format) filter_class.set_local = link_filter_set_local; filter_class.filter = link_filter_filter; if(H5Zregister(&filter_class) < 0) TEST_ERROR - if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR nfilters++; /* Test various other filter functions for use on gcpl's */ @@ -9982,14 +9225,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR /* Create a group using this filter, add some soft links to it */ - if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10013,12 +9252,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pclose(gcpl2) < 0) TEST_ERROR /* Add another soft link */ - if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy the group */ - if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR /* Verify that all links have been copied */ @@ -10047,10 +9284,8 @@ link_filters(hid_t fapl, hbool_t new_format) /* Reopen file and group, add 2 links */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10061,34 +9296,27 @@ link_filters(hid_t fapl, hbool_t new_format) /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, - &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Pmodify_filter */ cd_value++; - if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Premove_filter */ if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR @@ -10114,8 +9342,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR /* Create new group, with missing intermediate groups, in compressed group */ - if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Close LCPL ID */ if(H5Pclose(lcpl) < 0) TEST_ERROR @@ -10143,7 +9370,6 @@ link_filters(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Now create the same file with and without deflate, and verify that the * file size is smaller with deflate */ /* But only if the deflate filter is available */ @@ -10157,8 +9383,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR /* Create file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR /* Create links in file */ if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10176,8 +9401,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR /* Recreate the same file with the deflate filter */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10190,16 +9414,14 @@ link_filters(hid_t fapl, hbool_t new_format) filesize_filtered = h5_get_file_size(filename, fapl); /* Check that the file size is smaller with the filter */ - if((double)filesize_filtered - > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR + if((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR /* Close */ if(H5Pclose(fcpl) < 0) TEST_ERROR } /* end if */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10211,7 +9433,7 @@ error: H5Pclose(gcpl2); H5Pclose(fcpl); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_filters() */ @@ -10222,19 +9444,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, February 2, 2010 - * *------------------------------------------------------------------------- */ static int obj_exists(hid_t fapl, hbool_t new_format) { - char filename[NAME_BUF_SIZE]; /* Buffer for file name */ - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - herr_t status; /* Generic return value */ + char filename[NAME_BUF_SIZE]; /* Buffer for file name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + herr_t status; /* Generic return value */ if(new_format) TESTING("object exists (w/new group format)") @@ -10244,8 +9462,7 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Hard links */ /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ @@ -10255,13 +9472,11 @@ obj_exists(hid_t fapl, hbool_t new_format) if(status >= 0) TEST_ERROR /* Create a group, as a destination for testing */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() succeeds for hard linked object */ - if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ H5E_BEGIN_TRY { @@ -10269,237 +9484,202 @@ obj_exists(hid_t fapl, hbool_t new_format) } H5E_END_TRY if(status >= 0) TEST_ERROR - /* Soft links */ /* Create dangling soft-link in root group */ if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ - if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to object */ if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) TEST_ERROR /* Create dangling soft-link in non-root group */ if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to object */ if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) TEST_ERROR /* External links */ /* Create dangling (file doesn't exist) external link in root group */ if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in root group */ if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) TEST_ERROR /* Create dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) TEST_ERROR /* Soft->External links */ /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link that points to object */ if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link that points to object */ if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) TEST_ERROR /* External->Soft links */ /* Create external link in root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in non-root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Close file created */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_exists() */ @@ -10510,19 +9690,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10544,9 +9720,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10571,7 +9747,6 @@ corder_create_empty(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10598,7 +9773,7 @@ corder_create_empty(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10606,7 +9781,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_empty() */ @@ -10618,21 +9793,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10682,7 +9853,6 @@ corder_create_compact(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10716,7 +9886,7 @@ corder_create_compact(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10724,7 +9894,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_compact() */ @@ -10736,21 +9906,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10816,7 +9982,6 @@ corder_create_dense(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10849,7 +10014,7 @@ corder_create_dense(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10857,7 +10022,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_dense() */ @@ -10869,25 +10034,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10927,7 +10088,6 @@ corder_transition(hid_t fapl) /* Get the size of the file with an empty group */ if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -11002,7 +10162,6 @@ corder_transition(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -11078,7 +10237,7 @@ corder_transition(hid_t fapl) if(file_size != empty_size) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11086,7 +10245,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_transition() */ @@ -11099,25 +10258,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ unsigned reopen_file; /* Whether to re-open the file before deleting group */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -11207,7 +10362,7 @@ corder_delete(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11215,7 +10370,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_delete() */ @@ -11225,15 +10380,11 @@ error: * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int @@ -11386,18 +10537,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11551,7 +10698,7 @@ link_info_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11559,7 +10706,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx() */ @@ -11571,17 +10718,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11719,14 +10862,14 @@ link_info_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx_old() */ @@ -11738,19 +10881,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11814,10 +10953,8 @@ delete_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion on empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -11948,10 +11085,8 @@ delete_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Delete links in middle */ - /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12028,8 +11163,6 @@ delete_by_idx(hid_t fapl) if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12044,7 +11177,7 @@ delete_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12052,7 +11185,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx() */ @@ -12064,17 +11197,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, November 15, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12099,10 +11228,8 @@ delete_by_idx_old(hid_t fapl) /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion in empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); @@ -12178,10 +11305,8 @@ delete_by_idx_old(hid_t fapl) /* Verify state of group */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Delete links in middle */ - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { H5O_info_t oi; /* Buffer for querying object's info */ @@ -12269,7 +11394,7 @@ delete_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12277,7 +11402,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx_old() */ @@ -12288,10 +11413,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12300,14 +11421,14 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { @@ -12315,31 +11436,31 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) if(info->corder != op_data->curr) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12351,9 +11472,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12366,16 +11487,12 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12388,17 +11505,13 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -12409,10 +11522,6 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12440,7 +11549,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12457,7 +11565,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12488,7 +11595,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12521,7 +11627,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12533,7 +11638,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12547,7 +11651,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -12556,10 +11659,10 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret >= 0) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_check() */ @@ -12667,7 +11770,6 @@ link_iterate(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR @@ -12697,7 +11799,6 @@ link_iterate(hid_t fapl) /* Test iteration over links in compact group */ if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12742,7 +11843,7 @@ link_iterate(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -12755,7 +11856,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate() */ @@ -12766,52 +11867,47 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12823,9 +11919,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12838,16 +11934,12 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_old_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_old_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12859,15 +11951,10 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_check(hid_t group_id, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) +link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12890,7 +11977,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12907,7 +11993,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12938,7 +12023,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12971,7 +12055,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12983,7 +12066,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12997,7 +12079,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -13020,10 +12101,10 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_old_check() */ @@ -13034,17 +12115,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13080,7 +12157,6 @@ link_iterate_old(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR @@ -13118,7 +12194,6 @@ link_iterate_old(hid_t fapl) /* Test iteration over links in group */ if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13132,7 +12207,7 @@ link_iterate_old(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13144,7 +12219,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate_old() */ @@ -13155,19 +12230,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, - haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oi; /* Buffer for querying object's info */ haddr_t mnt_root_addr; /* Address of root group in file to mount */ hid_t obj_id; /* ID of object opened */ @@ -13208,10 +12278,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, } /* end for */ } /* end for */ - - /* - * Verify opening correct object by index when file mounting is present - */ + /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR @@ -13238,12 +12305,11 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Unmount the file */ if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR - /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end open_by_idx_check() */ @@ -13255,21 +12321,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13358,14 +12420,12 @@ open_by_idx(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { hid_t group_id2; /* Group ID */ @@ -13400,7 +12460,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -13435,7 +12494,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13458,7 +12516,7 @@ open_by_idx(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13473,7 +12531,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end open_by_idx() */ @@ -13485,19 +12543,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13542,7 +12596,6 @@ open_by_idx_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { hid_t group_id2; /* Group ID */ @@ -13583,7 +12636,6 @@ open_by_idx_old(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13597,7 +12649,7 @@ open_by_idx_old(hid_t fapl) /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -13608,7 +12660,7 @@ error: H5Fclose(mount_file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end open_by_idx_old() */ @@ -13619,10 +12671,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int @@ -13630,7 +12678,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ @@ -13676,10 +12724,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, } /* end for */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end object_info_check() */ @@ -13691,21 +12739,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13915,7 +12959,7 @@ object_info(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13930,7 +12974,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end object_info() */ @@ -13941,19 +12985,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13991,7 +13031,6 @@ object_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); @@ -14051,7 +13090,6 @@ object_info_old(hid_t fapl) /* Verify querying objects by name */ if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14065,7 +13103,7 @@ object_info_old(hid_t fapl) /* Free resources */ if(H5Sclose(space_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14076,7 +13114,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end object_info_old() */ @@ -14088,20 +13126,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -14183,7 +13217,6 @@ group_info(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14200,7 +13233,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14225,7 +13257,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14238,7 +13269,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14263,7 +13293,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14282,7 +13311,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14307,7 +13335,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14330,7 +13357,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2, group_id3; /* Group IDs */ @@ -14341,7 +13367,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14366,7 +13391,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14379,7 +13403,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14404,7 +13427,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14423,7 +13445,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14448,7 +13469,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14471,7 +13491,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14487,7 +13506,7 @@ group_info(hid_t fapl) /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14498,7 +13517,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info() */ @@ -14510,18 +13529,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -14554,7 +13569,6 @@ group_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14571,7 +13585,6 @@ group_info_old(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14596,7 +13609,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14609,7 +13621,6 @@ group_info_old(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14634,7 +13645,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14653,7 +13663,6 @@ group_info_old(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14678,7 +13687,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14707,7 +13715,6 @@ group_info_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14718,7 +13725,7 @@ group_info_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: /* Free resources */ @@ -14728,7 +13735,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info_old() */ @@ -14740,20 +13747,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, March 3, 2007 - * *------------------------------------------------------------------------- */ static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t group_id2 = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t gcpl_id2 = -1; /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14779,7 +13782,6 @@ timestamps(hid_t fapl) /* Check default timestamp information */ if(track_times != FALSE) TEST_ERROR - /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -14832,7 +13834,6 @@ timestamps(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -14881,7 +13882,7 @@ timestamps(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: /* Free resources */ @@ -14891,32 +13892,27 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end timestamps() */ /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test links - * - * Return: Success: exit(EXIT_SUCCESS) - * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 + * Purpose: Test links * + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; - unsigned new_format; /* Whether to use the new format or not */ - unsigned minimize_dset_oh; - unsigned efc; /* Whether to use the external file cache */ + hid_t fapl = -1, fapl2 = -1; /* File access property lists */ + int nerrors = 0; + unsigned new_format; /* Whether to use the new format or not */ + unsigned minimize_dset_oh; + unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -14935,7 +13931,8 @@ main(void) HDprintf("\n-Testing with minimzed dataset object headers-\n"); dcpl_g = H5Pcreate(H5P_DATASET_CREATE); if (0 > dcpl_g) TEST_ERROR - } else { + } + else { HDprintf("\n-Testing with unminimzed dataset object headers-\n"); dcpl_g = H5P_DEFAULT; } @@ -14947,14 +13944,14 @@ main(void) if(new_format) { my_fapl = fapl2; HDprintf("\n--Testing with 'new format'--\n"); - } else { + } + else { my_fapl = fapl; HDprintf("\n--Testing with 'old format'--\n"); } /* always enter tests without external cache */ - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; @@ -14974,29 +13971,28 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ + * intermediate file is not held open + */ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ + * reopen a cached file with a different intent + */ nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - /* Try external link tests both with and without the external file cache - */ + /* Try external link tests both with and without the external file cache */ for(efc = FALSE; efc <= TRUE; efc++) { if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR HDprintf("\n---Testing with external file cache---\n"); } /* end if */ else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR HDprintf("\n---Testing without external file cache---\n"); } /* end else */ @@ -15043,7 +14039,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, @@ -15078,9 +14074,9 @@ main(void) nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; /* XXX: when creation order indexing is fully working, go back and add checks -* to these tests to make certain that the creation order values are -* correct. -*/ + * to these tests to make certain that the creation order values are + * correct. + */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; nerrors += corder_transition(fapl2) < 0 ? 1 : 0; @@ -15102,8 +14098,7 @@ main(void) nerrors += group_info_old(fapl) < 0 ? 1 : 0; if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) - TEST_ERROR; + if (H5Pclose(dcpl_g) < 0) TEST_ERROR; dcpl_g = -1; } } /* [un]minimized dataset object headers */ @@ -15123,8 +14118,7 @@ main(void) /* Results */ if(nerrors) { - HDprintf("***** %d LINK TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } HDprintf("All link tests passed.\n"); @@ -15137,7 +14131,7 @@ main(void) HDrmdir(TMPDIR); HDrmdir(TMPDIR2); - return 0; + return SUCCEED; error: HDputs("*** TESTS FAILED ***"); -- cgit v0.12 From 8120ba8bc1fab68a999995677a3cd1af2bc1da67 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 31 Jul 2019 16:50:31 -0500 Subject: Fix missing export tag --- test/external_common.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/external_common.h b/test/external_common.h index a2cb03e..f02652b 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -31,7 +31,15 @@ #define TOTAL_SIZE 100 #define GARBAGE_PER_FILE 10 -H5TEST_DLL herr_t reset_raw_data_files(int); -#endif /* _EXTERNAL_COMMON_H */ +#ifdef __cplusplus +extern "C" { +#endif + +H5TEST_DLL herr_t reset_raw_data_files(hbool_t is_env); +#ifdef __cplusplus +} +#endif + +#endif /* _EXTERNAL_COMMON_H */ -- cgit v0.12 From 438935557e04d6025a389fbe5fccb6290a62c054 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 31 Jul 2019 22:16:50 -0500 Subject: Fixed a couple of typos. --- config/conclude.am | 2 +- config/gnu-flags | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/conclude.am b/config/conclude.am index 2eec03a..58c2934 100644 --- a/config/conclude.am +++ b/config/conclude.am @@ -68,7 +68,7 @@ all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(chk_TESTS) # make install-doc doesn't do anything outside of doc directory, but # Makefiles should recognize it. # UPDATE: docs no longer reside in this build tree, so this target -# is depreciated. +# is deprecated. install-doc uninstall-doc: @echo "Nothing to be done." diff --git a/config/gnu-flags b/config/gnu-flags index ae8ddb0..6355ccf 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -195,7 +195,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # -Wvolatile-register-var was later incorporated into -Wall and # only needs to be specified explicitly for gcc 4.2-4.3 - if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $$cc_vers_minor -le 3; then + if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" fi -- cgit v0.12 From 4227b8948d7091205b4f8dc1271d7dcae01bb0fb Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 31 Jul 2019 22:51:53 -0500 Subject: Reverts the removal of config/conclude_fc.am while keeping the changes to config/gnu-fflags. --- MANIFEST | 1 + config/conclude_fc.am | 31 +++++++++++++++++++++++++++++++ fortran/examples/Makefile.am | 2 +- fortran/src/Makefile.am | 2 +- fortran/test/Makefile.am | 2 +- fortran/testpar/Makefile.am | 2 +- hl/fortran/examples/Makefile.am | 2 +- hl/fortran/src/Makefile.am | 3 +-- hl/fortran/test/Makefile.am | 2 +- 9 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 config/conclude_fc.am diff --git a/MANIFEST b/MANIFEST index 9c7c0db..594f4bc 100644 --- a/MANIFEST +++ b/MANIFEST @@ -119,6 +119,7 @@ ./config/cce-flags ./config/commence.am ./config/conclude.am +./config/conclude_fc.am ./config/examples.am ./config/freebsd ./config/gnu-cxxflags diff --git a/config/conclude_fc.am b/config/conclude_fc.am new file mode 100644 index 0000000..15d04a7 --- /dev/null +++ b/config/conclude_fc.am @@ -0,0 +1,31 @@ +## config/conclude_fc.am +## (Use double hashes for copyright notice so that automake treats it as +## comments and does not pass it to Makefile.in) +## Copyright by The HDF Group. +## Copyright by the Board of Trustees of the University of Illinois. +## All rights reserved. +## +## This file is part of HDF5. The full HDF5 copyright notice, including +## terms governing use, modification, and redistribution, is contained in +## the COPYING file, which can be found at the root of the source code +## distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +## If you do not have access to either file, you may request a copy from +## help@hdfgroup.org. + + +## Textually included at the end of the Fortran HDF5 Makefiles.am. + +# Makefile.am include fragment with Fortran helper rules and macros. + +# AM_FCCPPFLAGS, FCCPPFLAGS are currently not used. + +PPFCCOMPILE = $(FC) $(FCDEFS) $(DEFAULT_INCLUDES) $(FCINCLUDES) $(AM_FCCPPFLAGS) $(FCCPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) +LTPPFCCOMPILE = $(LIBTOOL) --tag=FC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(PPFCCOMPILE) + +# Treat all .f90 and .F90 files as preprocessed Fortran. +.f90.o: + $(PPFCCOMPILE) -c -o $@ $< +.F90.o: + $(PPFCCOMPILE) -c -o $@ $< + +include $(top_srcdir)/config/conclude.am diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 00afb3a..6bf2edb 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -105,4 +105,4 @@ compound_fortran2003: compound_fortran2003.f90 compound_complex_fortran2003: compound_complex_fortran2003.f90 include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 3489566..4009439 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -165,4 +165,4 @@ HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ H5Off.lo H5Pff.lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Zff.lo H5_gen.lo -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/fortran/test/Makefile.am b/fortran/test/Makefile.am index e5fe7d6..f0d7f03 100644 --- a/fortran/test/Makefile.am +++ b/fortran/test/Makefile.am @@ -100,4 +100,4 @@ H5_test_buildiface_LDADD = fflush2.chkexe_: fflush1.chkexe_ -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am index 00bc3db..e597a84 100644 --- a/fortran/testpar/Makefile.am +++ b/fortran/testpar/Makefile.am @@ -48,4 +48,4 @@ LDADD=$(LIBH5FTEST) $(LIBH5TEST) $(LIBH5F) $(LIBHDF5) # Mark this directory as part of the Fortran API FORTRAN_API=yes -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/hl/fortran/examples/Makefile.am b/hl/fortran/examples/Makefile.am index 71c2866..d383f9a 100644 --- a/hl/fortran/examples/Makefile.am +++ b/hl/fortran/examples/Makefile.am @@ -62,4 +62,4 @@ EXAMPLETOPDIR=${DESTDIR}$(exec_prefix)/share/hdf5_examples/hl # and fortran libraries above. include $(top_srcdir)/config/examples.am -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index f51d595..37e074c 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -114,5 +114,4 @@ H5IMff.lo: $(srcdir)/H5IMff.F90 H5TBff.lo: $(srcdir)/H5TBff.F90 H5LTff_gen.lo: H5LTff.lo H5LTff_gen.F90 H5TBff_gen.lo: H5TBff.lo H5LTff_gen.F90 H5TBff_gen.F90 - -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index ef7cd4b..0552aaa 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -62,4 +62,4 @@ clean-local: # from tests in conclude.am) FORTRAN_API=yes -include $(top_srcdir)/config/conclude.am +include $(top_srcdir)/config/conclude_fc.am -- cgit v0.12 From 0c374d65c65e1c559efe7f81a4620af2d3676f07 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 1 Aug 2019 10:18:45 -0500 Subject: Fix conflicting types for reset_raw_data_files() parameter in external_common.c changed from int to hbool_t. Change 0 and 1 to FALSE and TRUE in calls to reset_raw_data_files(). --- test/external.c | 12 ++++++------ test/external_common.c | 2 +- test/external_env.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/external.c b/test/external.c index 597878f..2a90711 100644 --- a/test/external.c +++ b/test/external.c @@ -636,7 +636,7 @@ test_read_file_set(hid_t fapl) TEST_ERROR /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the file and an initial group. This causes messages about @@ -776,7 +776,7 @@ test_write_file_set(hid_t fapl) } /* end for */ /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -877,7 +877,7 @@ test_path_absolute(hid_t fapl) FAIL_STACK_ERROR /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dcpl */ @@ -973,7 +973,7 @@ test_path_relative(hid_t fapl) FAIL_STACK_ERROR; /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -1068,7 +1068,7 @@ test_path_relative_cwd(hid_t fapl) FAIL_STACK_ERROR; /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the dataset */ @@ -1210,7 +1210,7 @@ test_h5d_get_access_plist(hid_t fapl_id) TEST_ERROR /* Reset the raw data files */ - if(reset_raw_data_files(0) < 0) + if(reset_raw_data_files(FALSE) < 0) TEST_ERROR /* Create the file */ diff --git a/test/external_common.c b/test/external_common.c index c3aa455..c9b6584 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -35,7 +35,7 @@ *------------------------------------------------------------------------- */ herr_t -reset_raw_data_files(int is_env) +reset_raw_data_files(hbool_t is_env) { int fd = 0; /* external file descriptor */ size_t i, j; /* iterators */ diff --git a/test/external_env.c b/test/external_env.c index 8ecebf6..0a96f8e 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -70,7 +70,7 @@ test_path_env(hid_t fapl) FAIL_STACK_ERROR /* Reset the raw data files */ - if(reset_raw_data_files(1) < 0) + if(reset_raw_data_files(TRUE) < 0) TEST_ERROR /* Create the dataset */ -- cgit v0.12 From 4cb865fc5938a303c197aedf46f90021e2f4b3d6 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 1 Aug 2019 11:37:13 -0500 Subject: enabled commented-out code --- testpar/t_file.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/testpar/t_file.c b/testpar/t_file.c index f670034..4ecfc30 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -179,8 +179,6 @@ test_page_buffer_access(void) for(i=0 ; ishared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - ret = H5PB_flush(f, FALSE); + ret = H5PB_flush(f); VRFY((ret == 0), ""); /* read elements 0 - 200 */ @@ -288,7 +286,6 @@ test_page_buffer_access(void) /* Pop API context */ if(api_ctx_pushed) { ret = H5CX_pop(); VRFY((ret == 0), "H5CX_pop()"); api_ctx_pushed = FALSE; } } -#endif MPI_Barrier(MPI_COMM_WORLD); -- cgit v0.12 From c234479258038be93e059a6964bf19332ef162f8 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 2 Aug 2019 09:58:48 -0500 Subject: Update junit.sh.in to copy lib files to $prefix/lib. Correct checking for s3 and hdfs options. --- java/test/junit.sh.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 008c89c..ac09db7 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -15,6 +15,7 @@ top_builddir=@top_builddir@ top_srcdir=@top_srcdir@ srcdir=@srcdir@ +prefix=@prefix@ USE_FILTER_SZIP="@USE_FILTER_SZIP@" USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" @@ -42,7 +43,7 @@ myos=`uname -s` # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" -BLDLIBDIR="$top_builddir/hdf5/lib" +BLDLIBDIR="$prefix/lib" BLDDIR="." HDFTEST_HOME="$top_srcdir/java/test" JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar @@ -1100,7 +1101,7 @@ if test $USE_FILTER_SZIP = "yes"; then test yes = "$verbose" && $DIFF JUnit-TestH5Giterate.txt JUnit-TestH5Giterate.out |sed 's/^/ /' fi fi -if test $ROS3_VFD = "yes"; then +if test "X$ROS3_VFD" = "Xyes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3" TESTING JUnit-TestH5Pfapls3 ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfapls3 > JUnit-TestH5Pfapls3.ext) @@ -1122,7 +1123,7 @@ if test $ROS3_VFD = "yes"; then test yes = "$verbose" && $DIFF JUnit-TestH5Pfapls3.txt JUnit-TestH5Pfapls3.out |sed 's/^/ /' fi fi -if test $HAVE_LIBHDFS = "yes"; then +if test "X$HAVE_LIBHDFS" = "Xyes"; then echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs" TESTING JUnit-TestH5Pfaplhdfs ($RUNSERIAL $JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Pfaplhdfs > JUnit-TestH5Pfaplhdfs.ext) -- cgit v0.12 From 2b1231ddd89dd2f1b59ec9ca1e4e124d7e76f1b5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 3 Aug 2019 11:17:53 -0700 Subject: Moved -Wimplicit-procedure gfortran warning to version 4.5 warnings instead of default. --- config/gnu-fflags | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index d6d0b39..3fc112d 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -128,7 +128,7 @@ if test "X-gfortran" = "X-$f9x_vendor"; then ########### H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" - H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Wcharacter-truncation -Wimplicit-procedure" + H5_FCFLAGS="$H5_FCFLAGS -Waliasing -Wcharacter-truncation" ############################# # Version-specific warnings # @@ -141,7 +141,10 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS -Warray-temporaries -Wintrinsics-std" fi - # gfortran 4.5 (nothing new) + # gfortran 4.5 + if test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 5; then + H5_FCFLAGS="$H5_FCFLAGS -Wimplicit-procedure" + fi # gfortran 4.6 (nothing new) -- cgit v0.12 From 0147a6c713c784f5df9189fc7334c65f54958434 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 3 Aug 2019 17:28:50 -0500 Subject: Fix VFD tests and repack --- c++/test/CMakeVFDTests.cmake | 81 +++++++++++++++------------- test/CMakeVFDTests.cmake | 1 - testpar/CMakeVFDTests.cmake | 69 +++++++++++++----------- tools/test/h5repack/CMakeTests.cmake | 27 +++++----- tools/test/h5repack/CMakeVFDTests.cmake | 96 +++++++++++++++++++++++---------- 5 files changed, 165 insertions(+), 109 deletions(-) diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index b26165a..fcae446 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -15,36 +15,43 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +set (VFD_LIST + sec2 + stdio + core + core_paged + split + multi + family +) + +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") - add_test ( - NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - tattr_basic.h5 - tattr_compound.h5 - tattr_dtype.h5 - tattr_multi.h5 - tattr_scalar.h5 - tfattrs.h5 - titerate.h5 - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} - ) - add_test ( +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + add_test ( + NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + tattr_basic.h5 + tattr_compound.h5 + tattr_dtype.h5 + tattr_multi.h5 + tattr_scalar.h5 + tfattrs.h5 + titerate.h5 + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} + ) + add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -55,13 +62,13 @@ -D "TEST_OUTPUT=${vfdname}-cpp_testhdf5.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) - set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) - endif () - endmacro () + ) + set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects) + set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) +endforeach () diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 27335ad..cf938f5 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -18,7 +18,6 @@ # included from CMakeTEsts.cmake set (VFD_LIST - hdfs sec2 stdio core diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 7db99de..8d131db 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -15,32 +15,33 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) +set (VFD_LIST + sec2 + stdio + core + core_paged + split + multi + family +) - set (H5P_VFD_TESTS - t_pflush1 - t_pflush2 - ) +set (H5P_VFD_TESTS + t_pflush1 + t_pflush2 +) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () foreach (vfdtest ${VFD_LIST}) file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") endforeach () - macro (ADD_VFD_TEST vfdname resultcode) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - foreach (h5_test ${H5P_VFD_TESTS}) - add_test ( +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + foreach (h5_test ${H5P_VFD_TESTS}) + add_test ( NAME MPI_TEST_VFD-${vfdname}-${h5_test} COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" @@ -51,16 +52,22 @@ endforeach () -D "TEST_OUTPUT=${vfdname}-${h5_test}.out" -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES - ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" - WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} - ) - endforeach () - endif () - endmacro () + ) + set_tests_properties (MPI_TEST_VFD-${vfdname}-${h5_test} PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}" + WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname} + ) + endforeach () + endif () +endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## - # Run test with different Virtual File Driver - foreach (h5_vfd ${VFD_LIST}) - ADD_VFD_TEST (${h5_vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (h5_vfd ${VFD_LIST}) + ADD_VFD_TEST (${h5_vfd} 0) +endforeach () diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index cd20f77..a28a282 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -727,6 +727,7 @@ set (FILE15 h5repack_named_dtypes.h5) set (FILE16 tfamily%05d.h5) # located in common testfiles folder set (FILE18 h5repack_layout2.h5) + set (FILE19 h5repack_layout3.h5) set (FILE_REF h5repack_refs.h5) set (FILE_ATTR_REF h5repack_attr_refs.h5) set (FILEV1 1_vds.h5) @@ -869,11 +870,11 @@ set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES PASS_REGULAR_EXPRESSION "no") endif () set_tests_properties (H5REPACK-testh5repack_detect_szip PROPERTIES DEPENDS H5REPACK-clearall-objects) + set (last_test "H5REPACK-testh5repack_detect_szip") - add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) - set (last_test "H5REPACK-h5repacktest") - +# add_test (NAME H5REPACK-h5repacktest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +# set_tests_properties (H5REPACK-h5repacktest PROPERTIES DEPENDS H5REPACK-testh5repack_detect_szip) +# set (last_test "H5REPACK-h5repacktest") # # The tests # We use the files generated by h5repacktst @@ -1194,14 +1195,14 @@ # Use first dset to test. #--------------------------------------------------------------------------- # chunk to chunk - specify chunk dim bigger than any current dim - ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) + ADD_H5_VERIFY_TEST (chunk2chunk "TEST" 0 ${FILE19} chunk_unlimit1 CHUNK -l chunk_unlimit1:CHUNK=100x300) # chunk to contiguous - ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) + ADD_H5_VERIFY_TEST (chunk2conti "TEST" 0 ${FILE19} chunk_unlimit1 CONTI -l chunk_unlimit1:CONTI) # chunk to compact - convert big dataset (should be > 64k) for this purpose, # should remain as original layout (chunk) - ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) + ADD_H5_VERIFY_TEST (chunk2compa "TEST" 0 ${FILE19} chunk_unlimit1 CHUNK -l chunk_unlimit1:COMPA) #-------------------------------------------------------------------------- # Test -f for some specific cases. Chunked dataset with unlimited max dims. @@ -1211,16 +1212,16 @@ # - should not change max dims from unlimit # chunk dim is bigger than dataset dim. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error1 "TEST" 0 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE) + ADD_H5_VERIFY_TEST (error1 "TEST" 0 ${FILE19} chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE) # chunk dim is bigger than dataset dim. ( dset size > 64k ) - ADD_H5_VERIFY_TEST (error2 "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE) + ADD_H5_VERIFY_TEST (error2 "TEST" 0 ${FILE19} chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE) # chunk dims are smaller than dataset dims. ( dset size < 64k ) - ADD_H5_VERIFY_TEST (error3 "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE) + ADD_H5_VERIFY_TEST (error3 "TEST" 0 ${FILE19} chunk_unlimit3 H5S_UNLIMITED -f chunk_unlimit3:NONE) # file input - should not fail - ADD_H5_TEST (error4 "TEST" h5repack_layout3.h5 -f NONE) + ADD_H5_TEST (error4 "TEST" ${FILE19} -f NONE) #-------------------------------------------------------------------------- # Test base: Convert CHUNK to CONTI for a chunked dataset with small dataset @@ -1228,9 +1229,9 @@ # (HDFFV-8214) #-------------------------------------------------------------------------- # chunk dim is bigger than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) + ADD_H5_VERIFY_TEST (ckdim_biger "TEST" 0 ${FILE19} chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI) # chunk dim is smaller than dataset dim. should succeed. - ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 h5repack_layout3.h5 chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) + ADD_H5_VERIFY_TEST (ckdim_smaller "TEST" 0 ${FILE19} chunk_unlimit3 CONTI -l chunk_unlimit3:CONTI) diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index f88f147..c1a280b 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -16,18 +16,19 @@ ############################################################################## ############################################################################## - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) +set (VFD_LIST + sec2 + stdio + core + core_paged + split + multi + family +) - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () +if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) +endif () ############################################################################## ############################################################################## @@ -35,20 +36,61 @@ ############################################################################## ############################################################################## - macro (ADD_VFD_TEST vfdname resultcode) +macro (ADD_VFD_TEST vfdname resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + add_test ( + NAME H5REPACK-${vfdname}-h5repacktest-clear-objects + COMMAND ${CMAKE_COMMAND} -E remove + bounds_latest_latest.h5 + h5repack_attr.h5 + h5repack_attr_refs.h5 + h5repack_deflate.h5 + h5repack_early.h5 + h5repack_ext.h5 + h5repack_fill.h5 + h5repack_filters.h5 + h5repack_fletcher.h5 + h5repack_hlink.h5 + h5repack_layout.h5 + h5repack_layouto.h5 + h5repack_layout2.h5 + h5repack_layout3.h5 + h5repack_layout.UD.h5 + h5repack_named_dtypes.h5 + h5repack_nested_8bit_enum.h5 + h5repack_nested_8bit_enum_deflated.h5 + h5repack_nbit.h5 + h5repack_objs.h5 + h5repack_refs.h5 + h5repack_shuffle.h5 + h5repack_soffset.h5 + h5repack_szip.h5 + # fsm + h5repack_aggr.h5 + h5repack_fsm_aggr_nopersist.h5 + h5repack_fsm_aggr_persist.h5 + h5repack_none.h5 + h5repack_paged_nopersist.h5 + h5repack_paged_persist.h5 + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${vfdname} + ) add_test ( - NAME H5REPACK-VFD-${vfdname}-h5repacktest - COMMAND "${CMAKE_COMMAND}" - -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=h5repacktest" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + NAME H5REPACK_VFD-${vfdname}-h5repacktest + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${vfdname}-h5repacktest.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" ) - endmacro () + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS H5REPACK_VFD-${vfdname}-h5repacktest-clear-objects) + set_tests_properties (H5REPACK_VFD-${vfdname}-h5repacktest PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () ############################################################################## ############################################################################## @@ -56,7 +98,7 @@ ############################################################################## ############################################################################## - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach () +# Run test with different Virtual File Driver +foreach (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) +endforeach () -- cgit v0.12 From 4cd461168ef6dbd799792b1893c41dccebae59f9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 4 Aug 2019 09:12:43 -0700 Subject: Fixed warning typo --- config/cmake/HDFCompilerFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index d658c48..aea417a 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -210,7 +210,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 9.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} Wattribute-alias=2 -Wmissing-profile") + set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias=2 -Wmissing-profile") endif () endif () -- cgit v0.12 From c60ceb8c08b6c5472bd79ebf2464b2409a398919 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 4 Aug 2019 15:19:04 -0500 Subject: Merge reconciliation and VFD test fixes --- MANIFEST | 1 + examples/h5_extend_write.c | 6 +- test/cache_image.c | 6 +- test/dsets.c | 519 +++++++++++++++++----------------- test/error_test.c | 54 ++-- test/flush2.c | 8 +- test/gheap.c | 26 +- test/h5test.c | 2 - test/mf.c | 1 - tools/src/h5dump/h5dump.c | 1 - tools/src/h5ls/h5ls.c | 1 - tools/src/h5stat/h5stat.c | 13 +- tools/test/h5dump/CMakeTests.cmake | 10 + tools/test/h5dump/CMakeVFDTests.cmake | 91 ++++++ tools/test/h5dump/h5dumpgentest.c | 12 +- tools/test/misc/CMakeLists.txt | 18 +- 16 files changed, 438 insertions(+), 331 deletions(-) create mode 100644 tools/test/h5dump/CMakeVFDTests.cmake diff --git a/MANIFEST b/MANIFEST index 594f4bc..83c03a5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3393,6 +3393,7 @@ ./tools/test/h5dump/CMakeTestsPBITS.cmake ./tools/test/h5dump/CMakeTestsXML.cmake ./tools/test/h5dump/CMakeTestsVDS.cmake +./tools/test/h5dump/CMakeVFDTests.cmake ./tools/src/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeTests.cmake diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index f3f6077..4abda30 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -163,9 +163,9 @@ main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 * 2 0 0 0 0 * 2 0 0 0 0 * 2 0 0 0 0 diff --git a/test/cache_image.c b/test/cache_image.c index f8252ac..9150836 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -93,7 +93,6 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd); #define DSET_SIZE (40 * CHUNK_SIZE) #define MAX_NUM_DSETS 256 - static void create_datasets(hid_t file_id, int min_dset, int max_dset) { @@ -4486,7 +4485,6 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) if ( show_progress ) HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass); - } /* end while */ cp += 3; @@ -5111,8 +5109,8 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) * extension message has been deleted. */ i = min_group; - while ( ( pass ) && ( i <= max_group ) ) { - sprintf(process_group_name, "/process_%d", i); + while ( ( pass ) && ( i <= max_group ) ) { + sprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } diff --git a/test/dsets.c b/test/dsets.c index 5976df5..50a6907 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -88,7 +88,6 @@ const char *FILENAME[] = { #define OHMIN_FILENAME_A "ohdr_min_a" - #define FILENAME_BUF_SIZE 1024 #define KB 1024 @@ -401,7 +400,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -423,7 +422,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -445,7 +444,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -566,8 +565,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -590,8 +589,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -605,7 +604,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return SUCCEED; @@ -699,8 +698,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -713,7 +712,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return SUCCEED; @@ -814,10 +813,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -872,10 +871,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -1013,8 +1012,8 @@ test_max_compact(hid_t fapl) for(u = 0; u < compact_size; u++) if(rbuf[u] != wbuf[u]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)u); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)u); goto error; } /* end if */ @@ -1313,7 +1312,7 @@ test_conv_buffer(hid_t fid) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Library shouldn't allow conversion buffer too small"); + HDputs(" Library shouldn't allow conversion buffer too small"); goto error; } @@ -1338,7 +1337,7 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); - puts(" PASSED"); + HDputs(" PASSED"); return SUCCEED; error: @@ -1415,7 +1414,7 @@ test_tconv(hid_t file) in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) { H5_FAILED(); - puts(" Read with byte order conversion failed."); + HDputs(" Read with byte order conversion failed."); goto error; } } @@ -1425,7 +1424,7 @@ test_tconv(hid_t file) HDfree(out); HDfree(in); - puts(" PASSED"); + HDputs(" PASSED"); return SUCCEED; error: @@ -1771,7 +1770,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Check if all the filters are available */ if(H5Pall_filters_avail(dcpl)!=TRUE) { H5_FAILED(); - printf(" Line %d: Incorrect filter availability\n",__LINE__); + HDprintf(" Line %d: Incorrect filter availability\n",__LINE__); goto error; } /* end if */ @@ -1794,8 +1793,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j<(size_t)size[1]; j++) { if(0!=check[i][j]) { H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read a non-zero value.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -1860,10 +1859,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4931,8 +4930,8 @@ test_scaleoffset_float_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5042,8 +5041,8 @@ test_scaleoffset_double(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -5173,8 +5172,8 @@ test_scaleoffset_double_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5240,7 +5239,7 @@ test_multiopen (hid_t file) if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error; if(cur_size[0] != tmp_size[0]) { H5_FAILED(); - printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); + HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; } /* end if */ @@ -5402,30 +5401,30 @@ test_can_apply(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is mandate. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ @@ -5437,7 +5436,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5448,7 +5447,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5456,42 +5455,42 @@ test_can_apply(hid_t file) /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5501,10 +5500,10 @@ test_can_apply(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5513,21 +5512,21 @@ test_can_apply(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5585,72 +5584,72 @@ test_can_apply2(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is optional. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5660,10 +5659,10 @@ test_can_apply2(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5672,21 +5671,21 @@ test_can_apply2(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5742,19 +5741,19 @@ file) /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5765,7 +5764,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5776,7 +5775,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5784,7 +5783,7 @@ file) szip_pixels_per_block=2; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5796,47 +5795,47 @@ file) } H5E_END_TRY; if(dsid <=0) { H5_FAILED(); - printf(" Line %d: Should have created dataset!\n",__LINE__); + HDprintf(" Line %d: Should have created dataset!\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ /* Create another data space */ if((sid = H5Screate_simple(2, dims2, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5844,7 +5843,7 @@ file) szip_pixels_per_block=32; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5855,7 +5854,7 @@ file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5863,14 +5862,14 @@ file) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5878,11 +5877,11 @@ file) PASSED(); } else { SKIPPED(); - puts(" Szip encoding is not enabled."); + HDputs(" Szip encoding is not enabled."); } #else /* H5_HAVE_FILTER_SZIP */ SKIPPED(); - puts(" Szip filter is not enabled."); + HDputs(" Szip filter is not enabled."); #endif /* H5_HAVE_FILTER_SZIP */ return SUCCEED; @@ -5948,57 +5947,57 @@ test_set_local(hid_t fapl) /* Open file */ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + HDprintf(" Line %d: Can't open file\n",__LINE__); goto error; } /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'set local' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus2 filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ @@ -6006,77 +6005,77 @@ test_set_local(hid_t fapl) /* (Shouldn't get modified by output filter) */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n", __LINE__); + HDprintf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n", __LINE__); + HDprintf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n", __LINE__); + HDprintf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n", __LINE__); + HDprintf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n", __LINE__); + HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -6086,10 +6085,10 @@ test_set_local(hid_t fapl) for(j=0; j=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6468,7 +6467,7 @@ test_filter_delete(hid_t file) } H5E_END_TRY; if(ret >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6566,7 +6565,7 @@ auxread_fdata(hid_t fid, const char *name) if(nelmts) { buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); goto error; } if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -6965,13 +6964,13 @@ test_missing_chunk(hid_t file) for(u=0; u=5) { if(rdata[u]!=911) { - printf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata[u]!=wdata[u]) { - printf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end else */ @@ -6983,14 +6982,14 @@ test_missing_chunk(hid_t file) if((i % 10) >= 5 || (j % 10) >= 5) { if(rdata2[i][j] != 911) { - printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata2[i][j] != wdata2[i][j]) { - printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ @@ -7154,8 +7153,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - printf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); TEST_ERROR; } /* end if */ @@ -7261,7 +7260,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7367,7 +7366,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7508,7 +7507,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -7529,7 +7528,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -7578,7 +7577,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -7630,7 +7629,7 @@ test_deprec(hid_t file) if(H5Zregister(H5Z_DEPREC) < 0) goto error; if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; - puts(""); + HDputs(""); if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -8130,15 +8129,15 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the first 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata1[i] != i) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); TEST_ERROR } /* end if */ for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(rdata1[j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); TEST_ERROR } /* end if */ @@ -8146,8 +8145,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata1[i][j] != j) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], j); TEST_ERROR } /* end if */ @@ -8155,8 +8154,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8202,8 +8201,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the second 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata2[i] != i) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); TEST_ERROR } /* end if */ @@ -8211,8 +8210,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata2[i][j] != j) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", __LINE__, i, j, t_rdata2[i][j], j); TEST_ERROR } /* end if */ @@ -8941,7 +8940,7 @@ test_chunk_expand(hid_t fapl) if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) { SKIPPED(); - puts(" Current machine can't test for error w/old file format"); + HDputs(" Current machine can't test for error w/old file format"); } /* end if */ else { /* Register "expansion" filter */ @@ -9604,7 +9603,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9632,7 +9631,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9658,7 +9657,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS_BIG; i++) if(rbuf_big[i] != wbuf_big[i]) { - printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); TEST_ERROR; } /* end if */ @@ -9897,7 +9896,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9916,7 +9915,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) if(t_rbuf[i] != t_wbuf[i]) { - printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); TEST_ERROR; } /* end if */ @@ -11518,7 +11517,7 @@ typedef struct scatter_info_t { for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \ if(ARR[i][j][k] != EXP[i][j][k]) { \ H5_FAILED(); AT(); \ - printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ + HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ goto error; \ } @@ -13079,10 +13078,12 @@ test_object_header_minimization_dcpl(void) TEST_ERROR file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (0 > file_id) TEST_ERROR + if (file_id == H5I_INVALID_HID) + TEST_ERROR dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - if (0 > dcpl_id) TEST_ERROR + if (dcpl_id == H5I_INVALID_HID) + TEST_ERROR /*********/ /* TESTS */ @@ -13249,20 +13250,20 @@ main(void) my_fapl = fapl2; if(paged) { my_fcpl = fcpl2; - puts("\nTesting with new file format and paged aggregation"); + HDputs("\nTesting with new file format and paged aggregation"); } else { my_fcpl = fcpl; - puts("\nTesting with new file format and non-paged aggregation"); + HDputs("\nTesting with new file format and non-paged aggregation"); } } /* end if */ else { my_fapl = fapl; if(paged) { my_fcpl = fcpl2; - puts("Testing with old file format and paged aggregation:"); + HDputs("Testing with old file format and paged aggregation:"); } else { my_fcpl = fcpl; - puts("Testing with old file format and non-paged aggregation:"); + HDputs("Testing with old file format and non-paged aggregation:"); } } /* end else */ @@ -13273,7 +13274,7 @@ main(void) if (TRUE == minimized_ohdr) { if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) goto error; - puts("(minimized dataset object headers with file setting)"); + HDputs("(minimized dataset object headers with file setting)"); } /* Cause the library to emit initial messages */ @@ -13380,7 +13381,7 @@ main(void) if(nerrors) goto error; - printf("All dataset tests passed.\n"); + HDprintf("All dataset tests passed.\n"); #ifdef H5_HAVE_FILTER_SZIP if (GetTestCleanup()) HDremove(NOENCODER_COPY_FILENAME); @@ -13391,7 +13392,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/error_test.c b/test/error_test.c index 44f6210..1de9065 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests the error API routines. + * Purpose: Tests the error API routines. */ #include "h5test.h" #include "H5srcdir.h" @@ -23,7 +23,7 @@ #ifdef H5_USE_16_API int main(void) { - HDfprintf(stderr, "Test skipped because backward compatbility with v1.6 is configured in\n"); + HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n"); return 0; } #else /* H5_USE_16_API */ @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -80,7 +80,7 @@ hid_t ERR_MIN_GETNUM; static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); - + /*------------------------------------------------------------------------- * Function: test_error * @@ -94,10 +94,10 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, static herr_t test_error(hid_t file) { - hid_t dataset = -1; + hid_t dataset = -1; hid_t space = -1; hid_t estack_id = -1; - hsize_t dims[2]; + hsize_t dims[2]; const char *FUNC_test_error = "test_error"; H5E_auto2_t old_func; void *old_data = NULL; @@ -169,7 +169,7 @@ test_error(hid_t file) return -1; } /* end test_error() */ - + /*------------------------------------------------------------------------- * Function: init_error * @@ -245,7 +245,7 @@ error: return -1; } /* end init_error() */ - + /*------------------------------------------------------------------------- * Function: error_stack * @@ -287,7 +287,7 @@ error: return -1; } /* end error_stack() */ - + /*------------------------------------------------------------------------- * Function: long_desc_cb * @@ -309,7 +309,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie return -1; } /* end long_desc_cb() */ - + /*------------------------------------------------------------------------- * Function: test_long_desc * @@ -384,7 +384,7 @@ error: } /* end test_long_desc() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: dump_error * @@ -414,7 +414,7 @@ error: return -1; } /* end dump_error() */ - + /*------------------------------------------------------------------------- * Function: custom_print_cb * @@ -445,8 +445,8 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data) TEST_ERROR; HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls); HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -457,7 +457,7 @@ error: return -1; } /* end custom_print_cb() */ - + /*------------------------------------------------------------------------- * Function: test_create * @@ -540,11 +540,11 @@ test_copy(void) err_num = H5Eget_num(H5E_DEFAULT); if (err_num != 1) TEST_ERROR - + /* Copy error stack, which clears the original */ if ((estack_id = H5Eget_current_stack()) < 0) TEST_ERROR - + /* Check the number of errors on stack copy */ err_num = H5Eget_num(estack_id); if (err_num != 1) @@ -564,7 +564,7 @@ test_copy(void) if (err_num != 1) TEST_ERROR - /* Try to close error stack copy. Should fail because + /* Try to close error stack copy. Should fail because * the current H5Eset_current_stack closes the stack to be set. */ H5E_BEGIN_TRY { @@ -579,7 +579,7 @@ error: return -1; } /* end test_copy() */ - + /*------------------------------------------------------------------------- * Function: close_error * @@ -615,17 +615,17 @@ error: return -1; } /* end close_error() */ - + /*------------------------------------------------------------------------- * Function: test_filter_error * * Purpose: Make sure the error message prints out the filter name - * when the existent file is opened but the filter isn't - * registered. The existent file was created with - * gen_filters.c. + * when the existent file is opened but the filter isn't + * registered. The existent file was created with + * gen_filters.c. * * Return: Success: 0 - * Failure: -1 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -663,7 +663,7 @@ error: return -1; } /* end test_filter_error() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -745,7 +745,7 @@ main(void) if (close_error() < 0) TEST_ERROR; - /* Test error message during data reading when filter isn't registered + /* Test error message during data reading when filter isn't registered * Use default FAPL to avoid some VFD drivers by the check-vfd test because * the test file was pre-generated. */ diff --git a/test/flush2.c b/test/flush2.c index 8ebfb75..0f15903 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Purpose: This is the second half of a two-part test that makes sure - * that a file can be read after an application crashes as long - * as the file was flushed first. This half tries to read the - * file created by the first half. + * Purpose: This is the second half of a two-part test that makes sure + * that a file can be read after an application crashes as long + * as the file was flushed first. This half tries to read the + * file created by the first half. */ #include "h5test.h" diff --git a/test/gheap.c b/test/gheap.c index 5b51c0e..09ba1cf 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -57,7 +57,7 @@ const char *FILENAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_1 * @@ -68,7 +68,7 @@ const char *FILENAME[] = { * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -165,7 +165,7 @@ error: return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_2 * @@ -176,7 +176,7 @@ error: * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -264,7 +264,7 @@ test_2 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_3 * @@ -275,7 +275,7 @@ test_2 (hid_t fapl) * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -353,7 +353,7 @@ test_3 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_4 * @@ -365,7 +365,7 @@ test_3 (hid_t fapl) * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -448,7 +448,7 @@ test_4 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_ooo_indices * @@ -461,7 +461,7 @@ test_4 (hid_t fapl) * * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * *------------------------------------------------------------------------- @@ -566,7 +566,7 @@ test_ooo_indices(hid_t fapl) return MAX(1, nerrors); } /* end test_ooo_indices */ - + /*------------------------------------------------------------------------- * Function: main * @@ -579,8 +579,8 @@ test_ooo_indices(hid_t fapl) int main (void) { - int nerrors = 0; - hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); diff --git a/test/h5test.c b/test/h5test.c index d83c6e7..707c436 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -110,7 +110,6 @@ const char *LIBVER_NAMES[] = { NULL }; - /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; @@ -1983,7 +1982,6 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ - /*------------------------------------------------------------------------- * Function: h5_get_dummy_vol_class() * diff --git a/test/mf.c b/test/mf.c index 8c17df5..fe98000 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6916,7 +6916,6 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5FD_mem_t fs_type; hbool_t contig_addr_vfd; - if(new_format) TESTING("File's free-space is going away with new library format") else diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a824197..347c189 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1898,4 +1898,3 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) HDstrcat(HDstrcat(*prfx, "/"), name); } /* end add_prefix */ - diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index c81da1e..2364f23 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -247,7 +247,6 @@ usage (void) } - /*------------------------------------------------------------------------- * Function: print_string * diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 59038a0..5f0452c 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -74,14 +74,14 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ unsigned max_dset_rank; /* Maximum rank of dataset */ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */ hsize_t max_dset_dims; /* Maximum dimension size of dataset */ - unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ + unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ @@ -320,9 +320,9 @@ static void usage(const char *prog) HDfprintf(stdout, " -s, --freespace Print free space information\n"); HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); - HDfprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n"); - HDfprintf(stdout, " :: (region,id,key)\n"); - HDfprintf(stdout, " If == \"(,,)\", no authentication is used.\n"); + HDfprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n"); + HDfprintf(stdout, " :: (region,id,key)\n"); + HDfprintf(stdout, " If == \"(,,)\", no authentication is used.\n"); HDfprintf(stdout, " --hdfs-attrs= Access a file on HDFS with given configuration\n"); HDfprintf(stdout, " attributes.\n"); HDfprintf(stdout, " :: (,,\n"); @@ -544,7 +544,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); /* Get storage info */ - storage = H5Dget_storage_size(did); + if((storage = H5Dget_storage_size(did)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed"); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 84016f9..6299821 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -1157,3 +1157,13 @@ if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) endif () + +############################################################################## +############################################################################## +### V F D T E S T S ### +############################################################################## +############################################################################## + +if (HDF5_TEST_VFD) + include (CMakeVFDTests.cmake) +endif () diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake new file mode 100644 index 0000000..0a345ef --- /dev/null +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -0,0 +1,91 @@ +# +# 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 COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +set (VFD_H5DUMP_LIST + sec2 + stdio + core + core_paged + split + multi + family +) + +if (DIRECT_VFD) + set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct) +endif () + +# -------------------------------------------------------------------- +# Copy all the HDF5 files from the source directory into the test directory +# -------------------------------------------------------------------- +set (HDF5_VFD_H5DUMP_FILES + packedbits +) + +foreach (vfdtest ${VFD_H5DUMP_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + foreach (h5_tfile ${HDF5_VFD_H5DUMP_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.h5" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.h5" "HDF5_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.ddl" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.ddl" "HDF5_VFD_H5DUMP_files") + endforeach () +endforeach () + +add_custom_target(HDF5_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_VFD_H5DUMP tests" DEPENDS ${HDF5_VFD_H5DUMP_files_list}) + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + +if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") +else () + set (tgt_ext "-shared") +endif () + +macro (ADD_VFD_H5DUMP_TEST vfdname resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5DUMP_VFD-${vfdname}-${resultfile}-h5dump + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (H5DUMP_VFD-${vfdname}-${resultfile}-h5dump PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# Run test with different Virtual File Driver +foreach (vfd ${VFD_H5DUMP_LIST}) + # test for signed/unsigned datasets + ADD_VFD_H5DUMP_TEST (${vfd} packedbits 0 --enable-error-stack packedbits.h5) +endforeach () diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 3a414d1..699a226 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1941,7 +1941,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1954,7 +1954,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1974,7 +1974,7 @@ static void gent_str2(void) for(i = 0;(hsize_t) i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1988,7 +1988,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2007,7 +2007,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of", i); + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2021,7 +2021,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 3d63681..a250222 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -7,15 +7,25 @@ project (HDF5_TOOLS_TEST_MISC C) if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5repart_gentest STATIC) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5repart_gentest SHARED) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5clear_gentest STATIC) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5clear_gentest SHARED) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -- cgit v0.12 From 9f12d8397515bdc448a1cd605d4d605e07940ca0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Aug 2019 16:57:27 -0500 Subject: Cleanup HD prefix --- test/objcopy.c | 26 +- test/ohdr.c | 4 +- test/set_extent.c | 1436 ++++++++++++++++++++--------------------------------- 3 files changed, 557 insertions(+), 909 deletions(-) diff --git a/test/objcopy.c b/test/objcopy.c index 94a2b36..47a1065 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -14113,7 +14113,7 @@ main(void) ExpressMode = GetTestExpress(); if (ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Copy the file access property list */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR @@ -14149,52 +14149,52 @@ main(void) /* Test with and without shared messages */ if(configuration & CONFIG_SHARE_SRC) { - puts("\nTesting with shared src messages:"); + HDputs("\nTesting with shared src messages:"); fcpl_src = fcpl_shared; } else { - puts("\nTesting without shared src messages:"); + HDputs("\nTesting without shared src messages:"); fcpl_src = H5P_DEFAULT; } if(configuration & CONFIG_SHARE_DST) { - puts("Testing with shared dst messages:"); + HDputs("Testing with shared dst messages:"); fcpl_dst = fcpl_shared; same_file = FALSE; } else { - puts("Testing without shared dst messages:"); + HDputs("Testing without shared dst messages:"); fcpl_dst = H5P_DEFAULT; } /* Set the FAPL for the source file's type of format */ if(configuration & CONFIG_SRC_NEW_FORMAT) { - puts("Testing with latest format for source file:"); + HDputs("Testing with latest format for source file:"); src_fapl = fapl2; /* Test with and without dense attributes */ if(configuration & CONFIG_DENSE) { - puts("Testing with dense attributes:"); + HDputs("Testing with dense attributes:"); num_attributes_g = max_compact + 1; } else { - puts("Testing without dense attributes:"); + HDputs("Testing without dense attributes:"); num_attributes_g = MAX(min_dense, 2) - 2; } } /* end if */ else { - puts("Testing with oldest file format for source file:"); + HDputs("Testing with oldest file format for source file:"); src_fapl = fapl; num_attributes_g = 4; } /* end else */ /* Set the FAPL for the destination file's type of format */ if(configuration & CONFIG_DST_NEW_FORMAT) { - puts("Testing with latest format for destination file:"); + HDputs("Testing with latest format for destination file:"); dst_fapl = fapl2; same_file = FALSE; } /* end if */ else { - puts("Testing with oldest file format for destination file:"); + HDputs("Testing with oldest file format for destination file:"); dst_fapl = fapl; } /* end else */ @@ -14365,12 +14365,12 @@ main(void) /* Results */ if(nerrors) { - printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", + HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n", nerrors, (1 == nerrors ? "" : "S")); exit(EXIT_FAILURE); } /* end if */ - puts ("All object copying tests passed."); + HDputs ("All object copying tests passed."); /* close property list. * NOTE: if this property list is not closed and the test is diff --git a/test/ohdr.c b/test/ohdr.c index c5d5ac4..13bac9e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1641,7 +1641,7 @@ main(void) /* Display info about testing */ low_string = h5_get_version_string(low); high_string = h5_get_version_string(high); - sprintf(msg, "Using file format version: (%s, %s)", low_string, + HDsprintf(msg, "Using file format version: (%s, %s)", low_string, high_string); HDputs(msg); @@ -1887,7 +1887,7 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; diff --git a/test/set_extent.c b/test/set_extent.c index f6b02cf..20322a3 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -49,13 +49,13 @@ const char *FILENAME[] = { + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE) #define FILL_VALUE -1 #define DO_RANKS_PRINT_CONFIG(TEST) { \ - printf(" Config:\n"); \ - printf(" Test: %s\n", TEST); \ - printf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \ - printf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \ - printf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" \ + HDprintf(" Config:\n"); \ + HDprintf(" Test: %s\n", TEST); \ + HDprintf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \ + HDprintf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \ + HDprintf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" \ : "no")); \ - printf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE \ + HDprintf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE \ ? "disabled" : "enabled")); \ } /* end DO_RANKS_PRINT_CONFIG */ @@ -136,8 +136,8 @@ int main( void ) hid_t fapl2; /* file access property list w/latest format set */ unsigned new_format; /* Whether to use the latest file format */ unsigned chunk_cache; /* Whether to enable chunk caching */ - int nerrors = 0; - const char *env_h5_drvr; /* File Driver value from environment */ + int nerrors = 0; + const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -173,17 +173,17 @@ int main( void ) for(chunk_cache = FALSE; chunk_cache <= TRUE; chunk_cache++) { /* Output message about the type of format */ if(new_format) - printf("Testing with new file format"); + HDprintf("Testing with new file format"); else - printf("Testing with old file format"); + HDprintf("Testing with old file format"); /* Set the FAPL for the chunk cache settings */ if(chunk_cache) { - puts(" and chunk cache enabled:"); + HDputs(" and chunk cache enabled:"); my_fapl = fapl; } /* end if */ else { - puts(" and chunk cache disabled:"); + HDputs(" and chunk cache disabled:"); my_fapl = fapl2; } /* end else */ @@ -201,15 +201,15 @@ int main( void ) H5F_LIBVER_LATEST) < 0) TEST_ERROR /* Tests which use chunked datasets */ - if(!new_format || (new_format && contig_addr_vfd)) - nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0; + if(!new_format || (new_format && contig_addr_vfd)) + nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0; } /* end for */ /* Tests which do not use chunked datasets */ - if(!new_format || (new_format && contig_addr_vfd)) { - nerrors += test_external( fapl ) < 0 ? 1 : 0; - nerrors += do_layouts( fapl ) < 0 ? 1 : 0; - } + if(!new_format || (new_format && contig_addr_vfd)) { + nerrors += test_external( fapl ) < 0 ? 1 : 0; + nerrors += do_layouts( fapl ) < 0 ? 1 : 0; + } } /* end for */ /* Close 2nd FAPL */ @@ -225,13 +225,13 @@ int main( void ) if(nerrors) goto error; - puts("All H5Dset_extent tests passed."); + HDputs("All H5Dset_extent tests passed."); return 0; error: nerrors = MAX(1, nerrors); - printf("***** %d H5Dset_extent TEST%s FAILED! *****\n", + HDprintf("***** %d H5Dset_extent TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -303,25 +303,25 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 1") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 2") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 3") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ @@ -362,7 +362,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) /* Standard test */ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -372,7 +372,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -383,7 +383,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -391,7 +391,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -558,10 +558,10 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n buf_o: "); + HDprintf("\n buf_o: "); for (i = 0; i < (int)dims_o[0]; i++ ) - printf("%d ", buf_o[i]); - printf("\n"); + HDprintf("%d ", buf_o[i]); + HDprintf("\n"); #endif if(H5Sclose(sid) < 0) @@ -598,18 +598,18 @@ static int test_rank1( hid_t fapl, #if defined (H5_SET_EXTENT_DEBUG) - printf("\n buf_e: "); + HDprintf("\n buf_e: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_e[i]); - printf("\n"); + HDprintf("%d ", buf_e[i]); + HDprintf("\n"); #endif /* compare the read array with the expanded array */ for (i = 0; i < (int)dims_r[0]; i++ ) if(i >= DIM0) { if(buf_e[i] != comp_value) { - printf("buf_e[%d] = %d\n", i, buf_e[i]); - printf("expected = %d\n", comp_value); + HDprintf("buf_e[%d] = %d\n", i, buf_e[i]); + HDprintf("expected = %d\n", comp_value); TEST_ERROR } /* end if */ } /* end if */ @@ -670,17 +670,17 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n dims_r: "); + HDprintf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_s[i]); - printf("\n"); + HDprintf("%d ", buf_s[i]); + HDprintf("\n"); #endif /* compare the read array with the shrinked array */ for( i = 0; i < (int)dims_r[0]; i++ ) if(buf_s[i] != buf_o[i]) { - printf("buf_s[%d] = %d\n", i, buf_s[i]); - printf("buf_o[%d] = %d\n", i, buf_o[i]); + HDprintf("buf_s[%d] = %d\n", i, buf_s[i]); + HDprintf("buf_o[%d] = %d\n", i, buf_o[i]); TEST_ERROR } /* end if */ @@ -714,18 +714,18 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n dims_r: "); + HDprintf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_r[i]); - printf("\n"); + HDprintf("%d ", buf_r[i]); + HDprintf("\n"); #endif /* compare the read array with the original array */ for(i = 0; i < (int)dims_r[0]; i++ ) if(i >= DIMS0 ) { if(buf_r[i] != comp_value) { - printf("buf_r[%d] = %d\n", i, buf_r[i] ); - printf("expected = %d\n", comp_value); + HDprintf("buf_r[%d] = %d\n", i, buf_r[i] ); + HDprintf("expected = %d\n", comp_value); TEST_ERROR } /* end if */ } /* end if */ @@ -820,61 +820,47 @@ error: *------------------------------------------------------------------------- */ -static int test_rank2( hid_t fapl, - hid_t dcpl, - hbool_t do_fill_value, - hbool_t disable_edge_filters, - hbool_t set_istore_k) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t my_dcpl=-1; - hid_t fcpl; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */ - hsize_t dims_c[RANK2] = {2,2}; /* chunk dimensions */ - hsize_t dims_r[RANK2]; /* read dimensions */ - hsize_t maxdims[RANK2] = {H5S_UNLIMITED,H5S_UNLIMITED}; - int buf_o[DIM0][DIM1]; - int buf_s[DIMS0][DIMS1]; - int buf_e[DIME0][DIME1]; - int buf_r[DIM0][DIM1]; - int i, j; - int comp_value; - char filename[NAME_BUF_SIZE]; - - if ( do_fill_value ) - { +static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t my_dcpl = -1; + hid_t fcpl; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */ + hsize_t dims_c[RANK2] = { 2, 2 }; /* chunk dimensions */ + hsize_t dims_r[RANK2]; /* read dimensions */ + hsize_t maxdims[RANK2] = { H5S_UNLIMITED, H5S_UNLIMITED }; + int buf_o[DIM0][DIM1]; + int buf_s[DIMS0][DIMS1]; + int buf_e[DIME0][DIME1]; + int buf_r[DIM0][DIM1]; + int i, j; + int comp_value; + char filename[NAME_BUF_SIZE]; + + if (do_fill_value) { comp_value = FILL_VALUE; - } - else - { + } else { comp_value = 0; } - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { TEST_ERROR } - if ( set_istore_k ) - { + if (set_istore_k) { /* set non-default indexed storage B-tree internal 'K' value */ - if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0) - { + if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) { TEST_ERROR } @@ -882,79 +868,65 @@ static int test_rank2( hid_t fapl, /* create a new file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { TEST_ERROR } - - /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) { TEST_ERROR } /* modify dataset creation properties, i.e. enable chunking. */ - if ((my_dcpl = H5Pcopy (dcpl)) < 0) - { + if ((my_dcpl = H5Pcopy(dcpl)) < 0) { TEST_ERROR } - if (H5Pset_chunk(my_dcpl, RANK2, dims_c) < 0) - { + if (H5Pset_chunk(my_dcpl, RANK2, dims_c) < 0) { TEST_ERROR } - if(disable_edge_filters) - if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) + if (disable_edge_filters) + if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR - /*------------------------------------------------------------------------- - * Procedure 1 - * a. Write an array AxB. These are the dimensions for creating the dataset - * b. Define a greater array CxD where C > A and D > B - * c. Read data back - * d. Verify if new dimensions are C and D - * e. Verify if data from A to C and B to D is what it is to be expected - * - * original data is - * - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * - *------------------------------------------------------------------------- - */ - - /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + /*------------------------------------------------------------------------- + * Procedure 1 + * a. Write an array AxB. These are the dimensions for creating the dataset + * b. Define a greater array CxD where C > A and D > B + * c. Read data back + * d. Verify if new dimensions are C and D + * e. Verify if data from A to C and B to D is what it is to be expected + * + * original data is + * + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * + *------------------------------------------------------------------------- + */ + + /* create a dataset */ + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_o[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_o[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -974,32 +946,26 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) - { + if (H5Dset_extent(did, dims_e) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -1008,55 +974,39 @@ static int test_rank2( hid_t fapl, if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_e[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_e[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if ( i >= DIM0 || j >= DIM1 ) - { - if(buf_e[i][j] != comp_value) - { - printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIM0 || j >= DIM1) { + if (buf_e[i][j] != comp_value) { + HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j] != buf_o[i][j]) + } else { + if (buf_e[i][j] != buf_o[i][j]) TEST_ERROR } } } - - - /*------------------------------------------------------------------------- * * Procedure 2 - * a. Define a smaller array ExF where E < A and F < B - * b. Read data back - * c. Verify if new dimensions are E and F - * d. Verify if data up until E and F is what to be expected + * a. Define a smaller array ExF where E < A and F < B + * b. Read data back + * c. Verify if new dimensions are E and F + * d. Verify if data up until E and F is what to be expected * * data is now * @@ -1067,106 +1017,81 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /* for this case we close and reopen file */ - if ( set_istore_k ) - { + if (set_istore_k) { - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Fclose(fid) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) - { + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { TEST_ERROR } - if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) - { + if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) { TEST_ERROR } - - } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_s[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_s[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - if ( buf_s[i][j] != buf_o[i][j] ) - { - printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); - printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (buf_s[i][j] != buf_o[i][j]) { + HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); + HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); TEST_ERROR } } } - /*------------------------------------------------------------------------- * set new dimensions for the array; expand it back to original size * data is now, extended space was initialized with fill value or default value @@ -1180,36 +1105,30 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array */ - if (H5Dset_extent(did, dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions. */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- @@ -1220,36 +1139,26 @@ static int test_rank2( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /* compare the read array with the original array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if (i >= DIMS0 || j >= DIMS1) - { - if(buf_r[i][j] != comp_value) - { - printf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the original array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIMS0 || j >= DIMS1) { + if (buf_r[i][j] != comp_value) { + HDprintf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_r[i][j] != buf_o[i][j]) + } else { + if (buf_r[i][j] != buf_o[i][j]) TEST_ERROR } } @@ -1265,36 +1174,30 @@ static int test_rank2( hid_t fapl, dims_s[1] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * expand then shrink to 0 in dimension 1 while expanding again in * dimension 0 @@ -1302,10 +1205,8 @@ static int test_rank2( hid_t fapl, *------------------------------------------------------------------------- */ - /* expand to original dimensions for the array. */ - if (H5Dset_extent(did , dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } @@ -1313,266 +1214,208 @@ static int test_rank2( hid_t fapl, dims_s[1] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * close dataset *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * test a dataset with non initialized chunks *------------------------------------------------------------------------- */ - - if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) { TEST_ERROR } - if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* set new dimensions for the array */ - dims_o[ 0 ] = 0; - dims_o[ 1 ] = 0; - if (H5Dset_extent( did , dims_o ) < 0) - { + dims_o[0] = 0; + dims_o[1] = 0; + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } - - - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - - - /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - - if (H5Pclose(my_dcpl) < 0) - { + if (H5Pclose(my_dcpl) < 0) { TEST_ERROR } /* close file creation property list */ - if(H5Pclose(fcpl) < 0) - { + if (H5Pclose(fcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( my_dcpl ); - H5Pclose( fcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(my_dcpl); + H5Pclose(fcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - - - /*------------------------------------------------------------------------- * test usage with a 3D rank *------------------------------------------------------------------------- */ -static int test_rank3( hid_t fapl, - hid_t dcpl, - hbool_t do_fill_value, - hbool_t disable_edge_filters, - hbool_t set_istore_k) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t my_dcpl=-1; - hid_t fcpl; - hsize_t dims_o[RANK3] = {DIM0,DIM1,DIM2}; /* original dimensions */ - hsize_t dims_s[RANK3] = {DIMS0,DIMS1,DIMS2}; /* shrinking dimensions */ - hsize_t dims_e[RANK3] = {DIME0,DIME1,DIME2}; /* extended dimensions */ - hsize_t dims_c[RANK3] = {2,2,2}; /* chunk dimensions */ - hsize_t dims_r[RANK3]; /* read dimensions */ - hsize_t maxdims[RANK3] = {H5S_UNLIMITED,H5S_UNLIMITED,H5S_UNLIMITED}; - int buf_o[DIM0][DIM1][DIM2]; - int buf_s[DIMS0][DIMS1][DIMS2]; - int buf_e[DIME0][DIME1][DIME2]; - int buf_r[DIM0][DIM1][DIM2]; - int i, j, k; - int comp_value; - char filename[NAME_BUF_SIZE]; - - if ( do_fill_value ) - { +static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t my_dcpl = -1; + hid_t fcpl; + hsize_t dims_o[RANK3] = { DIM0, DIM1, DIM2 }; /* original dimensions */ + hsize_t dims_s[RANK3] = { DIMS0, DIMS1, DIMS2 }; /* shrinking dimensions */ + hsize_t dims_e[RANK3] = { DIME0, DIME1, DIME2 }; /* extended dimensions */ + hsize_t dims_c[RANK3] = { 2, 2, 2 }; /* chunk dimensions */ + hsize_t dims_r[RANK3]; /* read dimensions */ + hsize_t maxdims[RANK3] = { H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED }; + int buf_o[DIM0][DIM1][DIM2]; + int buf_s[DIMS0][DIMS1][DIMS2]; + int buf_e[DIME0][DIME1][DIME2]; + int buf_r[DIM0][DIM1][DIM2]; + int i, j, k; + int comp_value; + char filename[NAME_BUF_SIZE]; + + if (do_fill_value) { comp_value = FILL_VALUE; - } - else - { + } else { comp_value = 0; } - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { - for( k = 0; k < DIM2; k++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { + for (k = 0; k < DIM2; k++) { buf_o[i][j][k] = 2; } } } /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { TEST_ERROR } - if ( set_istore_k ) - { + if (set_istore_k) { /* set non-default indexed storage B-tree internal 'K' value */ - if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0) - { + if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) { TEST_ERROR } } /* create a new file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { TEST_ERROR } /* close property list */ - if(H5Pclose(fcpl) < 0) - { + if (H5Pclose(fcpl) < 0) { TEST_ERROR } /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) { TEST_ERROR } /* modify dataset creation properties, i.e. enable chunking. */ - if ((my_dcpl = H5Pcopy (dcpl)) < 0) - { + if ((my_dcpl = H5Pcopy(dcpl)) < 0) { TEST_ERROR } - if (H5Pset_chunk(my_dcpl, RANK3, dims_c) < 0) - { + if (H5Pset_chunk(my_dcpl, RANK3, dims_c) < 0) { TEST_ERROR } - if(disable_edge_filters) - if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) + if (disable_edge_filters) + if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR - /*------------------------------------------------------------------------- - * create, write array - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create, write array + *------------------------------------------------------------------------- + */ - /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + /* create a dataset */ + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - for( k = 0; k < (int)dims_o[2]; k++ ) - { - printf("%d ", buf_o[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + for( k = 0; k < (int)dims_o[2]; k++ ) { + HDprintf("%d ", buf_o[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -1583,32 +1426,26 @@ static int test_rank3( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) - { + if (H5Dset_extent(did, dims_e) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -1617,203 +1454,153 @@ static int test_rank3( hid_t fapl, if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - printf("%d ", buf_e[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { + HDprintf("%d ", buf_e[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if ( i >= DIM0 || j >= DIM1 || k >= DIM2 ) - { - if(buf_e[i][j][k] != comp_value) - { - printf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k] ); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (i >= DIM0 || j >= DIM1 || k >= DIM2) { + if (buf_e[i][j][k] != comp_value) { + HDprintf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j][k] != buf_o[i][j][k] ) + } else { + if (buf_e[i][j][k] != buf_o[i][j][k]) TEST_ERROR } } } } - - - /*------------------------------------------------------------------------- * shrink *------------------------------------------------------------------------- */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /* for this case we close and reopen file */ - if ( set_istore_k ) - { + if (set_istore_k) { - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Fclose(fid) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) - { + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { TEST_ERROR } - if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) - { + if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) { TEST_ERROR } - - } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - printf("%d ", buf_s[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { + HDprintf("%d ", buf_s[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if ( buf_s[i][j][k] != buf_o[i][j][k] ) - { - printf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k] ); - printf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k] ); + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (buf_s[i][j][k] != buf_o[i][j][k]) { + HDprintf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k]); + HDprintf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k]); TEST_ERROR } } } } - /*------------------------------------------------------------------------- * set new dimensions for the array; expand it back to original size *------------------------------------------------------------------------- */ /* set new dimensions for the array */ - if (H5Dset_extent(did, dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions. */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } @@ -1823,52 +1610,39 @@ static int test_rank3( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { - printf("%d ", buf_r[i][j][k]); + HDprintf("%d ", buf_r[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - /* compare the read array with the original array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2 ) - { - if( buf_r[i][j][k] != comp_value ) - { - printf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k] ); - printf("value = %d\n", comp_value); + /* compare the read array with the original array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2) { + if (buf_r[i][j][k] != comp_value) { + HDprintf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_r[i][j][k] != buf_o[i][j][k]) + } else { + if (buf_r[i][j][k] != buf_o[i][j][k]) TEST_ERROR } } } } - /*------------------------------------------------------------------------- * shrink to 0 * @@ -1880,158 +1654,126 @@ static int test_rank3( hid_t fapl, dims_s[2] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /*------------------------------------------------------------------------- * close dataset *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - /*------------------------------------------------------------------------- * test a dataset with non initialized chunks *------------------------------------------------------------------------- */ - - if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) { TEST_ERROR } - if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* set new dimensions for the array */ - dims_o[ 0 ] = 0; - dims_o[ 1 ] = 0; - dims_o[ 2 ] = 0; - if (H5Dset_extent( did , dims_o ) < 0) - { + dims_o[0] = 0; + dims_o[1] = 0; + dims_o[2] = 0; + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } - - - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - - - /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - - if (H5Pclose(my_dcpl) < 0) - { + if (H5Pclose(my_dcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( my_dcpl ); - H5Pclose( fcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(my_dcpl); + H5Pclose(fcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - /*------------------------------------------------------------------------- * test usage with external storage *------------------------------------------------------------------------- */ -static int test_external( hid_t fapl ) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl=-1; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIM1}; /* extended dimensions, dimension 1 is the original */ - hsize_t dims_r[RANK2]; /* read dimensions */ - hsize_t maxdims[RANK2] = {DIME0,DIM1}; /* only the first dimension can be extendible */ - int buf_o[DIM0][DIM1]; /* original buffer, for writing */ - int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */ - int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */ - int buf_ro[DIM0][DIM1]; /* original buffer for reading */ - int i, j; - int comp_value = 0; - char filename[NAME_BUF_SIZE]; - - - hsize_t size; /* number of bytes reserved in the file for the data */ +static int test_external(hid_t fapl) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t dcpl = -1; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIM1 }; /* extended dimensions, dimension 1 is the original */ + hsize_t dims_r[RANK2]; /* read dimensions */ + hsize_t maxdims[RANK2] = { DIME0, DIM1 }; /* only the first dimension can be extendible */ + int buf_o[DIM0][DIM1]; /* original buffer, for writing */ + int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */ + int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */ + int buf_ro[DIM0][DIM1]; /* original buffer for reading */ + int i, j; + int comp_value = 0; + char filename[NAME_BUF_SIZE]; + + hsize_t size; /* number of bytes reserved in the file for the data */ hsize_t max_size[2]; max_size[0] = dims_e[0]; max_size[1] = dims_e[1]; size = max_size[0] * max_size[1] * sizeof(int) / 2; - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } @@ -2043,30 +1785,27 @@ static int test_external( hid_t fapl ) if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* modify dataset creation properties */ - if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + /* modify dataset creation properties */ + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t) 0, size) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t) 0, size) < 0) FAIL_STACK_ERROR { - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ + char name[256]; /*external file name */ + off_t file_offset; /*external file offset */ + hsize_t file_size; /*sizeof external file segment */ - if(H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, - &file_size) < 0) + if (H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, &file_size) < 0) FAIL_STACK_ERROR } - - /*------------------------------------------------------------------------- * Write an array AxB. These are the dimensions for creating the dataset * @@ -2080,80 +1819,72 @@ static int test_external( hid_t fapl ) *------------------------------------------------------------------------- */ - /* create the data space with unlimited dimensions. */ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) FAIL_STACK_ERROR - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR + /*------------------------------------------------------------------------- + * read + *------------------------------------------------------------------------- + */ - /*------------------------------------------------------------------------- - * read - *------------------------------------------------------------------------- - */ - - /* read */ + /* read */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0) FAIL_STACK_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_ro[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_ro[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /*------------------------------------------------------------------------- - * expand - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * set new dimensions for the array; expand it - * data is now, extended space was initialized with default value - * - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 0 0 0 0 - * 0 0 0 0 - * 0 0 0 0 - * - *------------------------------------------------------------------------- - */ - - /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) + /*------------------------------------------------------------------------- + * expand + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * set new dimensions for the array; expand it + * data is now, extended space was initialized with default value + * + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 0 0 0 0 + * 0 0 0 0 + * 0 0 0 0 + * + *------------------------------------------------------------------------- + */ + + /* set new dimensions for the array. */ + if (H5Dset_extent(did, dims_e) < 0) FAIL_STACK_ERROR - /* get the space */ + /* get the space */ if ((sid = H5Dget_space(did)) < 0) FAIL_STACK_ERROR - /* get dimensions */ + /* get dimensions */ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR - - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + /* check dimensions */ + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -2162,48 +1893,33 @@ static int test_external( hid_t fapl ) if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) FAIL_STACK_ERROR - - #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_e[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_e[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if ( i >= DIM0 || j >= DIM1 ) - { - if(buf_e[i][j] != comp_value) - { - printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIM0 || j >= DIM1) { + if (buf_e[i][j] != comp_value) { + HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j] != buf_o[i][j]) + } else { + if (buf_e[i][j] != buf_o[i][j]) TEST_ERROR } } } - - - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * shrink * * data is now @@ -2215,208 +1931,172 @@ static int test_external( hid_t fapl ) */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) + if (H5Dset_extent(did, dims_s) < 0) FAIL_STACK_ERROR - /* get the space */ + /* get the space */ if ((sid = H5Dget_space(did)) < 0) FAIL_STACK_ERROR - /* get dimensions */ + /* get dimensions */ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + /* check dimensions */ + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) FAIL_STACK_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_s[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_s[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - if ( buf_s[i][j] != buf_o[i][j] ) - { - printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); - printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); + /* compare the read array with the shrinked array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (buf_s[i][j] != buf_o[i][j]) { + HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); + HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); TEST_ERROR } } } - /*------------------------------------------------------------------------- * negative test * try to extend dimension above maximum *------------------------------------------------------------------------- */ - dims_e[1] = DIME1; - H5E_BEGIN_TRY - { - - - /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) == SUCCEED) { - TEST_ERROR - } - - } H5E_END_TRY; + /* set new dimensions for the array. */ + if (H5Dset_extent(did, dims_e) == SUCCEED) { + TEST_ERROR + } + }H5E_END_TRY; /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if (H5Dclose( did ) < 0) + if (H5Dclose(did) < 0) FAIL_STACK_ERROR - if (H5Fclose( fid ) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED() + ; return 0; -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( dcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - /*------------------------------------------------------------------------- * test usage with layouts compact and contiguous *------------------------------------------------------------------------- */ -static int test_layouts( H5D_layout_t layout, hid_t fapl ) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl=-1; - herr_t ret; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */ - hsize_t dims_r[RANK2]; /* read dimensions */ - int buf_o[DIM0][DIM1]; - int buf_r[DIM0][DIM1]; - int i, j; - char filename[NAME_BUF_SIZE]; - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { +static int test_layouts(H5D_layout_t layout, hid_t fapl) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t dcpl = -1; + herr_t ret; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */ + hsize_t dims_r[RANK2]; /* read dimensions */ + int buf_o[DIM0][DIM1]; + int buf_r[DIM0][DIM1]; + int i, j; + char filename[NAME_BUF_SIZE]; + + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } - /* create a new file */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { TEST_ERROR } /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0) { TEST_ERROR } /* modify dataset creation properties */ - if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) - { + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { TEST_ERROR } - if (H5Pset_layout (dcpl, layout) < 0) - { + if (H5Pset_layout(dcpl, layout) < 0) { TEST_ERROR } /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_o[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_o[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -2427,39 +2107,31 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) */ H5E_BEGIN_TRY - { + { - ret = H5Dset_extent(did , dims_e); + ret = H5Dset_extent(did, dims_e); - } H5E_END_TRY; + }H5E_END_TRY; - if(ret >= 0) + if (ret >= 0) TEST_ERROR - - - - /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + /* get the space */ + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } @@ -2468,123 +2140,100 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /*------------------------------------------------------------------------- - * negative test - * try to shrink dimension - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * negative test + * try to shrink dimension + *------------------------------------------------------------------------- + */ H5E_BEGIN_TRY - { + { - ret = H5Dset_extent(did , dims_s); + ret = H5Dset_extent(did, dims_s); - } H5E_END_TRY; + }H5E_END_TRY; - if(ret >= 0) + if (ret >= 0) TEST_ERROR - - /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + /* get the space */ + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Pclose(dcpl) < 0) - { + if (H5Pclose(dcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( dcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } @@ -3077,16 +2726,15 @@ static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4], { unsigned i; - printf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0], + HDprintf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0], (unsigned)cdims[1], (unsigned)cdims[2], (unsigned)cdims[3]); - printf(" Log of dataset dimensions (oldest first):\n"); + HDprintf(" Log of dataset dimensions (oldest first):\n"); for(i=0; i=0) - printf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, - m); + HDprintf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, m); return; } /* end test_random_rank4_dump */ -- cgit v0.12 From 83b23a5a42c2124c1c5933d0565be1bbefd1c30d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Aug 2019 16:23:15 -0500 Subject: Use prefix variable --- config/cmake/hdf5-config.cmake.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 1803117..a0d6c49 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -100,9 +100,9 @@ endif () #----------------------------------------------------------------------------- # Version Strings #----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) +set (${HDF5_PACKAGE_NAME}_VERSION_STRING @HDF5_VERSION_STRING@) +set (${HDF5_PACKAGE_NAME}_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@) #----------------------------------------------------------------------------- # Don't include targets if this file is being picked up by another @@ -196,7 +196,7 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) elseif (comp STREQUAL "Java") set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} hdf5::${hdf5_comp}) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp}) else () set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) -- cgit v0.12 From c3c044cc003d6a4039635e638e1cd1c2487be177 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 7 Aug 2019 11:51:06 -0500 Subject: Escape { and } in regex as required by sh in updated cori.nersc.gov. Tested change on jam, jelly, emu, ostrich and osx1011test. --- bin/h5vers | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/h5vers b/bin/h5vers index a00beb7..4200141 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -377,7 +377,7 @@ if ($H5_JAVA) { my $version_string2 = sprintf("%d, %d, %d", @newver[0,1,2]); $data =~ s/\@version HDF5 .*
/\@version HDF5 $version_string1
/; - $data =~ s/ public final static int LIB_VERSION\[\] = { \d*, \d*, \d* };/ public final static int LIB_VERSION[] = { $version_string2 };/; + $data =~ s/ public final static int LIB_VERSION\[\] = \{ \d*, \d*, \d* \};/ public final static int LIB_VERSION[] = \{ $version_string2 \};/; write_file($H5_JAVA, $data); } @@ -394,7 +394,7 @@ if ($TESTH5_JAVA) { my $version_string1 = sprintf("%d, %d, %d", @newver[0,1,2]); my $version_string2 = sprintf("int majnum = %d, minnum = %d, relnum = %d", @newver[0,1,2]); - $data =~ s/ int libversion\[\] = { .* };/ int libversion\[\] = { $version_string1 };/; + $data =~ s/ int libversion\[\] = \{ .* \};/ int libversion\[\] = \{ $version_string1 \};/; $data =~ s/ int majnum = \d*, minnum = \d*, relnum = \d*;/ $version_string2;/; write_file($TESTH5_JAVA, $data); @@ -405,7 +405,7 @@ if ($REPACK_LAYOUT_PLUGIN_VERSION) { my $data = read_file($REPACK_LAYOUT_PLUGIN_VERSION); my $version_string = sprintf("%d %d %d", @newver[0,1,2]); - $data =~ s/ PARAMS { 9 \d* \d* \d* }/ PARAMS { 9 $version_string }/g; + $data =~ s/ PARAMS \{ 9 \d* \d* \d* \}/ PARAMS \{ 9 $version_string \}/g; write_file($REPACK_LAYOUT_PLUGIN_VERSION, $data); } -- cgit v0.12 From 07af403991ae8950d1f930f5a6db2c7124ae8f91 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 7 Aug 2019 15:18:21 -0500 Subject: Add option to explicitly disable extra tests --- test/CMakeTests.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 49fabd8..cc166ec 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -879,10 +879,12 @@ if (BUILD_SHARED_LIBS) ############################################################################## endif () +option (TEST_SHELL_SCRIPTS "Enable shell script tests" OFF) if (TEST_SHELL_SCRIPTS) include (ShellTests.cmake) endif() +option (ENABLE_EXTENDED_TESTS "Enable extended tests" OFF) if (ENABLE_EXTENDED_TESTS) ############################################################################## ### S W M R T E S T S -- cgit v0.12 From c56509b490d6834340dedcd3120893028ccb6e8c Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Thu, 8 Aug 2019 16:29:57 -0500 Subject: Added gcc conditional for __attribute__((fallthrough)), removes 34 warnings on theta (10% of warnings). --- src/H5private.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/H5private.h b/src/H5private.h index 86cd615..00b7a07 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -317,8 +317,12 @@ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) +#if defined(__GNUC__) && __GNUC__ >= 7 # define H5_ATTR_FALLTHROUGH __attribute__((fallthrough)); #else +# define H5_ATTR_FALLTHROUGH /*void*/ +#endif +#else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ # define H5_ATTR_NORETURN /*void*/ -- cgit v0.12 From 4900f8823497c63e9f9464dcb6459ebdcbfdac8d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 8 Aug 2019 18:46:59 -0700 Subject: Fixed an issue with older version of gfortran. --- config/gnu-fflags | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index 3fc112d..185a4c6 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -58,8 +58,6 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS -std=f2008" elif test $f9x_vers_major -ge 5 -o $f9x_vers_major -eq 4 -a $f9x_vers_minor -ge 6; then H5_FCFLAGS="$H5_FCFLAGS -std=f2008ts" - else - H5_FCFLAGS="$H5_FCFLAGS -std=f2003" fi -- cgit v0.12 From 2d6bb8b95c94c9fc8c52dc779b91d8d6653b730c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Aug 2019 11:24:36 -0500 Subject: Fix API version option --- CMakeLists.txt | 5 ++++- config/cmake/cacheinit.cmake | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc6a94f..488fbab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -676,7 +676,10 @@ endif () #----------------------------------------------------------------------------- # Option to use 1.12.x API #----------------------------------------------------------------------------- -option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON) +option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" OFF) +if (NOT HDF5_USE_16_API_DEFAULT AND NOT HDF5_USE_18_API_DEFAULT AND NOT HDF5_USE_110_API_DEFAULT AND NOT HDF5_USE_112_API_DEFAULT) + set (HDF5_USE_112_API_DEFAULT ON) +endif () set (H5_USE_112_API_DEFAULT 0) if (HDF5_USE_112_API_DEFAULT) set (H5_USE_112_API_DEFAULT 1) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 5254115..147f2ef 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -35,6 +35,8 @@ set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) +set (HDF5_USE_112_API_DEFAULT ON CACHE BOOL "Enable v1.12 API" FORCE) + set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) -- cgit v0.12 From d172582ca9573d685a4c3a9a6399113014da4b21 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Aug 2019 12:45:29 -0500 Subject: Use a STRING option for API version --- CMakeLists.txt | 23 ++++++++--------------- config/cmake/cacheinit.cmake | 2 +- release_docs/INSTALL_CMake.txt | 17 +++++++---------- release_docs/RELEASE.txt | 8 +++++++- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 488fbab..7115ecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -642,48 +642,41 @@ if (H5_HAVE_PARALLEL) endif () endif () -set (DEFAULT_API_VERSION "v110") +set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) +set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112) #----------------------------------------------------------------------------- # Option to use 1.6.x API #----------------------------------------------------------------------------- -option (HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF) set (H5_USE_16_API_DEFAULT 0) -if (HDF5_USE_16_API_DEFAULT) +if (DEFAULT_API_VERSION MATCHES "v16") set (H5_USE_16_API_DEFAULT 1) - set (DEFAULT_API_VERSION "v16") endif () #----------------------------------------------------------------------------- # Option to use 1.8.x API #----------------------------------------------------------------------------- -option (HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF) set (H5_USE_18_API_DEFAULT 0) -if (HDF5_USE_18_API_DEFAULT) +if (DEFAULT_API_VERSION MATCHES "v18") set (H5_USE_18_API_DEFAULT 1) - set (DEFAULT_API_VERSION "v18") endif () #----------------------------------------------------------------------------- # Option to use 1.10.x API #----------------------------------------------------------------------------- -option (HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF) set (H5_USE_110_API_DEFAULT 0) -if (HDF5_USE_110_API_DEFAULT) +if (DEFAULT_API_VERSION MATCHES "v110") set (H5_USE_110_API_DEFAULT 1) - set (DEFAULT_API_VERSION "v110") endif () #----------------------------------------------------------------------------- # Option to use 1.12.x API #----------------------------------------------------------------------------- -option (HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" OFF) -if (NOT HDF5_USE_16_API_DEFAULT AND NOT HDF5_USE_18_API_DEFAULT AND NOT HDF5_USE_110_API_DEFAULT AND NOT HDF5_USE_112_API_DEFAULT) - set (HDF5_USE_112_API_DEFAULT ON) +if (NOT DEFAULT_API_VERSION) + set (DEFAULT_API_VERSION "v112") endif () set (H5_USE_112_API_DEFAULT 0) -if (HDF5_USE_112_API_DEFAULT) +if (DEFAULT_API_VERSION MATCHES "v112") set (H5_USE_112_API_DEFAULT 1) - set (DEFAULT_API_VERSION "v112") endif () #----------------------------------------------------------------------------- diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 147f2ef..01c2221 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -35,7 +35,7 @@ set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) -set (HDF5_USE_112_API_DEFAULT ON CACHE BOOL "Enable v1.12 API" FORCE) +set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 4bba5e8..49fef76 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -652,10 +652,7 @@ HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" HDF_TEST_EXPRESS "Control testing framework (0-3)" "0" HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_TEST_PASSTHROUGH_VOL "Execute tests with different passthrough VOL connectors" OFF -HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF -HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF -HDF5_USE_110_API_DEFAULT "Use the HDF5 1.10.x API by default" OFF -HDF5_USE_112_API_DEFAULT "Use the HDF5 1.12.x API by default" ON +DEFAULT_API_VERSION "Enable default API (v16, v18, v110, v112)" "v112" HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON @@ -668,13 +665,13 @@ if (HDF5_TEST_VFD) HDF5_TEST_FHEAP_VFD "Execute fheap test with different VFDs" ON ---------------- External Library Options --------------------- -HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO" -HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF -HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF -ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0 -SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0 +HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO GIT TGZ)" "NO" +HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF +HDF5_ENABLE_Z_LIB_SUPPORT "Enable Zlib Filters" OFF +ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0 +SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0 if (HDF5_ENABLE_SZIP_SUPPORT) - HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF + HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF if (WINDOWS) H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%/hdf5/lib/plugin" else () diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b4fa11c..8fa5ed7 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -492,7 +492,13 @@ Bug Fixes since HDF5-1.10.3 release Configuration ------------- - - + - Correct option for default API version + + CMake options for default API version are not mutually exclusive. + Change the multiple BOOL options to a single STRING option with the + strings; v16, v18, v110, v112. + + (ADB - 2019/08/12, HDFFV-10879) Performance ------------- -- cgit v0.12 From b28636464e3505bad48672a0cd49052b7f7c527c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Aug 2019 15:19:11 -0500 Subject: HDFFV-10879 correct API version set command --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7115ecb..374e15e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -642,7 +642,7 @@ if (H5_HAVE_PARALLEL) endif () endif () -set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) +#set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112) #----------------------------------------------------------------------------- # Option to use 1.6.x API -- cgit v0.12 From c476f020769d8f78581ef399c59e3d4e6e202b2f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 12 Aug 2019 15:38:15 -0500 Subject: HDFFV-10879 fix reference file --- test/testfiles/error_test_2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testfiles/error_test_2 b/test/testfiles/error_test_2 index 6852f6f..85bc2e7 100644 --- a/test/testfiles/error_test_2 +++ b/test/testfiles/error_test_2 @@ -1 +1 @@ -Test skipped because backward compatbility with v1.6 is configured in +Test skipped because backward compatibility with v1.6 is configured in -- cgit v0.12 From 5b6bd7c922d81bb6d1877c03e4b012823f03f88a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Aug 2019 01:36:42 -0700 Subject: Added the map (H5M) API --- CMakeLists.txt | 6 + MANIFEST | 7 + bin/trace | 1 + config/cmake/H5pubconf.h.in | 3 + configure.ac | 26 ++ release_docs/RELEASE.txt | 5 + src/CMakeLists.txt | 16 + src/H5.c | 3 + src/H5Fint.c | 6 + src/H5Gdeprec.c | 3 + src/H5Gloc.c | 3 + src/H5Gname.c | 6 + src/H5Gtest.c | 3 + src/H5I.c | 5 + src/H5Ipublic.h | 1 + src/H5M.c | 1032 +++++++++++++++++++++++++++++++++++++++++ src/H5Mmodule.h | 31 ++ src/H5Mpkg.h | 51 ++ src/H5Mprivate.h | 80 ++++ src/H5Mpublic.h | 126 +++++ src/H5O.c | 1 + src/H5Oflush.c | 3 + src/H5Oint.c | 3 + src/H5Opublic.h | 1 + src/H5Pencdec.c | 2 +- src/H5Pint.c | 34 +- src/H5Pmapl.c | 217 +++++++++ src/H5Pmcpl.c | 115 +++++ src/H5Pprivate.h | 5 + src/H5Ppublic.h | 14 + src/H5Rint.c | 3 + src/H5T.c | 1 + src/H5VLcallback.c | 111 +++++ src/H5VLconnector.h | 2 +- src/H5VLint.c | 4 +- src/H5VLprivate.h | 3 + src/H5err.txt | 1 + src/H5private.h | 3 + src/H5trace.c | 14 +- src/Makefile.am | 8 +- src/hdf5.h | 1 + test/links.c | 6 + test/objcopy.c | 11 +- test/tfile.c | 3 + tools/lib/h5tools_str.c | 1 + tools/lib/h5tools_utils.c | 1 + tools/lib/h5trav.c | 4 + tools/src/h5dump/h5dump_ddl.c | 3 + tools/src/h5dump/h5dump_xml.c | 1 + tools/src/h5stat/h5stat.c | 1 + 50 files changed, 1978 insertions(+), 13 deletions(-) create mode 100644 src/H5M.c create mode 100644 src/H5Mmodule.h create mode 100644 src/H5Mpkg.h create mode 100644 src/H5Mprivate.h create mode 100644 src/H5Mpublic.h create mode 100644 src/H5Pmapl.c create mode 100644 src/H5Pmcpl.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 374e15e..e6474aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,6 +705,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif () endif () endif () + #----------------------------------------------------------------------------- # Option to use threadsafe #----------------------------------------------------------------------------- @@ -759,6 +760,11 @@ if (HDF5_ENABLE_THREADSAFE) endif () #----------------------------------------------------------------------------- +# Option to build the map API +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_MAP_API "Build the map API" OFF) + +#----------------------------------------------------------------------------- # Add the HDF5 Library Target to the build #----------------------------------------------------------------------------- add_subdirectory (src) diff --git a/MANIFEST b/MANIFEST index 83c03a5..29b34a5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -749,6 +749,11 @@ ./src/H5Lpkg.h ./src/H5Lprivate.h ./src/H5Lpublic.h +./src/H5M.c +./src/H5Mmodule.h +./src/H5Mpkg.h +./src/H5Mprivate.h +./src/H5Mpublic.h ./src/H5MF.c ./src/H5MFaggr.c ./src/H5MFdbg.c @@ -820,6 +825,8 @@ ./src/H5Pint.c ./src/H5Plapl.c ./src/H5Plcpl.c +./src/H5Pmapl.c +./src/H5Pmcpl.c ./src/H5Pmodule.h ./src/H5Pocpl.c ./src/H5Pocpypl.c diff --git a/bin/trace b/bin/trace index 241c69c..54b6f8f 100755 --- a/bin/trace +++ b/bin/trace @@ -150,6 +150,7 @@ $Source = ""; "H5L_class_t" => "x", "H5L_elink_traverse_t" => "x", "H5L_iterate_t" => "x", + "H5M_iterate_t" => 'x', "H5MM_allocate_t" => "x", "H5MM_free_t" => "x", "H5O_info_t" => "x", diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index cb05974..120c023 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -267,6 +267,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_MACH_MACH_TIME_H @H5_HAVE_MACH_MACH_TIME_H@ +/* Define if the map API (H5M) should be compiled */ +#cmakedefine H5_HAVE_MAP_API @H5_HAVE_MAP_API@ + /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_MEMORY_H @H5_HAVE_MEMORY_H@ diff --git a/configure.ac b/configure.ac index 3d6ab10..7f1f0dd 100644 --- a/configure.ac +++ b/configure.ac @@ -2766,6 +2766,32 @@ if test -n "$PARALLEL"; then fi ## ---------------------------------------------------------------------- +## Check if the map API is enabled by --enable-map-api +## +AC_SUBST([MAP_API]) + +## Default is no map API +MAP_API=no + +AC_MSG_CHECKING([if the map API (H5M) is enabled]) + +AC_ARG_ENABLE([map-api], + [AS_HELP_STRING([--enable-map-api], + [Build the map API (H5M). + This is not yet supported in the native file format + and requires a VOL connector that supports it. + [default=no]])], + [MAP_API=$enableval], [MAP_API=no]) + +if test "X$MAP_API" = "Xyes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_MAP_API], [1], + [Define if the map API (H5M) should be compiled]) +else + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## AC_SUBST([DIRECT_VFD]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8fa5ed7..094a81f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -191,6 +191,11 @@ New Features Library: -------- + - Add new API H5M for map objects. Currently not supported by native + library, can be supported by VOL connectors. + + (NAF - 2019/03/01) + - Improved the performance of virtual dataset I/O Refactored the internal dataspace routines used by the virtual dataset diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2b693bd..17fd949 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -393,6 +393,15 @@ set (H5L_HDRS IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" ) +set (H5M_SOURCES + ${HDF5_SRC_DIR}/H5M.c +) +set (H5M_HDRS + ${HDF5_SRC_DIR}/H5Mpublic.h +) +IDE_GENERATED_PROPERTIES ("H5M" "${H5M_HDRS}" "${H5M_SOURCES}") + + set (H5MF_SOURCES ${HDF5_SRC_DIR}/H5MF.c ${HDF5_SRC_DIR}/H5MFaggr.c @@ -483,6 +492,8 @@ set (H5P_SOURCES ${HDF5_SRC_DIR}/H5Pint.c ${HDF5_SRC_DIR}/H5Plapl.c ${HDF5_SRC_DIR}/H5Plcpl.c + ${HDF5_SRC_DIR}/H5Pmapl.c + ${HDF5_SRC_DIR}/H5Pmcpl.c ${HDF5_SRC_DIR}/H5Pocpl.c ${HDF5_SRC_DIR}/H5Pocpypl.c ${HDF5_SRC_DIR}/H5Pstrcpl.c @@ -716,6 +727,7 @@ set (common_SRCS ${H5HP_SOURCES} ${H5I_SOURCES} ${H5L_SOURCES} + ${H5M_SOURCES} ${H5MF_SOURCES} ${H5MM_SOURCES} ${H5MP_SOURCES} @@ -759,6 +771,7 @@ set (H5_PUBLIC_HEADERS ${H5HL_HDRS} ${H5I_HDRS} ${H5L_HDRS} + ${H5M_HDRS} ${H5MF_HDRS} ${H5MM_HDRS} ${H5MP_HDRS} @@ -845,6 +858,9 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Lpkg.h ${HDF5_SRC_DIR}/H5Lprivate.h + ${HDF5_SRC_DIR}/H5Mpkg.h + ${HDF5_SRC_DIR}/H5Mprivate.h + ${HDF5_SRC_DIR}/H5MFprivate.h ${HDF5_SRC_DIR}/H5MMprivate.h diff --git a/src/H5.c b/src/H5.c index 104c9fd..16c12cb 100644 --- a/src/H5.c +++ b/src/H5.c @@ -166,6 +166,7 @@ H5_init_library(void) H5_debug_g.pkg[H5_PKG_HG].name = "hg"; H5_debug_g.pkg[H5_PKG_HL].name = "hl"; H5_debug_g.pkg[H5_PKG_I].name = "i"; + H5_debug_g.pkg[H5_PKG_M].name = "m"; H5_debug_g.pkg[H5_PKG_MF].name = "mf"; H5_debug_g.pkg[H5_PKG_MM].name = "mm"; H5_debug_g.pkg[H5_PKG_O].name = "o"; @@ -312,6 +313,7 @@ H5_term_library(void) pending += DOWN(A_top); pending += DOWN(D_top); pending += DOWN(G_top); + pending += DOWN(M_top); pending += DOWN(R_top); pending += DOWN(S_top); pending += DOWN(T_top); @@ -337,6 +339,7 @@ H5_term_library(void) pending += DOWN(A); pending += DOWN(D); pending += DOWN(G); + pending += DOWN(M); pending += DOWN(R); pending += DOWN(S); pending += DOWN(T); diff --git a/src/H5Fint.c b/src/H5Fint.c index 7ed3ca8..c9c6658 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -498,6 +498,9 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) oloc = NULL; break; + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -3600,6 +3603,9 @@ H5F__get_file(void *obj, H5I_type_t type) oloc = H5A_oloc((H5A_t *)obj); break; + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 95627d2..5acb378 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -131,6 +131,9 @@ H5G_map_obj_type(H5O_type_t obj_type) ret_value = H5G_TYPE; break; + case H5O_TYPE_MAP: + /* Maps not supported in native VOL connector */ + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/src/H5Gloc.c b/src/H5Gloc.c index e47d3be..40d56c6 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -213,6 +213,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) case H5I_DATASPACE: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maps not supported in native VOL connector") + case H5I_GENPROP_CLS: case H5I_GENPROP_LST: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") diff --git a/src/H5Gname.c b/src/H5Gname.c index 16c1ca7..86a0c2f 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -816,6 +816,9 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) obj_path = H5T_nameof((H5T_t *)obj_ptr); break; + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -1112,6 +1115,9 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, search_datatype = TRUE; break; + case H5O_TYPE_MAP: + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: /* Search and replace names through datatype IDs */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 0b431b1..f9ab6f2 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -604,6 +604,9 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign obj_path = H5T_nameof((H5T_t *)obj_ptr); break; + case H5I_MAP: + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5I.c b/src/H5I.c index 6b5210d..a2275de 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2371,6 +2371,11 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) break; } + /* TODO: Maps will have to be added when they are supported in the + * native VOL connector. + */ + case H5I_MAP: + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index def785f..34a408f 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -38,6 +38,7 @@ typedef enum H5I_type_t { H5I_DATATYPE, /* type ID for Datatype objects */ H5I_DATASPACE, /* type ID for Dataspace objects */ H5I_DATASET, /* type ID for Dataset objects */ + H5I_MAP, /* type ID for Map objects */ H5I_ATTR, /* type ID for Attribute objects */ H5I_VFL, /* type ID for virtual file layer */ H5I_VOL, /* type ID for virtual object layer */ diff --git a/src/H5M.c b/src/H5M.c new file mode 100644 index 0000000..3008c40 --- /dev/null +++ b/src/H5M.c @@ -0,0 +1,1032 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Mmodule.h" /* This source code file is part of the H5M module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Mpkg.h" /* Maps */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5M__close_cb(H5VL_object_t *map_vol_obj); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Package initialization variable */ +hbool_t H5_PKG_INIT_VAR = FALSE; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Map ID class */ +static const H5I_class_t H5I_MAP_CLS[1] = {{ + H5I_MAP, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5M__close_cb /* Callback routine for closing objects of this class */ +}}; + +/* Flag indicating "top" of interface has been initialized */ +static hbool_t H5M_top_package_initialize_s = FALSE; + + + +/*------------------------------------------------------------------------- +NAME + H5M__init_package -- Initialize interface-specific information +USAGE + herr_t H5M__init_package() + +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. +--------------------------------------------------------------------------- +*/ +herr_t +H5M__init_package(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Initialize the atom group for the map IDs */ + if(H5I_register_type(H5I_MAP_CLS) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface") + + /* Mark "top" of interface as initialized, too */ + H5M_top_package_initialize_s = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5M__init_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5M_top_term_package + * + * Purpose: Close the "top" of the interface, releasing IDs, etc. + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + *------------------------------------------------------------------------- + */ +int +H5M_top_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5M_top_package_initialize_s) { + if(H5I_nmembers(H5I_MAP) > 0) { + (void)H5I_clear_type(H5I_MAP, FALSE, FALSE); + n++; /*H5I*/ + } /* end if */ + + /* Mark closed */ + if(0 == n) + H5M_top_package_initialize_s = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5M_top_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5M_term_package + * + * Purpose: Terminate this interface. + * + * Note: Finishes shutting down the interface, after + * H5M_top_term_package() is called + * + * Return: Success: Positive if anything was done that might + * affect other interfaces; zero otherwise. + * Failure: Negative. + *------------------------------------------------------------------------- + */ +int +H5M_term_package(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_PKG_INIT_VAR) { + /* Sanity checks */ + HDassert(0 == H5I_nmembers(H5I_MAP)); + HDassert(FALSE == H5M_top_package_initialize_s); + + /* Destroy the dataset object id group */ + n += (H5I_dec_type_ref(H5I_MAP) > 0); + + /* Mark closed */ + if(0 == n) + H5_PKG_INIT_VAR = FALSE; + } /* end if */ + + FUNC_LEAVE_NOAPI(n) +} /* end H5M_term_package() */ + + +/*------------------------------------------------------------------------- + * Function: H5M__close_cb + * + * Purpose: Called when the ref count reaches zero on the map's ID + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5M__close_cb(H5VL_object_t *map_vol_obj) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(map_vol_obj); + + /* Close the map */ + if(H5VL_optional(map_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map"); + + /* Free the VOL object */ + if(H5VL_free_object(map_vol_obj) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "unable to free VOL object"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5M__close_cb() */ + +#ifdef H5_HAVE_MAP_API + + +/*------------------------------------------------------------------------- + * Function: H5Mcreate + * + * Purpose: Creates a new map object for storing key-value pairs. The + * in-file datatype for keys is defined by KEY_TYPE_ID and + * the in-file datatype for values is defined by VAL_TYPE_ID. + * LOC_ID specifies the location to create the map object and + * NAME specifies the name of the link to the object + * (relative to LOC_ID). Other options can be specified + * through the property lists LCPL_ID, MCPL_ID, and MAPL_ID. + * + * Return: Success: The object ID of the new map. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, + hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id) +{ + void *map = NULL; /* New map's info */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE7("i", "i*siiiii", loc_id, name, key_type_id, val_type_id, lcpl_id, + mcpl_id, mapl_id); + + /* Check arguments */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + + /* Get link creation property list */ + if(H5P_DEFAULT == lcpl_id) + lcpl_id = H5P_LINK_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") + + /* Get map creation property list */ + if(H5P_DEFAULT == mcpl_id) + mcpl_id = H5P_MAP_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + + /* Get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Create the map */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, name, lcpl_id, + key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") + + /* Get an atom for the map */ + if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize map handle") + +done: + /* Cleanup on failure */ + if(H5I_INVALID_HID == ret_value) + if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + + FUNC_LEAVE_API(ret_value) +} /* end H5Mcreate() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mcreate_anon + * + * Purpose: Creates a new map object for storing key-value pairs. The + * in-file datatype for keys is defined by KEY_TYPE_ID and + * the in-file datatype for values is defined by VAL_TYPE_ID. + * LOC_ID specifies the file to create the map object, but no + * link to the object is created. Other options can be + * specified through the property lists LCPL_ID, MCPL_ID, and + * MAPL_ID. + * + * The resulting ID should be linked into the file with + * H5Olink or it will be deleted when closed. + * + * Return: Success: The object ID of the new map. The map should + * be linked into the group hierarchy before being closed or + * it will be deleted. The dataset should be + * closed when the caller is no longer interested + * in it. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, + hid_t mcpl_id, hid_t mapl_id) +{ + void *map = NULL; /* map token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE5("i", "iiiii", loc_id, key_type_id, val_type_id, mcpl_id, mapl_id); + + /* Check arguments */ + if(H5P_DEFAULT == mcpl_id) + mcpl_id = H5P_MAP_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not map create property list ID") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Create the map */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CREATE, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, + key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") + + /* Get an atom for the map */ + if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map") + +done: + /* Cleanup on failure */ + if(H5I_INVALID_HID == ret_value) + if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + + FUNC_LEAVE_API(ret_value) +} /* end H5Mcreate_anon() */ + + +/*------------------------------------------------------------------------ + * Function: H5Mopen + * + * Purpose: Finds a map named NAME at LOC_ID, opens it, and returns + * its ID. The map should be close when the caller is no + * longer interested in it. + * + * Takes a map access property list + * + * Return: Success: Object ID of the map + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) +{ + void *map = NULL; /* map token from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE3("i", "i*si", loc_id, name, mapl_id); + + /* Check args */ + if(!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + if(!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + + /* Verify access property list and set up collective metadata if appropriate */ + if(H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + + /* get the location object */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + + /* Set the location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* Open the map */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_OPEN, &loc_params, name, mapl_id, &map) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map") + + /* Register an atom for the map */ + if((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register map atom") + +done: + /* Cleanup on failure */ + if(H5I_INVALID_HID == ret_value) + if(map && H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_CLOSE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + + FUNC_LEAVE_API(ret_value) +} /* end H5Mopen() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mclose + * + * Purpose: Closes access to a map and releases resources used by it. + * It is illegal to subsequently use that same map ID in + * calls to other map functions. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mclose(hid_t map_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", map_id); + + /* Check args */ + if(H5I_MAP != H5I_get_type(map_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID") + + /* Decrement the counter on the map. It will be freed if the count + * reaches zero. + */ + if(H5I_dec_app_ref_always_close(map_id) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on map ID") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mclose() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget_key_type + * + * Purpose: Returns a copy of the key datatype for a map. + * + * Return: Success: ID for a copy of the datatype. The data + * type should be released by calling + * H5Tclose(). + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mget_key_type(hid_t map_id) +{ + H5VL_object_t *vol_obj; /* Map structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", map_id); + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + + /* get the datatype */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_KEY_TYPE, &ret_value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget_key_type() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget_val_type + * + * Purpose: Returns a copy of the value datatype for a map. + * + * Return: Success: ID for a copy of the datatype. The data + * type should be released by calling + * H5Tclose(). + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mget_val_type(hid_t map_id) +{ + H5VL_object_t *vol_obj; /* Map structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", map_id); + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + + /* get the datatype */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_VAL_TYPE, &ret_value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget_val_type() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget_create_plist + * + * Purpose: Returns a copy of the map creation property list. + * + * Return: Success: ID for a copy of the map creation + * property list. The template should be + * released by calling H5P_close(). + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mget_create_plist(hid_t map_id) +{ + H5VL_object_t *vol_obj; /* Map structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", map_id); + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + + /* Get the map creation property list */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MCPL, &ret_value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget_create_plist() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget_access_plist + * + * Purpose: Returns a copy of the map access property list. + * + * Description: H5Mget_access_plist returns the map access property + * list identifier of the specified map. + * + * Return: Success: ID for a copy of the map access + * property list. The template should be + * released by calling H5Pclose(). + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Mget_access_plist(hid_t map_id) +{ + H5VL_object_t *vol_obj; /* Map structure */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE1("i", "i", map_id); + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + + /* Get the map access property list */ + if(H5VL_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_MAPL, &ret_value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget_access_plist() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget_count + * + * Purpose: Returns the number of key-value pairs stored in the map. + * + * Description: H5Mget_count returns the number of key-value pairs stored + * in the specified map. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id) +{ + H5VL_object_t *vol_obj; /* Map structure */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE3("e", "i*hi", map_id, count, dxpl_id); + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Get the number of key-value pairs stored in the map */ + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET, H5VL_MAP_GET_COUNT, count) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget_count() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mset + * + * Purpose: H5Mset adds a key-value pair to the Map specified by + * MAP_ID, or updates the value for the specified key if one + * was set previously. KEY_MEM_TYPE_ID and VAL_MEM_TYPE_ID + * specify the datatypes for the provided KEY and VALUE + * buffers, and if different from those used to create the + * map object, the key and value will be internally converted + * to the datatypes for the map object. Any further options + * can be specified through the property list DXPL_ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mset(hid_t map_id, hid_t key_mem_type_id, const void *key, + hid_t val_mem_type_id, const void *value, hid_t dxpl_id) +{ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "ii*xi*xi", map_id, key_mem_type_id, key, val_mem_type_id, value, + dxpl_id); + + /* Check arguments */ + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + if (val_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID") + + /* Get map pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Set the key/value pair */ + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SET, key_mem_type_id, key, val_mem_type_id, value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to set key/value pair") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mset() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mget + * + * Purpose: H5Mget retrieves, from the Map specified by MAP_ID, the + * value associated with the provided key. KEY_MEM_TYPE_ID + * and VAL_MEM_TYPE_ID specify the datatypes for the provided + * KEY and VALUE buffers. If KEY_MEM_TYPE_ID is different + * from that used to create the map object, the key will be + * internally converted to the datatype for the map object + * for the query, and if VAL_MEM_TYPE_ID is different from + * that used to create the map object, the returned value + * will be converted to VAL_MEM_TYPE_ID before the function + * returns. Any further options can be specified through the + * property list DXPL_ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, + hid_t val_mem_type_id, void *value, hid_t dxpl_id) +{ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "ii*xi*xi", map_id, key_mem_type_id, key, val_mem_type_id, value, + dxpl_id); + + /* Check arguments */ + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + if (val_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID") + + /* Get map pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Get the value for the key */ + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_VAL, key_mem_type_id, key, val_mem_type_id, value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mget() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mexists + * + * Purpose: H5Mexists checks if the provided key is stored in the map + * specified by MAP_ID. If KEY_MEM_TYPE_ID is different from + * that used to create the map object the key will be + * internally converted to the datatype for the map object + * for the query. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, + hid_t dxpl_id) +{ + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "ii*x*bi", map_id, key_mem_type_id, key, exists, dxpl_id); + + /* Check arguments */ + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + + /* Get map pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Check if key exists */ + if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_EXISTS, key_mem_type_id, key, exists)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mexists() */ + + +/*------------------------------------------------------------------------- + * Function: H5Miterate + * + * Purpose: H5Miterate iterates over all key-value pairs stored in the + * map specified by MAP_ID, making the callback specified by + * OP for each. The IDX parameter is an in/out parameter that + * may be used to restart a previously interrupted iteration. + * At the start of iteration IDX should be set to 0, and to + * restart iteration at the same location on a subsequent + * call to H5Miterate, IDX should be the same value as + * returned by the previous call. + * + * H5M_iterate_t is defined as: + * herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, + * void *ctx) + * + * The KEY parameter is the buffer for the key for this + * iteration, converted to the datatype specified by + * KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass + * through of the value passed to H5Miterate, which can be + * used to store application-defined data for iteration. A + * negative return value from this function will cause + * H5Miterate to issue an error, while a positive return + * value will cause H5Miterate to stop iterating and return + * this value without issuing an error. A return value of + * zero allows iteration to continue. + * + * Return: Last value returned by op + * + *------------------------------------------------------------------------- + */ +herr_t +H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, + void *op_data, hid_t dxpl_id) +{ + H5VL_object_t *vol_obj = NULL; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "i*hix*xi", map_id, idx, key_mem_type_id, op, op_data, dxpl_id); + + /* Check arguments */ + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + + /* Get map pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(map_id); + + /* Iterate over keys */ + if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Miterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5Miterate_by_name + * + * Purpose: H5Miterate_by_name iterates over all key-value pairs + * stored in the map specified by MAP_ID, making the callback + * specified by OP for each. The IDX parameter is an in/out + * parameter that may be used to restart a previously + * interrupted iteration. At the start of iteration IDX + * should be set to 0, and to restart iteration at the same + * location on a subsequent call to H5Miterate, IDX should be + * the same value as returned by the previous call. + * + * H5M_iterate_t is defined as: + * herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, + * void *ctx) + * + * The KEY parameter is the buffer for the key for this + * iteration, converted to the datatype specified by + * KEY_MEM_TYPE_ID. The OP_DATA parameter is a simple pass + * through of the value passed to H5Miterate, which can be + * used to store application-defined data for iteration. A + * negative return value from this function will cause + * H5Miterate to issue an error, while a positive return + * value will cause H5Miterate to stop iterating and return + * this value without issuing an error. A return value of + * zero allows iteration to continue. + * + * Return: Last value returned by op + * + *------------------------------------------------------------------------- + */ +herr_t +H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, + hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id, + hid_t lapl_id) +{ + H5VL_object_t *vol_obj = NULL; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE8("e", "i*s*hix*xii", loc_id, map_name, idx, key_mem_type_id, op, + op_data, dxpl_id, lapl_id); + + /* Check arguments */ + if(!map_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be NULL") + if(!*map_name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be an empty string") + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + if (!op) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + + /* Get the location object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.obj_type = H5I_get_type(loc_id); + loc_params.loc_data.loc_by_name.name = map_name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + + /* Iterate over keys */ + if((ret_value = H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0) + HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Miterate_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5Mdelete_key + * + * Purpose: H5Mdelete_key deletes a key-value pair from the Map + * specified by MAP_ID. KEY_MEM_TYPE_ID specifies the + * datatype for the provided key buffers, and if different + * from that used to create the Map object, the key will be + * internally converted to the datatype for the map object. + * Any further options can be specified through the property + * list DXPL_ID. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5Mdelete_key(hid_t map_id, hid_t key_mem_type_id, const void *key, + hid_t dxpl_id) +{ + H5VL_object_t *vol_obj = NULL; + H5VL_loc_params_t loc_params; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "ii*xi", map_id, key_mem_type_id, key, dxpl_id); + + /* Check arguments */ + if (key_mem_type_id < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + + /* Get map pointer */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Set location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(map_id); + + /* Set the key/value pair */ + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE_KEY, key_mem_type_id, key) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to set key/value pair") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Mdelete_key() */ + +#endif /* H5_HAVE_MAP_API */ + diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h new file mode 100644 index 0000000..00a586f --- /dev/null +++ b/src/H5Mmodule.h @@ -0,0 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: This file contains declarations which define macros for the + * H5M package. Including this header means that the source file + * is part of the H5M package. + */ +#ifndef _H5Mmodule_H +#define _H5Mmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5M_MODULE +#define H5_MY_PKG H5M +#define H5_MY_PKG_ERR H5E_MAP +#define H5_MY_PKG_INIT YES + +#endif /* _H5Dmodule_H */ + + diff --git a/src/H5Mpkg.h b/src/H5Mpkg.h new file mode 100644 index 0000000..86ff45c --- /dev/null +++ b/src/H5Mpkg.h @@ -0,0 +1,51 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: This file contains declarations which are visible only within + * the H5M package. Source files outside the H5M package should + * include H5Mprivate.h instead. + */ +#if !(defined H5M_FRIEND || defined H5M_MODULE) +#error "Do not include this file outside the H5M package!" +#endif + +#ifndef _H5Mpkg_H +#define _H5Mpkg_H + +/* Get package's private header */ +#include "H5Mprivate.h" + +/* Other private headers needed by this file */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + + +/*****************************/ +/* Package Private Variables */ +/*****************************/ + + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#endif /*_H5Dpkg_H*/ + diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h new file mode 100644 index 0000000..c841e75 --- /dev/null +++ b/src/H5Mprivate.h @@ -0,0 +1,80 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains private information about the H5M module + */ +#ifndef _H5Mprivate_H +#define _H5Mprivate_H + +/* Include package's public header */ +#include "H5Mpublic.h" + +/* Private headers needed by this file */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Zprivate.h" /* Data filters */ + + +/**************************/ +/* Library Private Macros */ +/**************************/ + +/* + * Feature: Define H5M_DEBUG on the compiler command line if you want to + * debug maps. NDEBUG must not be defined in order for this + * to have any effect. + */ +#ifdef NDEBUG +# undef H5M_DEBUG +#endif + +/* ======== Map creation property names ======== */ + +/* ======== Map access property names ======== */ +#define H5M_ACS_KEY_PREFETCH_SIZE_NAME "key_prefetch_size" /* Number of keys to prefetch during map iteration */ +#define H5M_ACS_KEY_ALLOC_SIZE_NAME "key_alloc_size" /* Initial allocation size for keys prefetched during map iteration */ + +/* Default temporary buffer size */ +#define H5D_TEMP_BUF_SIZE (1024 * 1024) + +/* Default I/O vector size */ +#define H5D_IO_VECTOR_SIZE 1024 + +/* Default VL allocation & free info */ +#define H5D_VLEN_ALLOC NULL +#define H5D_VLEN_ALLOC_INFO NULL +#define H5D_VLEN_FREE NULL +#define H5D_VLEN_FREE_INFO NULL + +/* Default virtual dataset list size */ +#define H5D_VIRTUAL_DEF_LIST_SIZE 8 + + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/******************************/ +/* Library Private Prototypes */ +/******************************/ + +#endif /* _H5Mprivate_H */ + diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h new file mode 100644 index 0000000..56c7d87 --- /dev/null +++ b/src/H5Mpublic.h @@ -0,0 +1,126 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains public declarations for the H5M module. + * + * NOTE: This is an experimental API. Everything in the H5M package + * is subject to revision in a future release. + */ +#ifndef _H5Mpublic_H +#define _H5Mpublic_H + +/* System headers needed by this file */ + +/* Public headers needed by this file */ +#include "H5public.h" +#include "H5Ipublic.h" + + +/*****************/ +/* Public Macros */ +/*****************/ + +/* Macros defining operation IDs for map VOL callbacks (implemented using the + * "optional" VOL callback) */ +#define H5VL_MAP_CREATE 1 +#define H5VL_MAP_OPEN 2 +#define H5VL_MAP_GET_VAL 3 +#define H5VL_MAP_EXISTS 4 +#define H5VL_MAP_SET 5 +#define H5VL_MAP_GET 6 +#define H5VL_MAP_SPECIFIC 7 +#define H5VL_MAP_CLOSE 8 + + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* types for map GET callback */ +typedef enum H5VL_map_get_t { + H5VL_MAP_GET_MAPL, /* map access property list */ + H5VL_MAP_GET_MCPL, /* map creation property list */ + H5VL_MAP_GET_KEY_TYPE, /* key type */ + H5VL_MAP_GET_VAL_TYPE, /* value type */ + H5VL_MAP_GET_COUNT /* key count */ +} H5VL_map_get_t; + +/* types for map SPECIFIC callback */ +typedef enum H5VL_map_specific_t { + H5VL_MAP_ITER, /* H5Miterate */ + H5VL_MAP_DELETE_KEY /* H5Mdelete_key */ +} H5VL_map_specific_t; + +/* Callback for H5Miterate() */ +typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data); + + +/********************/ +/* Public Variables */ +/********************/ + + +/*********************/ +/* Public Prototypes */ +/*********************/ +#ifdef __cplusplus +extern "C" { +#endif + +/* The map API is only built when requested since there's no support in + * the native file format at this time. It's only supported in a few VOL + * connectors. + */ +#ifdef H5_HAVE_MAP_API + +H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, + hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id); +H5_DLL hid_t H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, + hid_t mcpl_id, hid_t mapl_id); +H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id); +H5_DLL herr_t H5Mclose(hid_t map_id); +H5_DLL hid_t H5Mget_key_type(hid_t map_id); +H5_DLL hid_t H5Mget_val_type(hid_t map_id); +H5_DLL hid_t H5Mget_create_plist(hid_t map_id); +H5_DLL hid_t H5Mget_access_plist(hid_t map_id); +H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); +H5_DLL herr_t H5Mset(hid_t map_id, hid_t key_mem_type_id, const void *key, + hid_t val_mem_type_id, const void *value, hid_t dxpl_id); +H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, + hid_t val_mem_type_id, void *value, hid_t dxpl_id); +H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, + hbool_t *exists, hid_t dxpl_id); +H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, + H5M_iterate_t op, void *op_data, hid_t dxpl_id); +H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, + hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, + hid_t dxpl_id, hid_t lapl_id); +H5_DLL herr_t H5Mdelete_key(hid_t map_id, hid_t key_mem_type_id, + const void *key, hid_t dxpl_id); + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* H5_HAVE_MAP_API */ + +#ifdef __cplusplus +} +#endif + +#endif /* _H5Mpublic_H */ + diff --git a/src/H5O.c b/src/H5O.c index 093d429..e7351fc 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1084,6 +1084,7 @@ H5Oclose(hid_t object_id) case H5I_GROUP: case H5I_DATATYPE: case H5I_DATASET: + case H5I_MAP: if(H5I_object(object_id) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") if(H5I_dec_app_ref(object_id) < 0) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index f5ede4a..a03cfa1 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -479,6 +479,9 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") break; + case H5I_MAP: + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5Oint.c b/src/H5Oint.c index 45a8046..e37eea5 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -1836,6 +1836,9 @@ H5O_get_loc(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID") break; + case H5I_MAP: + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "maps not supported in native VOL connector") + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/src/H5Opublic.h b/src/H5Opublic.h index c868e72..234f4f0 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -94,6 +94,7 @@ typedef enum H5O_type_t { H5O_TYPE_GROUP, /* Object is a group */ H5O_TYPE_DATASET, /* Object is a dataset */ H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ + H5O_TYPE_MAP, /* Object is a map */ H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ } H5O_type_t; diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index 8b9962f..2a07a67 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -722,7 +722,7 @@ H5P__decode(const void *buf) /* Get the type of the property list */ type = (H5P_plist_type_t)*p++; - if(type <= H5P_TYPE_USER || type > H5P_TYPE_LINK_ACCESS) + if(type <= H5P_TYPE_USER || type >= H5P_TYPE_MAX_TYPE) HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type) /* Create new property list of the specified type */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 5683403..36367d7 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -151,6 +151,10 @@ hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL; hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; +hid_t H5P_CLS_MAP_CREATE_ID_g = H5I_INVALID_HID; +H5P_genclass_t *H5P_CLS_MAP_CREATE_g = NULL; +hid_t H5P_CLS_MAP_ACCESS_ID_g = H5I_INVALID_HID; +H5P_genclass_t *H5P_CLS_MAP_ACCESS_g = NULL; hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; @@ -180,6 +184,8 @@ hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID; hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID; hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_MAP_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_MAP_ACCESS_ID_g = H5I_INVALID_HID; hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID; @@ -314,6 +320,7 @@ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_MCRT[1]; /* Map creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ @@ -352,6 +359,8 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_FMNT, /* File mount */ H5P_CLS_TCRT, /* Datatype creation */ H5P_CLS_TACC, /* Datatype access */ + H5P_CLS_MCRT, /* Map creation */ + H5P_CLS_MACC, /* Map access */ H5P_CLS_ACRT, /* Attribute creation */ H5P_CLS_AACC, /* Attribute access */ H5P_CLS_LCRT, /* Link creation */ @@ -431,7 +440,7 @@ H5P__init_package(void) FUNC_ENTER_PACKAGE /* Sanity check */ - HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); /* * Initialize the Generic Property class & object groups. @@ -442,8 +451,8 @@ H5P__init_package(void) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Repeatedly pass over the list of property list classes for the library, - * initializing each class if it's parent class is initialized, until no - * more progress is made. + * initializing each class if its parent class is initialized, until no + * more progress is made. */ tot_init = 0; do { @@ -547,6 +556,8 @@ H5P_term_package(void) H5P_LST_GROUP_ACCESS_ID_g = H5P_LST_DATATYPE_CREATE_ID_g = H5P_LST_DATATYPE_ACCESS_ID_g = + H5P_LST_MAP_CREATE_ID_g = + H5P_LST_MAP_ACCESS_ID_g = H5P_LST_ATTRIBUTE_CREATE_ID_g = H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5P_LST_OBJECT_COPY_ID_g = @@ -574,6 +585,8 @@ H5P_term_package(void) H5P_CLS_GROUP_ACCESS_g = H5P_CLS_DATATYPE_CREATE_g = H5P_CLS_DATATYPE_ACCESS_g = + H5P_CLS_MAP_CREATE_g = + H5P_CLS_MAP_ACCESS_g = H5P_CLS_STRING_CREATE_g = H5P_CLS_ATTRIBUTE_CREATE_g = H5P_CLS_ATTRIBUTE_ACCESS_g = @@ -594,6 +607,8 @@ H5P_term_package(void) H5P_CLS_GROUP_ACCESS_ID_g = H5P_CLS_DATATYPE_CREATE_ID_g = H5P_CLS_DATATYPE_ACCESS_ID_g = + H5P_CLS_MAP_CREATE_ID_g = + H5P_CLS_MAP_ACCESS_ID_g = H5P_CLS_STRING_CREATE_ID_g = H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5P_CLS_ATTRIBUTE_ACCESS_ID_g = @@ -5437,8 +5452,9 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(type >= H5P_TYPE_USER && type < H5P_TYPE_MAX_TYPE); + /* Sanity checks */ + HDcompile_assert(H5P_TYPE_MAP_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_MAP_ACCESS); /* Check arguments */ if(type == H5P_TYPE_USER) @@ -5492,6 +5508,14 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_DATATYPE_ACCESS_ID_g; break; + case H5P_TYPE_MAP_CREATE: + class_id = H5P_CLS_MAP_CREATE_ID_g; + break; + + case H5P_TYPE_MAP_ACCESS: + class_id = H5P_CLS_MAP_ACCESS_ID_g; + break; + case H5P_TYPE_STRING_CREATE: class_id = H5P_CLS_STRING_CREATE_ID_g; break; diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c new file mode 100644 index 0000000..fe5be0f --- /dev/null +++ b/src/H5Pmapl.c @@ -0,0 +1,217 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Purpose: Map access property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Mprivate.h" /* Maps */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* ========= Map Access properties ============ */ +/* Definitions for key prefetch size */ +#define H5M_ACS_KEY_PREFETCH_SIZE_SIZE sizeof(size_t) +#define H5M_ACS_KEY_PREFETCH_SIZE_DEF (size_t)(16 * 1024) +#define H5M_ACS_KEY_PREFETCH_SIZE_ENC H5P__encode_size_t +#define H5M_ACS_KEY_PREFETCH_SIZE_DEC H5P__decode_size_t +/* Definition for key prefetch buffer size */ +#define H5M_ACS_KEY_ALLOC_SIZE_SIZE sizeof(size_t) +#define H5M_ACS_KEY_ALLOC_SIZE_DEF (size_t)(1024 * 1024) +#define H5M_ACS_KEY_ALLOC_SIZE_ENC H5P__encode_size_t +#define H5M_ACS_KEY_ALLOC_SIZE_DEC H5P__decode_size_t + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P__macc_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Map access property list class library initialization object */ +const H5P_libclass_t H5P_CLS_MACC[1] = {{ + "map access", /* Class name for debugging */ + H5P_TYPE_MAP_ACCESS, /* Class type */ + + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_MAP_ACCESS_g, /* Pointer to class */ + &H5P_CLS_MAP_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_MAP_ACCESS_ID_g, /* Pointer to default property list ID */ + H5P__macc_reg_prop, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P__macc_reg_prop + * + * Purpose: Register the map access property list class's + * properties + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +static herr_t +H5P__macc_reg_prop(H5P_genclass_t *pclass) +{ + size_t key_prefetch_size = H5M_ACS_KEY_PREFETCH_SIZE_DEF; /* Default key prefetch size for iteration */ + size_t key_alloc_size = H5M_ACS_KEY_ALLOC_SIZE_DEF; /* Default key prefetch allocation size for iteration */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Register the key prefetch size for iteration */ + if(H5P__register_real(pclass, H5M_ACS_KEY_PREFETCH_SIZE_NAME, H5M_ACS_KEY_PREFETCH_SIZE_SIZE, &key_prefetch_size, + NULL, NULL, NULL, H5M_ACS_KEY_PREFETCH_SIZE_ENC, H5M_ACS_KEY_PREFETCH_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the key prefetch allocation size for iteration */ + if(H5P__register_real(pclass, H5M_ACS_KEY_ALLOC_SIZE_NAME, H5M_ACS_KEY_ALLOC_SIZE_SIZE, &key_alloc_size, + NULL, NULL, NULL, H5M_ACS_KEY_ALLOC_SIZE_ENC, H5M_ACS_KEY_ALLOC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__macc_reg_prop() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_map_iterate_hints + * + * Purpose: H5Pset_map_iterate_hints adjusts the behavior of + * H5Miterate when prefetching keys for iteration. The + * KEY_PREFETCH_SIZE parameter specifies the number of keys + * to prefetch at a time during iteration. The KEY_ALLOC_SIZE + * parameter specifies the initial size of the buffer + * allocated to hold these prefetched keys. If this buffer is + * too small it will be reallocated to a larger size, though + * this may result in an additional I/O. + * + * Move to DAOS VOL code? DSINC + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "izz", mapl_id, key_prefetch_size, key_alloc_size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Set sizes */ + if(H5P_set(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, &key_prefetch_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set key prefetch size"); + if(H5P_set(plist, H5M_ACS_KEY_ALLOC_SIZE_NAME, &key_alloc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set key allocation size"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_map_iterate_hints() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_map_iterate_hints + * + * Purpose: Returns the map iterate hints, KEY_PREFETCH_SIZE and + * KEY_ALLOC_SIZE, as set by H5Pset_map_iterate_hints. + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_alloc_size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*z*z", mapl_id, key_prefetch_size, key_alloc_size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(mapl_id, H5P_MAP_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Get the properties */ + if(key_prefetch_size) { + if(H5P_get(plist, H5M_ACS_KEY_PREFETCH_SIZE_NAME, key_prefetch_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get key prefetch size"); + } /* end if */ + if(key_alloc_size) { + if(H5P_get(plist, H5M_ACS_KEY_ALLOC_SIZE_NAME, key_alloc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get key allocation size"); + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_map_iterate_hints() */ + diff --git a/src/H5Pmcpl.c b/src/H5Pmcpl.c new file mode 100644 index 0000000..41a6659 --- /dev/null +++ b/src/H5Pmcpl.c @@ -0,0 +1,115 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Pmcpl.c + * + * Purpose: Map creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Pmodule.h" /* This source code file is part of the H5P module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Mprivate.h" /* Maps */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P__mcrt_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Map create property list class library initialization object */ +const H5P_libclass_t H5P_CLS_MCRT[1] = {{ + "map create", /* Class name for debugging */ + H5P_TYPE_MAP_CREATE, /* Class type */ + + &H5P_CLS_OBJECT_CREATE_g, /* Parent class */ + &H5P_CLS_MAP_CREATE_g, /* Pointer to class */ + &H5P_CLS_MAP_CREATE_ID_g, /* Pointer to class ID */ + &H5P_LST_MAP_CREATE_ID_g, /* Pointer to default property list ID */ + H5P__mcrt_reg_prop, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/***************************/ +/* Local Private Variables */ +/***************************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P__mcrt_reg_prop + * + * Purpose: Register the map creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +static herr_t +H5P__mcrt_reg_prop(H5P_genclass_t H5_ATTR_UNUSED *pclass) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__mcrt_reg_prop() */ + diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 07910c3..9fc1acc 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -79,6 +79,8 @@ typedef enum H5P_plist_type_t { H5P_TYPE_LINK_ACCESS = 17, H5P_TYPE_ATTRIBUTE_ACCESS = 18, H5P_TYPE_VOL_INITIALIZE = 19, + H5P_TYPE_MAP_CREATE = 20, + H5P_TYPE_MAP_ACCESS = 21, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; @@ -125,6 +127,8 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_MAP_CREATE_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_MAP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g; @@ -139,6 +143,7 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_MACC[1]; /* Map access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index cad2071..43e477a 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -62,6 +62,8 @@ #define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_ID_g) #define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) +#define H5P_MAP_CREATE (H5OPEN H5P_CLS_MAP_CREATE_ID_g) +#define H5P_MAP_ACCESS (H5OPEN H5P_CLS_MAP_ACCESS_ID_g) #define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) #define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) #define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) @@ -83,6 +85,8 @@ #define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_ID_g) #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) +#define H5P_MAP_CREATE_DEFAULT (H5OPEN H5P_LST_MAP_CREATE_ID_g) +#define H5P_MAP_ACCESS_DEFAULT (H5OPEN H5P_LST_MAP_ACCESS_ID_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) #define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) @@ -191,6 +195,8 @@ H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_CLS_MAP_CREATE_ID_g; +H5_DLLVAR hid_t H5P_CLS_MAP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; @@ -211,6 +217,8 @@ H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_LST_MAP_CREATE_ID_g; +H5_DLLVAR hid_t H5P_LST_MAP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; @@ -491,6 +499,12 @@ H5_DLL herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /* H5_DLL herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags); H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /* out */); +/* Map access property list (MAPL) routines */ +#ifdef H5_HAVE_MAP_API +H5_DLL herr_t H5Pset_map_iterate_hints(hid_t mapl_id, size_t key_prefetch_size, size_t key_alloc_size); +H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size /*out*/, size_t *key_alloc_size /*out*/); +#endif /* H5_HAVE_MAP_API */ + /* String creation property list (STRCPL) routines */ H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding); H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/); diff --git a/src/H5Rint.c b/src/H5Rint.c index 2355ec1..07efae2 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -472,6 +472,9 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type, const void *_r break; } + case H5O_TYPE_MAP: + HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, H5I_INVALID_HID, "maps not supported in native VOL connector") + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/src/H5T.c b/src/H5T.c index 8eada62..6ef9478 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1740,6 +1740,7 @@ H5Tcopy(hid_t obj_id) case H5I_GROUP: case H5I_DATASPACE: case H5I_ATTR: + case H5I_MAP: case H5I_VFL: case H5I_VOL: case H5I_GENPROP_CLS: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 696ccab..0131f0e 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -6562,3 +6562,114 @@ done: FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_free() */ + +/*------------------------------------------------------------------------- + * Function: H5VL__optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the corresponding VOL callback exists */ + if(NULL == cls->optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method") + + /* Call the corresponding VOL callback */ + if((ret_value = (cls->optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_optional + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->connector) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + HDva_start(arguments, req); + arg_started = TRUE; + if((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + HDva_end(arguments); + + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, ret_value, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLoptional + * + * Purpose: Performs an optional connector-specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLoptional(void *obj, hid_t connector_id, hid_t dxpl_id, void **req, + va_list arguments) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, connector_id, dxpl_id, req, arguments); + + /* Check args and get class pointer */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if((ret_value = H5VL__optional(obj, cls, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLoptional() */ + diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 9de518f..98bc521 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -314,7 +314,7 @@ typedef struct H5VL_group_class_t { /* H5L routines */ typedef struct H5VL_link_class_t { herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list argumenmts); + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments); herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); diff --git a/src/H5VLint.c b/src/H5VLint.c index 884b2f6..f9262f4 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -552,7 +552,8 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t HDassert(vol_connector); /* Make sure type number is valid */ - if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP) + if(type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE + && type != H5I_FILE && type != H5I_GROUP && type != H5I_MAP) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number") /* Create the new VOL object */ @@ -1408,6 +1409,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_DATASET: case H5I_FILE: case H5I_ATTR: + case H5I_MAP: /* get the object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 91fa762..1752b0c 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -193,5 +193,8 @@ H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_s H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, ...); H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj); +/* Generic functions */ +H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id,void **req, ...); + #endif /* _H5VLprivate_H */ diff --git a/src/H5err.txt b/src/H5err.txt index d4edfba..9fec521 100644 --- a/src/H5err.txt +++ b/src/H5err.txt @@ -78,6 +78,7 @@ MAJOR, H5E_FARRAY, Fixed Array MAJOR, H5E_PLUGIN, Plugin for dynamically loaded library MAJOR, H5E_PAGEBUF, Page Buffering MAJOR, H5E_CONTEXT, API Context +MAJOR, H5E_MAP, Map MAJOR, H5E_NONE_MAJOR, No error # Sections (for grouping minor errors) diff --git a/src/H5private.h b/src/H5private.h index 00b7a07..89e59a0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1721,6 +1721,7 @@ typedef enum { H5_PKG_HG, /* Global heaps */ H5_PKG_HL, /* Local heaps */ H5_PKG_I, /* IDs */ + H5_PKG_M, /* Maps */ H5_PKG_MF, /* File memory management */ H5_PKG_MM, /* Core memory management */ H5_PKG_O, /* Object headers */ @@ -2637,6 +2638,8 @@ H5_DLL int H5G_term_package(void); H5_DLL int H5G_top_term_package(void); H5_DLL int H5I_term_package(void); H5_DLL int H5L_term_package(void); +H5_DLL int H5M_term_package(void); +H5_DLL int H5M_top_term_package(void); H5_DLL int H5P_term_package(void); H5_DLL int H5PL_term_package(void); H5_DLL int H5R_term_package(void); diff --git a/src/H5trace.c b/src/H5trace.c index c5d14f5..de761f8 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1359,6 +1359,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "%ld (attr)", (long)obj); break; + case H5I_MAP: + HDfprintf(out, "%ld (map)", (long)obj); + break; + case H5I_VFL: HDfprintf(out, "%ld (file driver)", (long)obj); break; @@ -1544,6 +1548,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "H5I_ATTR"); break; + case H5I_MAP: + HDfprintf(out, "H5I_MAP"); + break; + case H5I_VFL: HDfprintf(out, "H5I_VFL"); break; @@ -1799,8 +1807,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) HDfprintf(out, "H5O_TYPE_NAMED_DATATYPE"); break; + case H5O_TYPE_MAP: + HDfprintf(out, "H5O_TYPE_MAP"); + break; + case H5O_TYPE_NTYPES: - HDfprintf(out, "H5O_TYPE_TYPES"); + HDfprintf(out, "H5O_TYPE_NTYPES"); break; default: diff --git a/src/Makefile.am b/src/Makefile.am index f737d5d..1e6578e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -78,6 +78,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c \ H5HL.c H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c\ H5HP.c H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c \ + H5M.c \ H5MF.c H5MFaggr.c H5MFdbg.c H5MFsection.c \ H5MM.c H5MP.c H5MPtest.c \ H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \ @@ -95,8 +96,9 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pint.c \ - H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ + H5Pgcpl.c H5Pint.c H5Plapl.c H5Plcpl.c \ + H5Pmapl.c H5Pmcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c \ + H5Ptest.c \ H5PB.c \ H5PL.c H5PLint.c H5PLpath.c H5PLplugin_cache.c \ H5R.c H5Rint.c H5Rdeprec.c \ @@ -141,7 +143,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDfamily.h H5FDhdfs.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ H5FDmulti.h H5FDros3.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ - H5MMpublic.h H5Opublic.h H5Ppublic.h \ + H5Mpublic.h H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h H5PLpublic.h \ H5Rpublic.h H5Spublic.h H5Tpublic.h \ H5VLconnector.h H5VLconnector_passthru.h \ diff --git a/src/hdf5.h b/src/hdf5.h index 2201e9e..8367122 100644 --- a/src/hdf5.h +++ b/src/hdf5.h @@ -29,6 +29,7 @@ #include "H5Gpublic.h" /* Groups */ #include "H5Ipublic.h" /* ID management */ #include "H5Lpublic.h" /* Links */ +#include "H5Mpublic.h" /* Maps */ #include "H5MMpublic.h" /* Memory management */ #include "H5Opublic.h" /* Object headers */ #include "H5Ppublic.h" /* Property lists */ diff --git a/test/links.c b/test/links.c index f8be2b5..26b49d6 100644 --- a/test/links.c +++ b/test/links.c @@ -7108,6 +7108,9 @@ done: ret_value = -1; break; + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -7197,6 +7200,9 @@ done: ret_value = -1; break; + case H5I_MAP: + /* TODO: Not supported in native file format yet */ + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: diff --git a/test/objcopy.c b/test/objcopy.c index 47a1065..489d6dd 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1080,6 +1080,9 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR break; + case H5O_TYPE_MAP: + /* Maps not supported in native VOL connector */ + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -1138,6 +1141,9 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts, if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR break; + case H5O_TYPE_MAP: + /* Maps not supported in native VOL connector */ + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -1454,10 +1460,13 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR break; + case H5O_TYPE_MAP: + HDassert(0 && "maps not supported in native VOL connector"); + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: -HDassert(0 && "Unknown type of object"); + HDassert(0 && "Unknown type of object"); break; } /* end switch */ diff --git a/test/tfile.c b/test/tfile.c index 9e17c34..0fc391e 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1434,6 +1434,9 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, VERIFY(oid_list[i], did, "H5Fget_obj_ids"); break; + case H5I_MAP: + /* TODO: Not supported in native VOL connector yet */ + case H5I_UNINIT: case H5I_BADID: case H5I_DATATYPE: diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 17e3f18..5921609 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -1140,6 +1140,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, H5_TOOLS_DATATYPE); break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a3cd7d9..e140fff 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -763,6 +763,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen } /* end if */ break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 5519437..ee5ac12 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -914,6 +914,10 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, printf(" %-10s %s", "datatype", path); break; + case H5O_TYPE_MAP: + printf(" %-10s %s", "map", path); + break; + case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 5c47abd..821d2c7 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -393,6 +393,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR } break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -1404,6 +1405,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al handle_datatypes(handle_data->fid, path, NULL, 0, NULL); break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: @@ -2143,6 +2145,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname) handle_datatypes(group, linkname, NULL, 0, objname); break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index 2fa9fd0..fc56433 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -346,6 +346,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ } break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 5f0452c..dd03f18 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -758,6 +758,7 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "datatype_stats failed"); break; + case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: -- cgit v0.12 From df7ce9a5c933315af34dd402cfb2ca394003b56b Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Tue, 13 Aug 2019 10:10:23 -0500 Subject: Added ifdef for intel compilers, __GNUC__ has to be defined for header files which use it to work with intel compilers. This gives a warning for intel compiler about fallthrough, so added a check not to include fallthrough if using intel compilers. --- src/H5private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5private.h b/src/H5private.h index 00b7a07..a897fb9 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -317,7 +317,7 @@ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) -#if defined(__GNUC__) && __GNUC__ >= 7 +#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER) # define H5_ATTR_FALLTHROUGH __attribute__((fallthrough)); #else # define H5_ATTR_FALLTHROUGH /*void*/ -- cgit v0.12 From a7281b117c6ddc7ffd1e0b31f4ceff14d129c875 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Aug 2019 10:25:05 -0500 Subject: Correct error test spelling and use --- test/CMakeTests.cmake | 41 ++++++++- test/err_compat.c | 196 ++++++++++++++++++++++---------------------- test/testfiles/err_compat_2 | 2 +- 3 files changed, 136 insertions(+), 103 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index cc166ec..9eaf2c3 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -776,15 +776,48 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS AND NOT MINGW) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +else () + add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" + -D "TEST_OUTPUT=err_compat.txt" + -D "TEST_REFERENCE=err_compat_2" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-err_compat PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) endif () #-- Adding test for error_test if (HDF5_USE_16_API_DEFAULT OR MINGW) - add_test ( - NAME H5TEST-error_test - COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" + add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=true" + -D "ERROR_APPEND=1" + -D "TEST_OUTPUT=error_test.txt" + -D "TEST_REFERENCE=error_test_2" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5TEST-error_test PROPERTIES + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - set_property(TEST H5TEST-error_test PROPERTY DISABLED) +# add_test ( +# NAME H5TEST-error_test +# COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" +# ) +# set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" diff --git a/test/err_compat.c b/test/err_compat.c index 4860a3c..ed85524 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -12,17 +12,17 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests Error API + * Purpose: Tests Error API */ #include "h5test.h" #ifdef H5_NO_DEPRECATED_SYMBOLS int main(void) { - printf("Test skipped because backward compatability with v1.6 is NOT configured in\n"); + printf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); return 0; } #else /* H5_NO_DEPRECATED_SYMBOLS */ @@ -35,7 +35,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)-1 @@ -43,17 +43,17 @@ int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data); herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data); - + /*------------------------------------------------------------------------- - * Function: user_print1 + * Function: user_print1 * - * Purpose: This function is a user-defined old-style printing function. - * This is just a convenience function for H5Ewalk1() with a + * Purpose: This function is a user-defined old-style printing function. + * This is just a convenience function for H5Ewalk1() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -73,17 +73,17 @@ user_print1(FILE *stream) } - + /*------------------------------------------------------------------------- - * Function: user_print2 + * Function: user_print2 * - * Purpose: This function is a user-defined new-style printing function. - * This is just a convenience function for H5Ewalk2() with a + * Purpose: This function is a user-defined new-style printing function. + * This is just a convenience function for H5Ewalk2() with a * function that prints error messages. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * *------------------------------------------------------------------------- @@ -103,18 +103,18 @@ user_print2(hid_t err_stack, FILE *stream) } - + /*------------------------------------------------------------------------- * Function: custom_print_cb1 * - * Purpose: Callback function to print error stack in customized way + * Purpose: Callback function to print error stack in customized way * for H5Ewalk1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * * Modifications: @@ -124,10 +124,10 @@ user_print2(hid_t err_stack, FILE *stream) herr_t custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) { - FILE *stream = (FILE *)client_data; + FILE *stream = (FILE *)client_data; char *maj = NULL; char *min = NULL; - const int indent = 4; + const int indent = 4; if(NULL == (min = H5Eget_minor(err_desc->min_num))) TEST_ERROR; @@ -136,9 +136,9 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) TEST_ERROR; fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); - + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -152,22 +152,22 @@ error: H5free_memory(maj); if(min) H5free_memory(min); - + return -1; } - + /*------------------------------------------------------------------------- * Function: custom_print_cb2 * - * Purpose: Callback function to print error stack in customized way + * Purpose: Callback function to print error stack in customized way * for H5Ewalk1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 4 October 2010 * * Modifications: @@ -177,10 +177,10 @@ error: herr_t custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) { - FILE *stream = (FILE *)client_data; + FILE *stream = (FILE *)client_data; char *maj = NULL; char *min = NULL; - const int indent = 4; + const int indent = 4; if(NULL == (min = H5Eget_minor(err_desc->min_num))) TEST_ERROR; @@ -189,9 +189,9 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) TEST_ERROR; fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); - + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); + fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -205,22 +205,22 @@ error: H5free_memory(maj); if(min) H5free_memory(min); - + return -1; } - + /*------------------------------------------------------------------------- - * Function: test_error1 + * Function: test_error1 * - * Purpose: Test the backward compatibility of H5Eset/get_auto. + * Purpose: Test the backward compatibility of H5Eset/get_auto. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * 17 September 2010 + * Programmer: Raymond Lu + * 17 September 2010 * * * Modifications: @@ -230,8 +230,8 @@ error: static herr_t test_error1(void) { - hid_t dataset, space; - hsize_t dims[2]; + hid_t dataset, space; + hsize_t dims[2]; H5E_auto1_t old_func1; H5E_auto2_t old_func2; void *old_data; @@ -245,48 +245,48 @@ test_error1(void) dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; - /* Use H5Eget_auto2 to query the default printing function. The library + /* Use H5Eget_auto2 to query the default printing function. The library *should indicate H5Eprint2 as the default. */ if (H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data)<0) - TEST_ERROR; + TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) - TEST_ERROR; + TEST_ERROR; /* This function sets the default printing function to be H5Eprint2. */ if(H5Eset_auto2(H5E_DEFAULT, old_func2, old_data)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; /* This call should work. It simply returns H5Eprint1. */ if((ret = H5Eget_auto1(&old_func1, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func1 || (H5E_auto1_t)H5Eprint1 != old_func1) - TEST_ERROR; + TEST_ERROR; /* This function changes the old-style printing function to be user_print1. */ if(H5Eset_auto1((H5E_auto1_t)user_print1, stderr)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; - /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. - * Once the H5Eset_auto1 is called with a user-defined printing function, - * a call to H5Eget_auto2 will fail. But keep in mind the printing function is + /* This call should fail because the test mixes H5Eget_auto2 with H5Eset_auto1. + * Once the H5Eset_auto1 is called with a user-defined printing function, + * a call to H5Eget_auto2 will fail. But keep in mind the printing function is * user_print1. */ if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))>=0) TEST_ERROR; @@ -295,44 +295,44 @@ test_error1(void) if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)user_print2, stderr)<0) TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; /* This function changes the new-style printing function back to the default H5Eprint2. */ if(H5Eset_auto2(H5E_DEFAULT, (H5E_auto2_t)H5Eprint2, NULL)<0) TEST_ERROR; - /* This call should work because the H5Eset_auto2 above restored the default printing + /* This call should work because the H5Eset_auto2 above restored the default printing * function H5Eprint2. It simply returns user_print1. */ if((ret = H5Eget_auto1(&old_func1, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func1 || (H5E_auto1_t)user_print1 != old_func1) - TEST_ERROR; + TEST_ERROR; /* This function changes the new-style printing function back to the default H5Eprint1. */ if(H5Eset_auto1((H5E_auto1_t)H5Eprint1, NULL)<0) TEST_ERROR; - /* This call should work because the H5Eset_auto1 above restored the default printing + /* This call should work because the H5Eset_auto1 above restored the default printing * function H5Eprint1. It simply returns H5Eprint2. */ if((ret = H5Eget_auto2(H5E_DEFAULT, &old_func2, &old_data))<0) TEST_ERROR; if (old_data != NULL) - TEST_ERROR; + TEST_ERROR; if (!old_func2 || (H5E_auto2_t)H5Eprint2 != old_func2) - TEST_ERROR; + TEST_ERROR; - /* Try the printing function. Dataset creation should fail because the file + /* Try the printing function. Dataset creation should fail because the file * doesn't exist. */ - dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(FAKE_ID, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if(dataset >= 0) + if(dataset >= 0) TEST_ERROR; return 0; @@ -341,18 +341,18 @@ test_error1(void) return -1; } - + /*------------------------------------------------------------------------- - * Function: test_error2 + * Function: test_error2 * - * Purpose: Test error API functions, mainly on H5Epush1. + * Purpose: Test error API functions, mainly on H5Epush1. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * July 10, 2003 + * Programmer: Raymond Lu + * July 10, 2003 * * * Modifications: @@ -362,8 +362,8 @@ test_error1(void) static herr_t test_error2(hid_t file) { - hid_t dataset, space; - hsize_t dims[2]; + hid_t dataset, space; + hsize_t dims[2]; const char *FUNC_test_error="test_error2"; TESTING("error API based on data I/O"); @@ -381,7 +381,7 @@ test_error2(hid_t file) /* Create the dataset */ if ((dataset = H5Dcreate2(file, DSET_NAME, H5T_STD_I32BE, space, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5Epush1(__FILE__, FUNC_test_error, __LINE__, H5E_ERROR, H5E_CANTCREATE, "H5Dcreate2 failed"); goto error; @@ -411,18 +411,18 @@ test_error2(hid_t file) return -1; } - + /*------------------------------------------------------------------------- * Function: dump_error * - * Purpose: Prints error stack in default and customized ways. + * Purpose: Prints error stack in default and customized ways. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu - * July 17, 2003 + * Programmer: Raymond Lu + * July 17, 2003 * * * Modifications: @@ -449,14 +449,14 @@ dump_error(void) } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test error API. + * Purpose: Test error API. * - * Programmer: Raymond Lu - * July 10, 2003 + * Programmer: Raymond Lu + * July 10, 2003 * * Modifications: * @@ -465,8 +465,8 @@ dump_error(void) int main(void) { - hid_t file, fapl; - char filename[1024]; + hid_t file, fapl; + char filename[1024]; const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); @@ -474,7 +474,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR ; + TEST_ERROR ; /* Test error stack */ diff --git a/test/testfiles/err_compat_2 b/test/testfiles/err_compat_2 index 75e8769..467ba4c 100644 --- a/test/testfiles/err_compat_2 +++ b/test/testfiles/err_compat_2 @@ -1 +1 @@ -Test skipped because backward compatbility with v1.6 is NOT configured in +Test skipped because backward compatibility with v1.6 is NOT configured in -- cgit v0.12 From ac4f82fcd42758c9f3fa792b402600fe0d224c76 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Aug 2019 10:26:43 -0500 Subject: Remove old code --- test/CMakeTests.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 9eaf2c3..f763897 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -813,11 +813,6 @@ if (HDF5_USE_16_API_DEFAULT OR MINGW) ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) -# add_test ( -# NAME H5TEST-error_test -# COMMAND ${CMAKE_COMMAND} -E echo "SKIP $" -# ) -# set_property(TEST H5TEST-error_test PROPERTY DISABLED) else () add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -- cgit v0.12 From 5024051e35d4e113e7c144aed5b99f1be3cc938d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Aug 2019 08:46:56 -0700 Subject: Renamed H5Mdelete_key to H5Mdelete and H5Mset to H5Mput. --- src/H5M.c | 26 +++++++++++++------------- src/H5Mpublic.h | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/H5M.c b/src/H5M.c index 3008c40..adb4df0 100644 --- a/src/H5M.c +++ b/src/H5M.c @@ -650,9 +650,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Mset + * Function: H5Mput * - * Purpose: H5Mset adds a key-value pair to the Map specified by + * Purpose: H5Mput adds a key-value pair to the Map specified by * MAP_ID, or updates the value for the specified key if one * was set previously. KEY_MEM_TYPE_ID and VAL_MEM_TYPE_ID * specify the datatypes for the provided KEY and VALUE @@ -666,7 +666,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Mset(hid_t map_id, hid_t key_mem_type_id, const void *key, +H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id) { H5VL_object_t *vol_obj = NULL; @@ -697,12 +697,12 @@ H5Mset(hid_t map_id, hid_t key_mem_type_id, const void *key, H5CX_set_dxpl(dxpl_id); /* Set the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SET, key_mem_type_id, key, val_mem_type_id, value) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to set key/value pair") + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_PUT, key_mem_type_id, key, val_mem_type_id, value) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair") done: FUNC_LEAVE_API(ret_value) -} /* end H5Mset() */ +} /* end H5Mput() */ /*------------------------------------------------------------------------- @@ -973,9 +973,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Mdelete_key + * Function: H5Mdelete * - * Purpose: H5Mdelete_key deletes a key-value pair from the Map + * Purpose: H5Mdelete deletes a key-value pair from the Map * specified by MAP_ID. KEY_MEM_TYPE_ID specifies the * datatype for the provided key buffers, and if different * from that used to create the Map object, the key will be @@ -988,7 +988,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Mdelete_key(hid_t map_id, hid_t key_mem_type_id, const void *key, +H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id) { H5VL_object_t *vol_obj = NULL; @@ -1020,13 +1020,13 @@ H5Mdelete_key(hid_t map_id, hid_t key_mem_type_id, const void *key, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(map_id); - /* Set the key/value pair */ - if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE_KEY, key_mem_type_id, key) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to set key/value pair") + /* Delete the key/value pair */ + if(H5VL_optional(vol_obj, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_SPECIFIC, &loc_params, H5VL_MAP_DELETE, key_mem_type_id, key) < 0) + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair") done: FUNC_LEAVE_API(ret_value) -} /* end H5Mdelete_key() */ +} /* end H5Mdelete() */ #endif /* H5_HAVE_MAP_API */ diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h index 56c7d87..9cbdb32 100644 --- a/src/H5Mpublic.h +++ b/src/H5Mpublic.h @@ -37,7 +37,7 @@ #define H5VL_MAP_OPEN 2 #define H5VL_MAP_GET_VAL 3 #define H5VL_MAP_EXISTS 4 -#define H5VL_MAP_SET 5 +#define H5VL_MAP_PUT 5 #define H5VL_MAP_GET 6 #define H5VL_MAP_SPECIFIC 7 #define H5VL_MAP_CLOSE 8 @@ -59,7 +59,7 @@ typedef enum H5VL_map_get_t { /* types for map SPECIFIC callback */ typedef enum H5VL_map_specific_t { H5VL_MAP_ITER, /* H5Miterate */ - H5VL_MAP_DELETE_KEY /* H5Mdelete_key */ + H5VL_MAP_DELETE /* H5Mdelete */ } H5VL_map_specific_t; /* Callback for H5Miterate() */ @@ -95,7 +95,7 @@ H5_DLL hid_t H5Mget_val_type(hid_t map_id); H5_DLL hid_t H5Mget_create_plist(hid_t map_id); H5_DLL hid_t H5Mget_access_plist(hid_t map_id); H5_DLL herr_t H5Mget_count(hid_t map_id, hsize_t *count, hid_t dxpl_id); -H5_DLL herr_t H5Mset(hid_t map_id, hid_t key_mem_type_id, const void *key, +H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id); H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id); @@ -106,7 +106,7 @@ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id, hid_t lapl_id); -H5_DLL herr_t H5Mdelete_key(hid_t map_id, hid_t key_mem_type_id, +H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id); /* Symbols defined for compatibility with previous versions of the HDF5 API. -- cgit v0.12 From dd2133f56e175700a3453e5e7464e57b650231b8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Aug 2019 08:53:09 -0700 Subject: Fixed Map API CMake option --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6474aa..eb22c7e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,6 +763,9 @@ endif () # Option to build the map API #----------------------------------------------------------------------------- option (HDF5_ENABLE_MAP_API "Build the map API" OFF) +if (HDF5_ENABLE_MAP_API) + set (H5_HAVE_MAP_API 1) +endif () #----------------------------------------------------------------------------- # Add the HDF5 Library Target to the build -- cgit v0.12 From 7b8ffecc20ad383627ea2dbfa86aaebdf5f5b76b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 13 Aug 2019 11:04:13 -0500 Subject: HDFFV-10879 set default API version --- CMakeLists.txt | 3 ++- config/cmake/cacheinit.cmake | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 374e15e..f5921f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -642,7 +642,8 @@ if (H5_HAVE_PARALLEL) endif () endif () -#set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) +#option (DEFAULT_API_VERSION "Enable v1.12 API (v16, v18, v110, v112)" "v112") +set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)") set_property (CACHE DEFAULT_API_VERSION PROPERTY STRINGS v16 v18 v110 v112) #----------------------------------------------------------------------------- # Option to use 1.6.x API diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 01c2221..5254115 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -35,8 +35,6 @@ set (MPIEXEC_MAX_NUMPROCS "4" CACHE STRING "Minimum number of processes for HDF set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE) -set (DEFAULT_API_VERSION "v112" CACHE STRING "Enable v1.12 API (v16, v18, v110, v112)" FORCE) - set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE) set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE) -- cgit v0.12 From d95745235a468b17f697843adb3d0e54bd919893 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Aug 2019 10:55:34 -0700 Subject: Updated h5trav.c to emit output that doesn't require ddl changes for map support. --- tools/lib/h5trav.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index ee5ac12..78240db 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -915,9 +915,6 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, break; case H5O_TYPE_MAP: - printf(" %-10s %s", "map", path); - break; - case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: -- cgit v0.12 From 7555bc95d91aa99344cdc3a66d47eb44decad4ac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 13 Aug 2019 23:07:48 -0700 Subject: Added map API build status to libhdf5.settings. --- src/libhdf5.settings.in | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index baa99ea..1591bed 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -78,6 +78,7 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@ With deprecated public symbols: @DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @MPE@ + Map (H5M) API: @MAP_API@ Direct VFD: @DIRECT_VFD@ (Read-Only) S3 VFD: @ROS3_VFD@ (Read-Only) HDFS VFD: @HAVE_LIBHDFS@ -- cgit v0.12 From 10bea9ac460e781f7e71afb3b85d9a4e4678c3a1 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 14 Aug 2019 12:43:18 -0500 Subject: Fix for HDFFV-10813 H5Fset_metadata_read_retry_info() test fails on jelly with PGI/19. --- release_docs/RELEASE.txt | 17 +++++++++++++++++ src/H5Fint.c | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 094a81f..2cc880a 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -326,6 +326,23 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Fixed the test failure from test_metadata_read_retry_info() in + test/swmr.c + + The test failure is due to the incorrect number of bins returned for + retry info (info.nbins). The # of bins expected for 101 read attempts + is 3 instead of 2. The routine H5F_set_retries() in src/H5Fint.c + calculates the # of bins by first obtaining the log10 value for + (read attempts - 1). For PGI/19, the log10 value for 100 read attempts + is 1.9999999999999998 instead of 2.00000. When casting the log10 value + to unsigned later on, the decimal part is chopped off causing the test + failure. + + This was fixed by performing ((value of log10) + 1) first before casting + the result to unsigned. + + (VC - 2019/8/14, HDFFV-10813) + - Fixed an issue where creating a file with non-default file space info together with library high bound setting to H5F_LIBVER_V18. diff --git a/src/H5Fint.c b/src/H5Fint.c index c9c6658..77b0cef 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2993,7 +2993,7 @@ H5F_set_retries(H5F_t *f) f->shared->retries_nbins = 0; if(f->shared->read_attempts > 1) { tmp = HDlog10((double)(f->shared->read_attempts - 1)); - f->shared->retries_nbins = (unsigned)tmp + 1; + f->shared->retries_nbins = (unsigned)(tmp + 1); } FUNC_LEAVE_NOAPI(SUCCEED) -- cgit v0.12 From 2102be3259c14a1e4d94e8526894a16fd389f59d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 14 Aug 2019 13:50:06 -0500 Subject: HDFFV-10879 fix test varname --- test/CMakeTests.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index f763897..587af80 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -796,7 +796,7 @@ else () endif () #-- Adding test for error_test -if (HDF5_USE_16_API_DEFAULT OR MINGW) +if (DEFAULT_API_VERSION MATCHES "v16" OR MINGW) add_test (NAME H5TEST-error_test COMMAND "${CMAKE_COMMAND}" -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" -D "TEST_PROGRAM=$" -- cgit v0.12 From 7f5a5020c8ec882e6b7eceab878470003e2a8b63 Mon Sep 17 00:00:00 2001 From: Jerome Soumagne Date: Wed, 14 Aug 2019 14:41:14 -0500 Subject: Fix H5F_get_file_id and H5F__get_file_id to take app_ref parameter Fix app_ref_count from being incremented when private routines are used --- src/H5Fint.c | 10 +++++----- src/H5Fpkg.h | 2 +- src/H5Fprivate.h | 2 +- src/H5I.c | 2 +- src/H5VLnative_file.c | 3 ++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index c9c6658..8d08965 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3647,7 +3647,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F__get_file_id(H5F_t *file) +H5F__get_file_id(H5F_t *file, hbool_t app_ref) { hid_t file_id = H5I_INVALID_HID; /* File ID */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -3660,13 +3660,13 @@ H5F__get_file_id(H5F_t *file) /* If the ID does not exist, register it with the VOL connector */ if(H5I_INVALID_HID == file_id) { - if((file_id = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") file->id_exists = TRUE; } /* end if */ else { /* Increment ref count on existing ID */ - if(H5I_inc_ref(file_id, TRUE) < 0) + if(H5I_inc_ref(file_id, app_ref) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ @@ -3690,7 +3690,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F_get_file_id(hid_t obj_id, H5I_type_t type) +H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref) { H5VL_object_t *vol_obj; /* File info */ hid_t file_id = H5I_INVALID_HID; /* File ID for object */ @@ -3703,7 +3703,7 @@ H5F_get_file_id(hid_t obj_id, H5I_type_t type) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") /* Get the file through the VOL */ - if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, &file_id) < 0) + if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID") if(H5I_INVALID_HID == file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL") diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 1dd07c1..dbf68c3 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -408,7 +408,7 @@ H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); -H5_DLL hid_t H5F__get_file_id(H5F_t *file); +H5_DLL hid_t H5F__get_file_id(H5F_t *file, hbool_t app_ref); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a8ac158..838fa28 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -718,7 +718,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); -H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type); +H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); diff --git a/src/H5I.c b/src/H5I.c index a2275de..ab68e38 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2219,7 +2219,7 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5F_get_file_id(obj_id, type)) < 0) + if ((ret_value = H5F_get_file_id(obj_id, type, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") } /* end if */ else diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index eeaade6..0ac70e3 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -562,11 +562,12 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR case H5VL_NATIVE_FILE_GET_FILE_ID: { H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */ + hbool_t app_ref = (hbool_t)HDva_arg(arguments, int); hid_t *file_id = HDva_arg(arguments, hid_t *); if(NULL == (f = H5F__get_file(obj, type))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file or file object") - if((*file_id = H5F__get_file_id(f)) < 0) + if((*file_id = H5F__get_file_id(f, app_ref)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file ID") break; } -- cgit v0.12 From b234263bbf84dee17ff106b53c60fc61ce8b52a5 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 14 Aug 2019 15:08:46 -0500 Subject: Changed the name of the temporary directory from 'tmp' to a special name to avoid possible conflicts. --- test/links.c | 2 +- test/links_env.c | 2 +- test/vds.c | 2 +- test/vds_env.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/links.c b/test/links.c index 26b49d6..19e3b5b 100644 --- a/test/links.c +++ b/test/links.c @@ -39,7 +39,7 @@ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" -#define TMPDIR "tmp/" +#define TMPDIR "tmp_links/" #define TMPDIR2 "tmp2/" /* Symlinks for external link symlink test */ diff --git a/test/links_env.c b/test/links_env.c index 0cd690a..cc31d92 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -23,7 +23,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ -#define TMPDIR "tmp/" +#define TMPDIR "tmp_links_env/" #define NAME_BUF_SIZE 1024 const char *FILENAME[] = { diff --git a/test/vds.c b/test/vds.c index 25d7a0e..c98bc12 100644 --- a/test/vds.c +++ b/test/vds.c @@ -55,7 +55,7 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 -#define TMPDIR "tmp/" +#define TMPDIR "tmp_vds/" /*------------------------------------------------------------------------- diff --git a/test/vds_env.c b/test/vds_env.c index b2ca9d0..19b2d96 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -34,7 +34,7 @@ const char *FILENAME[] = { #define FILENAME_BUF_SIZE 1024 -#define TMPDIR "tmp/" +#define TMPDIR "tmp_vds_env/" /*------------------------------------------------------------------------- * Function: test_vds_prefix_second -- cgit v0.12 From 0b868668bac0d268120844adb9ad216a9a8e1395 Mon Sep 17 00:00:00 2001 From: Songyu Lu Date: Wed, 14 Aug 2019 15:22:06 -0500 Subject: Changed the directory name left out from the previous commit. --- test/links.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/links.c b/test/links.c index 19e3b5b..4ade33a 100644 --- a/test/links.c +++ b/test/links.c @@ -40,7 +40,7 @@ #define LINKED_FILE "be_extlink2.h5" #define TMPDIR "tmp_links/" -#define TMPDIR2 "tmp2/" +#define TMPDIR2 "tmp2_links/" /* Symlinks for external link symlink test */ #define SYMLINK1 TMPDIR "sym1.h5" -- cgit v0.12 From 2e5cd3d2b2d953420252c80ab5e32ac95ac0c5b3 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Wed, 14 Aug 2019 15:36:45 -0500 Subject: Fix compiler warnings with diabled ROS3 and HDFS VFDs. Fix misuse of [HD]strncpy and [HD]snprintf. Minor formatting changes. Fix test cleanup issue with java groups example. --- java/examples/groups/JavaGroupExample.sh.in | 14 +- src/H5FDhdfs.c | 484 +++++++++------- src/H5FDros3.c | 392 ++++++++----- src/H5FDs3comms.c | 863 ++++++++++++++++------------ src/H5FDs3comms.h | 2 + test/hdfs.c | 443 ++++++-------- test/ros3.c | 170 +++--- test/s3comms.c | 215 +++---- tools/src/h5dump/h5dump.c | 4 + tools/src/h5ls/h5ls.c | 4 + tools/src/h5stat/h5stat.c | 8 +- 11 files changed, 1416 insertions(+), 1183 deletions(-) diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 9d4673f..acc606f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -179,17 +179,9 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - $RM $BLDDIR/examples.groups.H5Ex_G_*.txt - $RM $BLDDIR/H5Ex_G_*.out - $RM $BLDDIR/H5Ex_G_*.h5 - $RM $BLDDIR/h5ex_g_*.h5 - SDIR=`$DIRNAME $tstfile` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then SDIR=`$DIRNAME $tstfile` - $RM $BLDDIR/h5ex_g_iterate.h5 - $RM $BLDDIR/h5ex_g_visit.h5 - fi + $RM $BLDDIR/examples.groups.H5Ex_G_*.txt + $RM $BLDDIR/H5Ex_G_*.out + $RM $BLDDIR/H5Ex_G_*.h5 } COPY_ITERFILES="$LIST_ITER_FILES" diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index e3e11b2..83d0202 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -130,6 +130,8 @@ typedef struct { #endif /* HDFS_STATS */ +#ifdef H5_HAVE_LIBHDFS + /* "unique" identifier for `hdfs_t` structures. * Randomly generated by unweighted dice rolls. */ @@ -143,7 +145,7 @@ typedef struct { * Purpose: * * Contain/retain information associated with a file hosted on Hadoop - * Distributed File System (HDFS). Instantiated and populated via + * Distributed File System (HDFS). Instantiated and populated via * `H5FD_hdfs_handle_open()` and cleaned up via `H5FD_hdfs_handle_close()`. * * @@ -179,14 +181,11 @@ typedef struct { */ typedef struct { unsigned long magic; -#ifdef H5_HAVE_LIBHDFS hdfsFS filesystem; hdfsFileInfo *fileinfo; - hdfsFile file; -#endif + hdfsFile file; } hdfs_t; -#ifdef H5_HAVE_LIBHDFS /*-------------------------------------------------------------------------- * Function: H5FD_hdfs_handle_open @@ -274,7 +273,7 @@ H5FD_hdfs_handle_open( "hdfsGetPathInfo failed") } handle->file = hdfsOpenFile( - handle->filesystem, + handle->filesystem, path, O_RDONLY, stream_buffer_size, @@ -292,18 +291,18 @@ done: /* error; clean up */ HDassert(handle->magic == HDFS_HDFST_MAGIC); handle->magic++; - if (handle->file != NULL) { + if (handle->file != NULL) { if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") } } - if (handle->fileinfo != NULL) { + if (handle->fileinfo != NULL) { hdfsFreeFileInfo(handle->fileinfo, 1); } - if (handle->filesystem != NULL) { + if (handle->filesystem != NULL) { if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") } } @@ -351,18 +350,18 @@ H5FD_hdfs_handle_close(hdfs_t *handle) } handle->magic++; - if (handle->file != NULL) { + if (handle->file != NULL) { if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") } } - if (handle->fileinfo != NULL) { + if (handle->fileinfo != NULL) { hdfsFreeFileInfo(handle->fileinfo, 1); } - if (handle->filesystem != NULL) { + if (handle->filesystem != NULL) { if (FAIL == (hdfsDisconnect(handle->filesystem))) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") } } @@ -373,6 +372,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_hdfs_close() */ + #endif /* H5_HAVE_LIBHDFS */ @@ -382,9 +382,9 @@ done: * * Purpose: * - * H5FD_hdfs_t is a structure used to store all information needed to + * H5FD_hdfs_t is a structure used to store all information needed to * maintain R/O access to a single HDF5 file in an HDFS file system. - * This structure is created when such a file is "opened" and + * This structure is created when such a file is "opened" and * discarded when it is "closed". * * @@ -396,7 +396,7 @@ done: * * `fa` (H5FD_hdfs_fapl_t) * - * Instance of `H5FD_hdfs_fapl_t` containing the HDFS configuration data + * Instance of `H5FD_hdfs_fapl_t` containing the HDFS configuration data * needed to "open" the HDF5 file. * * `eoa` (haddr_t) @@ -405,9 +405,9 @@ done: * equal the file size. * * `hdfs_handle` (hdfs_t *) - * + * * Instance of HDFS Request handle associated with the target resource. - * Responsible for communicating with remote host and presenting file + * Responsible for communicating with remote host and presenting file * contents as indistinguishable from a file on the local filesystem. * * *** present only if HDFS_SATS is flagged to enable stats collection *** @@ -456,10 +456,13 @@ typedef struct H5FD_hdfs_t { * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' * is too large to be represented by the second argument * of the file seek function. + * Only included if HDFS code should compile. * */ #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#ifdef H5_HAVE_LIBHDFS #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#endif /* H5_HAVE_LIBHDFS */ /* Prototypes */ static herr_t H5FD_hdfs_term(void); @@ -474,13 +477,13 @@ static herr_t H5FD_hdfs_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t type); static herr_t H5FD_hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD_hdfs_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD_hdfs_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD_hdfs_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD_hdfs_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_hdfs_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_hdfs_unlock(H5FD_t *_file); @@ -521,8 +524,10 @@ static const H5FD_class_t H5FD_hdfs_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +#ifdef H5_HAVE_LIBHDFS /* Declare a free list to manage the H5FD_hdfs_t struct */ H5FL_DEFINE_STATIC(H5FD_hdfs_t); +#endif /* H5_HAVE_LIBHDFS */ /*------------------------------------------------------------------------- @@ -545,7 +550,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC if (H5FD_hdfs_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize hdfs VFD") } @@ -643,8 +648,8 @@ H5FD_hdfs_term(void) * Function: H5Pset_fapl_hdfs * * Purpose: Modify the file access property list to use the H5FD_HDFS - * driver defined in this source file. All driver specfic - * properties are passed in as a pointer to a suitably + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably * initialized instance of H5FD_hdfs_fapl_t * * Return: SUCCEED/FAIL @@ -658,7 +663,7 @@ H5FD_hdfs_term(void) *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_hdfs(hid_t fapl_id, +H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) { H5P_genplist_t *plist = NULL; /* Property list pointer */ @@ -674,7 +679,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { + if (plist == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ "not a file access property list") } @@ -699,12 +704,12 @@ done: * contains internally consistant data. Return SUCCEED if so, * and FAIL otherwise. * - * Note the difference between internally consistant and - * correct. As we will have to try to access the target + * Note the difference between internally consistant and + * correct. As we will have to try to access the target * object to determine whether the supplied data is correct, * we will settle for internal consistancy at this point * - * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally + * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally * consistant data, FAIL otherwise. * * Programmer: Jacob Smith @@ -761,7 +766,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_hdfs(hid_t fapl_id, +H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) { const H5FD_hdfs_fapl_t *fa = NULL; @@ -832,7 +837,7 @@ H5FD_hdfs_fapl_get(H5FD_t *_file) fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } @@ -878,7 +883,7 @@ H5FD_hdfs_fapl_copy(const void *_old_fa) new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } @@ -916,7 +921,7 @@ H5FD_hdfs_fapl_free(void *_fa) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(fa != NULL); /* sanity check */ + HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); @@ -994,11 +999,11 @@ done: * Create and/or opens a file as an HDF5 file. * * Any flag except H5F_ACC_RDONLY will cause an error. - * + * * Return: * - * Success: A pointer to a new file data structure. - * The public fields will be initialized by the caller, which is + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is * always H5FD_open(). * * Failure: NULL @@ -1010,26 +1015,21 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS static H5FD_t * H5FD_hdfs_open( - const char *path, - unsigned flags, - hid_t fapl_id, + const char *path, + unsigned flags, + hid_t fapl_id, haddr_t maxaddr) { H5FD_t *ret_value = NULL; -#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_t *file = NULL; hdfs_t *handle = NULL; H5FD_hdfs_fapl_t fa; -#endif FUNC_ENTER_NOAPI_NOINIT -#ifndef H5_HAVE_LIBHDFS - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, - "Illegal open of unsupported virtual file (hdfs)"); -#else #if HDFS_DEBUG HDfprintf(stdout, "H5FD_hdfs_open() called.\n"); #endif /* HDFS_DEBUG */ @@ -1078,11 +1078,11 @@ H5FD_hdfs_open( HDassert(handle->magic == HDFS_HDFST_MAGIC); - /* create new file struct + /* create new file struct */ file = H5FL_CALLOC(H5FD_hdfs_t); if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") } file->hdfs_handle = handle; @@ -1090,33 +1090,53 @@ H5FD_hdfs_open( #if HDFS_STATS if (FAIL == hdfs_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") } #endif /* HDFS_STATS */ ret_value = (H5FD_t*)file; -#endif /* H5_HAVE_LIBHDFS */ done: -#ifdef H5_HAVE_LIBHDFS if (ret_value == NULL) { - if (handle != NULL) { + if (handle != NULL) { if (FAIL == H5FD_hdfs_handle_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle") } } if (file != NULL) { file = H5FL_FREE(H5FD_hdfs_t, file); } - } /* if null return value (error) */ -#endif /* H5_HAVE_LIBHDFS */ + } /* end if null return value (error) */ + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD_hdfs_open() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static H5FD_t * +H5FD_hdfs_open( + const char H5_ATTR_UNUSED *path, + unsigned H5_ATTR_UNUSED flags, + hid_t H5_ATTR_UNUSED fapl_id, + haddr_t H5_ATTR_UNUSED maxaddr) +{ + H5FD_t *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, + "Illegal open of unsupported virtual file (hdfs)"); +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_hdfs_open() */ +#endif /* H5_HAVE_LIBHDFS */ + #if HDFS_STATS /*---------------------------------------------------------------------------- @@ -1124,7 +1144,7 @@ done: * Function: hdfs_fprint_stats() * * Purpose: - * + * * Tabulate and pretty-print statistics for this virtual file. * * Should be called upon file close. @@ -1145,17 +1165,17 @@ done: * - max (largest size read) * 2. tabulation of "bins", sepraring reads into exponentially-larger * ranges of size. - * - columns for number of reads, total bytes, and average size, with + * - columns for number of reads, total bytes, and average size, with * separate sub-colums for raw- and metadata reads. * - each row represents one bin, identified by the top of its range - * + * * Bin ranges can be modified with pound-defines at the top of this file. * * Bins without any reads in their bounds are not printed. * * An "overflow" bin is also present, to catch "big" reads. * - * Output for all bins (and range ceiling and average size report) + * Output for all bins (and range ceiling and average size report) * is divied by powers of 1024. By corollary, four digits before the decimal * is valid. * @@ -1216,36 +1236,6 @@ hdfs_fprint_stats( "hdfs handle has invalid magic") } - /* TODO: See what libhdfs exposes to us. */ - -#if 0 - if (file->s3r_handle->purl == NULL) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "parsed url structure cannot be null") - } - purl = file->s3r_handle->purl; - - /****************** - * PRINT FILENAME * - ******************/ - - HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); - if (purl->port != NULL && purl->port[0] != '\0') { - HDfprintf(stream, ":%s", purl->port); - } - if (purl->query != NULL && purl->query[0] != '\0') { - if (purl->path != NULL && purl->path[0] != '\0') { - HDfprintf(stream, "/%s", purl->path); - } else { - HDfprintf(stream, "/"); - } - HDfprintf(stream, "?%s", purl->query); - } else if (purl->path != NULL && purl->path[0] != '\0') { - HDfprintf(stream, "/%s", purl->path); - } - HDfprintf(stream, "\n"); -#endif - /******************* * AGGREGATE STATS * *******************/ @@ -1254,18 +1244,22 @@ hdfs_fprint_stats( const hdfs_statsbin *r = &file->raw[i]; const hdfs_statsbin *m = &file->meta[i]; - if (m->min < min_meta) min_meta = m->min; - if (r->min < min_raw) min_raw = r->min; - if (m->max > max_meta) max_meta = m->max; - if (r->max > max_raw) max_raw = r->max; + if (m->min < min_meta) { min_meta = m->min; } + if (r->min < min_raw) { min_raw = r->min; } + if (m->max > max_meta) { max_meta = m->max; } + if (r->max > max_raw) { max_raw = r->max; } count_raw += r->count; count_meta += m->count; bytes_raw += r->bytes; bytes_meta += m->bytes; } - if (count_raw > 0) average_raw = (double)bytes_raw / (double)count_raw; - if (count_meta > 0) average_meta = (double)bytes_meta / (double)count_meta; + if (count_raw > 0) { + average_raw = (double)bytes_raw / (double)count_raw; + } + if (count_meta > 0) { + average_meta = (double)bytes_meta / (double)count_meta; + } /****************** * PRINT OVERVIEW * @@ -1342,9 +1336,9 @@ hdfs_fprint_stats( * PRINT INDIVIDUAL BIN STATS * ******************************/ - HDfprintf(stream, + HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, + HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { @@ -1414,7 +1408,7 @@ hdfs_fprint_stats( HDassert(suffix_i < sizeof(suffixes)); HDfprintf( - stream, + stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, suffixes[suffix_i], /* bin ceiling */ m->count, /* metadata reads */ @@ -1428,7 +1422,6 @@ hdfs_fprint_stats( done: FUNC_LEAVE_NOAPI(ret_value); - } /* hdfs_fprint_stats */ #endif /* HDFS_STATS */ @@ -1442,7 +1435,7 @@ done: * Close an HDF5 file. * * Return: - * + * * SUCCEED/FAIL * * Programmer: Jacob Smith @@ -1452,35 +1445,31 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static herr_t H5FD_hdfs_close(H5FD_t *_file) { herr_t ret_value = SUCCEED; -#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; -#endif FUNC_ENTER_NOAPI_NOINIT -#ifndef H5_HAVE_LIBHDFS - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, - "Illegal close of unsupported Virtual File (hdfs)") -#else #if HDFS_DEBUG HDfprintf(stdout, "H5FD_hdfs_close() called.\n"); #endif - /* Sanity checks + /* Sanity checks */ HDassert(file != NULL); HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); - /* Close the underlying request handle + /* Close the underlying request handle */ - if (file->hdfs_handle != NULL) { + if (file->hdfs_handle != NULL) { if (FAIL == H5FD_hdfs_handle_close(file->hdfs_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle") } } @@ -1488,21 +1477,37 @@ H5FD_hdfs_close(H5FD_t *_file) #if HDFS_STATS /* TODO: mechanism to re-target stats printout */ if (FAIL == hdfs_fprint_stats(stdout, file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") } #endif /* HDFS_STATS */ - /* Release the file info + /* Release the file info */ file = H5FL_FREE(H5FD_hdfs_t, file); -#endif /* H5_HAVE_LIBHDFS */ done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_hdfs_close() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static herr_t +H5FD_hdfs_close(H5FD_t H5_ATTR_UNUSED *_file) +{ + herr_t ret_value = SUCCEED; + FUNC_ENTER_NOAPI_NOINIT + + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "Illegal close of unsupported Virtual File (hdfs)") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_close() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * @@ -1527,21 +1532,21 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static int -H5FD_hdfs_cmp(const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD_hdfs_cmp( + const H5FD_t *_f1, + const H5FD_t *_f2) { int ret_value = 0; -#ifdef H5_HAVE_LIBHDFS const H5FD_hdfs_t *f1 = (const H5FD_hdfs_t *)_f1; const H5FD_hdfs_t *f2 = (const H5FD_hdfs_t *)_f2; hdfsFileInfo *finfo1 = NULL; hdfsFileInfo *finfo2 = NULL; -#endif /* H5_HAVE_LIBHDFS */ FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef H5_HAVE_LIBHDFS #if HDFS_DEBUG HDfprintf(stdout, "H5FD_hdfs_cmp() called.\n"); #endif /* HDFS_DEBUG */ @@ -1556,23 +1561,37 @@ H5FD_hdfs_cmp(const H5FD_t *_f1, HDassert(finfo1 != NULL); HDassert(finfo2 != NULL); - if (finfo1->mKind != finfo2->mKind) HGOTO_DONE(-1); - if (finfo1->mName != finfo2->mName) HGOTO_DONE(-1); - if (finfo1->mLastMod != finfo2->mLastMod) HGOTO_DONE(-1); - if (finfo1->mSize != finfo2->mSize) HGOTO_DONE(-1); - if (finfo1->mReplication != finfo2->mReplication) HGOTO_DONE(-1); - if (finfo1->mBlockSize != finfo2->mBlockSize) HGOTO_DONE(-1); - if (strcmp(finfo1->mOwner, finfo2->mOwner)) HGOTO_DONE(-1); - if (strcmp(finfo1->mGroup, finfo2->mGroup)) HGOTO_DONE(-1); - if (finfo1->mPermissions != finfo2->mPermissions) HGOTO_DONE(-1); - if (finfo1->mLastAccess != finfo2->mLastAccess) HGOTO_DONE(-1); -#endif /* H5_HAVE_LIBHDFS */ + if (finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); } + if (finfo1->mName != finfo2->mName) { HGOTO_DONE(-1); } + if (finfo1->mLastMod != finfo2->mLastMod) { HGOTO_DONE(-1); } + if (finfo1->mSize != finfo2->mSize) { HGOTO_DONE(-1); } + if (finfo1->mReplication != finfo2->mReplication) { HGOTO_DONE(-1); } + if (finfo1->mBlockSize != finfo2->mBlockSize) { HGOTO_DONE(-1); } + if (strcmp(finfo1->mOwner, finfo2->mOwner)) { HGOTO_DONE(-1); } + if (strcmp(finfo1->mGroup, finfo2->mGroup)) { HGOTO_DONE(-1); } + if (finfo1->mPermissions != finfo2->mPermissions) { HGOTO_DONE(-1); } + if (finfo1->mLastAccess != finfo2->mLastAccess) { HGOTO_DONE(-1); } done: FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD_hdfs_cmp() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static int +H5FD_hdfs_cmp( + const H5FD_t H5_ATTR_UNUSED *_f1, + const H5FD_t H5_ATTR_UNUSED *_f2) +{ + int ret_value = 0; + FUNC_ENTER_NOAPI_NOINIT_NOERR + + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_hdfs_cmp() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * Function: H5FD_hdfs_query @@ -1580,7 +1599,7 @@ done: * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Note that since the HDFS VFD is read only, most flags + * Note that since the HDFS VFD is read only, most flags * are irrelevant. * * The term "set" is highly misleading... @@ -1595,7 +1614,7 @@ done: */ static herr_t H5FD_hdfs_query( - const H5FD_t H5_ATTR_UNUSED *_file, + const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) /* out variable */ { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1606,11 +1625,10 @@ H5FD_hdfs_query( if (flags) { *flags = 0; - *flags |= H5FD_FEAT_DATA_SIEVE; + *flags |= H5FD_FEAT_DATA_SIEVE; } FUNC_LEAVE_NOAPI(SUCCEED) - } /* H5FD_hdfs_query() */ @@ -1635,14 +1653,14 @@ H5FD_hdfs_query( * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static haddr_t H5FD_hdfs_get_eoa( - const H5FD_t *_file, + const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { -#ifdef H5_HAVE_LIBHDFS const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; -#endif /* H5_HAVE_LIBHDFS */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1650,14 +1668,27 @@ H5FD_hdfs_get_eoa( HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); #endif -#ifdef H5_HAVE_LIBHDFS FUNC_LEAVE_NOAPI(file->eoa) -#else - FUNC_LEAVE_NOAPI(0) -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD_hdfs_get_eoa() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static haddr_t +H5FD_hdfs_get_eoa( + const H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_eoa() called.\n"); +#endif + + FUNC_LEAVE_NOAPI(0) } /* end H5FD_hdfs_get_eoa() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * @@ -1678,15 +1709,15 @@ H5FD_hdfs_get_eoa( * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static herr_t H5FD_hdfs_set_eoa( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, + H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { -#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; -#endif /* H5_HAVE_LIBHDFS */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1694,16 +1725,30 @@ H5FD_hdfs_set_eoa( HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); #endif -#ifdef H5_HAVE_LIBHDFS file->eoa = addr; FUNC_LEAVE_NOAPI(SUCCEED) -#else - FUNC_LEAVE_NOAPI(FAIL) -#endif /* H5_HAVE_LIBHDFS */ +} /* H5FD_hdfs_set_eoa() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static herr_t +H5FD_hdfs_set_eoa( + H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + haddr_t H5_ATTR_UNUSED addr) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_set_eoa() called.\n"); +#endif + + FUNC_LEAVE_NOAPI(FAIL) } /* H5FD_hdfs_set_eoa() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * @@ -1715,7 +1760,7 @@ H5FD_hdfs_set_eoa( * * Return: * - * EOF: the first address past the end of the "file", either the + * EOF: the first address past the end of the "file", either the * filesystem file or the HDF5 file. * * Programmer: Jacob Smith @@ -1723,14 +1768,14 @@ H5FD_hdfs_set_eoa( * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static haddr_t H5FD_hdfs_get_eof( - const H5FD_t *_file, + const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { -#ifdef H5_HAVE_LIBHDFS const H5FD_hdfs_t *file = (const H5FD_hdfs_t *)_file; -#endif /* H5_HAVE_LIBHDFS */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1738,17 +1783,30 @@ H5FD_hdfs_get_eof( HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); #endif -#ifdef H5_HAVE_LIBHDFS HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); FUNC_LEAVE_NOAPI((size_t) file->hdfs_handle->fileinfo->mSize) -#else - FUNC_LEAVE_NOAPI((size_t)0) -#endif /* H5_HAVE_LIBHDFS */ +} /* end H5FD_hdfs_get_eof() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static haddr_t +H5FD_hdfs_get_eof( + const H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_eof() called.\n"); +#endif + + FUNC_LEAVE_NOAPI((size_t)0) } /* end H5FD_hdfs_get_eof() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * @@ -1769,16 +1827,16 @@ H5FD_hdfs_get_eof( * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static herr_t H5FD_hdfs_get_handle( - H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, + H5FD_t *_file, + hid_t H5_ATTR_UNUSED fapl, void **file_handle) { herr_t ret_value = SUCCEED; -#ifdef H5_HAVE_LIBHDFS H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; -#endif FUNC_ENTER_NOAPI_NOINIT @@ -1786,29 +1844,48 @@ H5FD_hdfs_get_handle( HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); #endif /* HDFS_DEBUG */ -#ifdef H5_HAVE_LIBHDFS if (!file_handle) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") } *file_handle = file->hdfs_handle; -#else + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_hdfs_get_handle() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static herr_t +H5FD_hdfs_get_handle( + H5FD_t H5_ATTR_UNUSED *_file, + hid_t H5_ATTR_UNUSED fapl, + void H5_ATTR_UNUSED **file_handle) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_get_handle() called.\n"); +#endif /* HDFS_DEBUG */ + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "Illegal get-handle of unsupported virtual file (hdfs)"); -#endif /* H5_HAVE_LIBHDFS */ done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_hdfs_get_handle() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * * Function: H5FD_hdfs_read() * - * Purpose: + * Purpose: * * Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in DXPL_ID. @@ -1828,20 +1905,20 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_LIBHDFS + static herr_t H5FD_hdfs_read( - H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, + H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, /* start offset */ size_t size, /* length of read */ void *buf) /* out */ { herr_t ret_value = SUCCEED; -#if H5_HAVE_LIBHDFS H5FD_hdfs_t *file = (H5FD_hdfs_t *)_file; size_t filesize = 0; -#endif /* H5_HAVE_LIBHDFS */ #if HDFS_STATS /* working variables for storing stats */ hdfs_statsbin *bin = NULL; @@ -1854,10 +1931,6 @@ H5FD_hdfs_read( HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); #endif /* HDFS_DEBUG */ -#ifndef H5_HAVE_LIBHDFS - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, - "Illegal get-handle of unsupported virtual file (hdfs)"); -#else HDassert(file != NULL); HDassert(file->hdfs_handle != NULL); HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); @@ -1894,37 +1967,64 @@ H5FD_hdfs_read( ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin + /* Store collected stats in appropriate bin */ if (bin->count == 0) { bin->min = size; bin->max = size; - } else { - if (size < bin->min) bin->min = size; - if (size > bin->max) bin->max = size; + } + else { + if (size < bin->min) { bin->min = size; } + if (size > bin->max) { bin->max = size; } } bin->count++; bin->bytes += (unsigned long long)size; #endif /* HDFS_STATS */ -#endif /* H5_HAVE_LIBHDFS */ done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_hdfs_read() */ + +#else /* H5_HAVE_LIBHDFS not defined */ + +static herr_t +H5FD_hdfs_read( + H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, + hid_t H5_ATTR_UNUSED dxpl_id, + haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, + void H5_ATTR_UNUSED *buf) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if HDFS_DEBUG + HDfprintf(stdout, "H5FD_hdfs_read() called.\n"); +#endif /* HDFS_DEBUG */ + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, + "Illegal get-handle of unsupported virtual file (hdfs)"); +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_hdfs_read() */ +#endif /* H5_HAVE_LIBHDFS */ + /*------------------------------------------------------------------------- * * Function: H5FD_hdfs_write() * - * Purpose: + * Purpose: * * Write bytes to file. * UNSUPPORTED IN READ-ONLY HDFS VFD. * - * Return: + * Return: * * FAIL (Not possible with Read-Only S3 file.) * @@ -1937,11 +2037,11 @@ done: */ static herr_t H5FD_hdfs_write( - H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, + H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, + haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; @@ -1957,7 +2057,6 @@ H5FD_hdfs_write( done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_hdfs_write() */ @@ -1985,8 +2084,8 @@ done: */ static herr_t H5FD_hdfs_truncate( - H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, + H5FD_t H5_ATTR_UNUSED *_file, + hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; @@ -2002,7 +2101,6 @@ H5FD_hdfs_truncate( done: FUNC_LEAVE_NOAPI(ret_value) - } /* end H5FD_hdfs_truncate() */ @@ -2031,12 +2129,11 @@ done: */ static herr_t H5FD_hdfs_lock( - H5FD_t H5_ATTR_UNUSED *_file, + H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { FUNC_ENTER_NOAPI_NOINIT_NOERR FUNC_LEAVE_NOAPI(SUCCEED) - } /* end H5FD_hdfs_lock() */ @@ -2065,6 +2162,5 @@ H5FD_hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) { FUNC_ENTER_NOAPI_NOINIT_NOERR FUNC_LEAVE_NOAPI(SUCCEED) - } /* end H5FD_hdfs_unlock() */ diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 86642aa..18f1f91 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -11,12 +11,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Programmer: Jacob Smith * 2017-10-13 * - * Purpose: + * Purpose: * * Provide read-only access to files hosted on Amazon's S3 service. * Relies on "s3comms" utility layer to implement the AWS REST API. @@ -137,9 +137,9 @@ typedef struct { * * Purpose: * - * H5FD_ros3_t is a structure used to store all information needed to + * H5FD_ros3_t is a structure used to store all information needed to * maintain R/O access to a single HDF5 file that has been stored as a - * S3 object. This structure is created when such a file is "opened" and + * S3 object. This structure is created when such a file is "opened" and * discarded when it is "closed". * * Presents an S3 object as a file to the HDF5 library. @@ -154,7 +154,7 @@ typedef struct { * * `fa` (H5FD_ros3_fapl_t) * - * Instance of `H5FD_ros3_fapl_t` containing the S3 configuration data + * Instance of `H5FD_ros3_fapl_t` containing the S3 configuration data * needed to "open" the HDF5 file. * * `eoa` (haddr_t) @@ -163,9 +163,9 @@ typedef struct { * equal the file size. * * `s3r_handle` (s3r_t *) - * + * * Instance of S3 Request handle associated with the target resource. - * Responsible for communicating with remote host and presenting file + * Responsible for communicating with remote host and presenting file * contents as indistinguishable from a file on the local filesystem. * * *** present only if ROS3_SATS is flagged to enable stats collection *** @@ -211,10 +211,13 @@ typedef struct H5FD_ros3_t { * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' * is too large to be represented by the second argument * of the file seek function. + * Only included if it may be used -- ROS3 VFD is enabled. * */ #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) +#ifdef H5_HAVE_ROS3_VFD #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#endif /* H5_HAVE_ROS3_VFD */ /* Prototypes */ static herr_t H5FD_ros3_term(void); @@ -229,13 +232,13 @@ static herr_t H5FD_ros3_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t type); static herr_t H5FD_ros3_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t type); -static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, +static herr_t H5FD_ros3_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); -static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD_ros3_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf); -static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, +static herr_t H5FD_ros3_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf); -static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id, +static herr_t H5FD_ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_ros3_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_ros3_unlock(H5FD_t *_file); @@ -276,8 +279,10 @@ static const H5FD_class_t H5FD_ros3_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; +#ifdef H5_HAVE_ROS3_VFD /* Declare a free list to manage the H5FD_ros3_t struct */ H5FL_DEFINE_STATIC(H5FD_ros3_t); +#endif /* H5_HAVE_ROS3_VFD */ /*------------------------------------------------------------------------- @@ -300,14 +305,14 @@ H5FD__init_package(void) FUNC_ENTER_STATIC if (H5FD_ros3_init() < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize ros3 VFD") } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD__init_package() */ +} /* end H5FD__init_package() */ /*------------------------------------------------------------------------- @@ -330,7 +335,7 @@ done: hid_t H5FD_ros3_init(void) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) @@ -388,6 +393,7 @@ H5FD_ros3_term(void) H5FD_ROS3_g = 0; FUNC_LEAVE_NOAPI(SUCCEED) + } /* end H5FD_ros3_term() */ @@ -395,8 +401,8 @@ H5FD_ros3_term(void) * Function: H5Pset_fapl_ros3 * * Purpose: Modify the file access property list to use the H5FD_ROS3 - * driver defined in this source file. All driver specfic - * properties are passed in as a pointer to a suitably + * driver defined in this source file. All driver specfic + * properties are passed in as a pointer to a suitably * initialized instance of H5FD_ros3_fapl_t * * Return: SUCCEED/FAIL @@ -407,14 +413,12 @@ H5FD_ros3_term(void) *------------------------------------------------------------------------- */ herr_t -H5Pset_fapl_ros3(hid_t fapl_id, +H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa) { H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = FAIL; - - FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa); @@ -425,21 +429,21 @@ H5Pset_fapl_ros3(hid_t fapl_id, #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); - if (plist == NULL) { + if (plist == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, \ "not a file access property list") } - if (FAIL == H5FD_ros3_validate_config(fa)) + if (FAIL == H5FD_ros3_validate_config(fa)) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") + } ret_value = H5P_set_driver(plist, H5FD_ROS3, (void *)fa); done: - FUNC_LEAVE_API(ret_value) -} /* H5Pset_fapl_ros3() */ +} /* end H5Pset_fapl_ros3() */ /*------------------------------------------------------------------------- @@ -449,12 +453,12 @@ done: * contains internally consistant data. Return SUCCEED if so, * and FAIL otherwise. * - * Note the difference between internally consistant and - * correct. As we will have to try to access the target + * Note the difference between internally consistant and + * correct. As we will have to try to access the target * object to determine whether the supplied data is correct, * we will settle for internal consistancy at this point * - * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally + * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally * consistant data, FAIL otherwise. * * Programmer: Jacob Smith @@ -494,7 +498,7 @@ H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_ros3_validate_config() */ +} /* end H5FD_ros3_validate_config() */ /*------------------------------------------------------------------------- @@ -515,12 +519,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_fapl_ros3(hid_t fapl_id, +H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out) { - const H5FD_ros3_fapl_t *fa; - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5FD_ros3_fapl_t *fa = NULL; + H5P_genplist_t *plist = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", fapl_id, fa_out); @@ -529,8 +533,9 @@ H5Pget_fapl_ros3(hid_t fapl_id, HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); #endif - if (fa_out == NULL) + if (fa_out == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_out is NULL") + } plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (plist == NULL) { @@ -552,7 +557,7 @@ H5Pget_fapl_ros3(hid_t fapl_id, done: FUNC_LEAVE_API(ret_value) -} /* H5Pget_fapl_ros3() */ +} /* end H5Pget_fapl_ros3() */ /*------------------------------------------------------------------------- @@ -583,7 +588,7 @@ H5FD_ros3_fapl_get(H5FD_t *_file) fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); if (fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } @@ -595,12 +600,13 @@ H5FD_ros3_fapl_get(H5FD_t *_file) done: if (ret_value == NULL) { - if (fa != NULL) - H5MM_xfree(fa); + if (fa != NULL) { + H5MM_xfree(fa); + } } FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_ros3_fapl_get() */ +} /* end H5FD_ros3_fapl_get() */ /*------------------------------------------------------------------------- @@ -624,13 +630,13 @@ H5FD_ros3_fapl_copy(const void *_old_fa) { const H5FD_ros3_fapl_t *old_fa = (const H5FD_ros3_fapl_t*)_old_fa; H5FD_ros3_fapl_t *new_fa = NULL; - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT new_fa = (H5FD_ros3_fapl_t *)H5MM_malloc(sizeof(H5FD_ros3_fapl_t)); if (new_fa == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -639,12 +645,13 @@ H5FD_ros3_fapl_copy(const void *_old_fa) done: if (ret_value == NULL) { - if (new_fa != NULL) + if (new_fa != NULL) { H5MM_xfree(new_fa); + } } FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_ros3_fapl_copy() */ +} /* end H5FD_ros3_fapl_copy() */ /*------------------------------------------------------------------------- @@ -668,13 +675,13 @@ H5FD_ros3_fapl_free(void *_fa) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(fa != NULL); /* sanity check */ + HDassert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_ros3_fapl_free() */ +} /* end H5FD_ros3_fapl_free() */ #if ROS3_STATS @@ -707,7 +714,6 @@ ros3_reset_stats(H5FD_ros3_t *file) unsigned i = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT #if ROS3_DEBUG @@ -734,7 +740,8 @@ ros3_reset_stats(H5FD_ros3_t *file) done: FUNC_LEAVE_NOAPI(ret_value); -} /* ros3_reset_stats */ +} /* end ros3_reset_stats() */ + #endif /* ROS3_STATS */ @@ -747,10 +754,10 @@ done: * Create and/or opens a file as an HDF5 file. * * Any flag except H5F_ACC_RDONLY will cause an error. - * + * * Name (as received from `H5FD_open()`) must conform to web url: * NAME :: HTTP "://" DOMAIN [PORT] ["/" [URI] [QUERY] ] - * HTTP :: "http" [ "s" ] + * HTTP :: "http" [ "s" ] * DOMAIN :: e.g., "mybucket.host.org" * PORT :: ":" (e.g., ":9000" ) * URI :: (e.g., "path/to/resource.hd5" ) @@ -758,8 +765,8 @@ done: * * Return: * - * Success: A pointer to a new file data structure. - * The public fields will be initialized by the caller, which is + * Success: A pointer to a new file data structure. + * The public fields will be initialized by the caller, which is * always H5FD_open(). * * Failure: NULL @@ -771,32 +778,31 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD + static H5FD_t * -H5FD_ros3_open(const char *url, - unsigned flags, - hid_t fapl_id, - haddr_t maxaddr) +H5FD_ros3_open( + const char *url, + unsigned flags, + hid_t fapl_id, + haddr_t maxaddr) { -#ifdef H5_HAVE_ROS3_VFD H5FD_ros3_t *file = NULL; struct tm *now = NULL; char iso8601now[ISO8601_SIZE]; unsigned char signing_key[SHA256_DIGEST_LENGTH]; s3r_t *handle = NULL; H5FD_ros3_fapl_t fa; -#endif H5FD_t *ret_value = NULL; FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD #if ROS3_DEBUG HDfprintf(stdout, "H5FD_ros3_open() called.\n"); #endif - /* Sanity check on file offsets */ HDcompile_assert(sizeof(HDoff_t) >= sizeof(size_t)); @@ -837,7 +843,7 @@ H5FD_ros3_open(const char *url, if (FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key, (const char *)fa.aws_region, - (const char *)iso8601now) ) + (const char *)iso8601now) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key") @@ -854,17 +860,17 @@ H5FD_ros3_open(const char *url, if (handle == NULL) { /* If we want to check CURL's say on the matter in a controlled - * fashion, this is the place to do it, but would need to make a + * fashion, this is the place to do it, but would need to make a * few minor changes to s3comms `s3r_t` and `s3r_read()`. - */ + */ HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); } - /* create new file struct + /* create new file struct */ file = H5FL_CALLOC(H5FD_ros3_t); if (file == NULL) { - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") } @@ -873,7 +879,7 @@ H5FD_ros3_open(const char *url, #if ROS3_STATS if (FAIL == ros3_reset_stats(file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") } #endif /* ROS3_STATS */ @@ -882,9 +888,9 @@ H5FD_ros3_open(const char *url, done: if (ret_value == NULL) { - if (handle != NULL) { + if (handle != NULL) { if (FAIL == H5FD_s3comms_s3r_close(handle)) { - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle") } } @@ -892,13 +898,28 @@ done: file = H5FL_FREE(H5FD_ros3_t, file); } curl_global_cleanup(); /* early cleanup because open failed */ - } /* if null return value (error) */ -#endif /* H5_HAVE_ROS3_VFD */ + } /* end if null return value (error) */ FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_ros3_open() */ + +#else /* H5_HAVE_ROS3_VFD not defined */ + +static H5FD_t * +H5FD_ros3_open( + const char H5_ATTR_UNUSED *url, + unsigned H5_ATTR_UNUSED flags, + hid_t H5_ATTR_UNUSED fapl_id, + haddr_t H5_ATTR_UNUSED maxaddr) +{ + H5FD_t *ret_value = NULL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_ros3_open() */ +#endif /* H5_HAVE_ROS3_VFD */ + #if ROS3_STATS /*---------------------------------------------------------------------------- @@ -906,7 +927,7 @@ done: * Function: ros3_fprint_stats() * * Purpose: - * + * * Tabulate and pretty-print statistics for this virtual file. * * Should be called upon file close. @@ -927,17 +948,17 @@ done: * - max (largest size read) * 2. tabulation of "bins", sepraring reads into exponentially-larger * ranges of size. - * - columns for number of reads, total bytes, and average size, with + * - columns for number of reads, total bytes, and average size, with * separate sub-colums for raw- and metadata reads. * - each row represents one bin, identified by the top of its range - * + * * Bin ranges can be modified with pound-defines at the top of this file. * * Bins without any reads in their bounds are not printed. * * An "overflow" bin is also present, to catch "big" reads. * - * Output for all bins (and range ceiling and average size report) + * Output for all bins (and range ceiling and average size report) * is divied by powers of 1024. By corollary, four digits before the decimal * is valid. * @@ -1050,7 +1071,7 @@ ros3_fprint_stats(FILE *stream, HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, bytes_raw); - if (count_raw + count_meta == 0) + if (count_raw + count_meta == 0) goto done; /************************* @@ -1109,9 +1130,9 @@ ros3_fprint_stats(FILE *stream, * PRINT INDIVIDUAL BIN STATS * ******************************/ - HDfprintf(stream, + HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, + HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { @@ -1129,7 +1150,7 @@ ros3_fprint_stats(FILE *stream, m = &file->meta[i]; r = &file->raw[i]; - if (r->count == 0 && m->count == 0) + if (r->count == 0 && m->count == 0) continue; range_end = ros3_stats_boundaries[i]; @@ -1172,7 +1193,7 @@ ros3_fprint_stats(FILE *stream, re_dub /= 1024.0; HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, + HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, suffixes[suffix_i], /* bin ceiling */ m->count, /* metadata reads */ @@ -1187,7 +1208,7 @@ ros3_fprint_stats(FILE *stream, done: FUNC_LEAVE_NOAPI(ret_value); - + } /* ros3_fprint_stats */ #endif /* ROS3_STATS */ @@ -1201,7 +1222,7 @@ done: * Close an HDF5 file. * * Return: - * + * * SUCCEED/FAIL * * Programmer: Jacob Smith @@ -1211,57 +1232,63 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD + static herr_t -H5FD_ros3_close(H5FD_t *_file) +H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) { -#ifdef H5_HAVE_ROS3_VFD H5FD_ros3_t *file = (H5FD_ros3_t *)_file; herr_t ret_value = SUCCEED; -#else - herr_t ret_value = FAIL; -#endif - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD #if ROS3_DEBUG HDfprintf(stdout, "H5FD_ros3_close() called.\n"); #endif - /* Sanity checks + /* Sanity checks */ HDassert(file != NULL); HDassert(file->s3r_handle != NULL); - /* Close the underlying request handle + /* Close the underlying request handle */ if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) { - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle") } #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ - if (FAIL == ros3_fprint_stats(stdout, file)) { - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, + if (ros3_fprint_stats(stdout, file) == FAIL) { + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") } #endif /* ROS3_STATS */ - /* Release the file info + /* Release the file info */ file = H5FL_FREE(H5FD_ros3_t, file); done: curl_global_cleanup(); /* cleanup to answer init on open */ -#endif /* H5_HAVE_ROS3_VFD */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_ros3_close() */ +#else /* H5_HAVE_ROS3_VFD not defined */ + +static herr_t +H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) +{ + herr_t ret_value = FAIL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_ros3_close() */ + +#endif /* H5_HAVE_ROS3_VFD */ + /*------------------------------------------------------------------------- * @@ -1269,7 +1296,7 @@ done: * * Purpose: * - * Compares two files belonging to this driver using an arbitrary + * Compares two files belonging to this driver using an arbitrary * (but consistent) ordering: * * + url scheme @@ -1284,7 +1311,7 @@ done: * tl;dr -> check URL, check crentials * * Return: - * + * * - Equivalent: 0 * - Not Equivalent: -1 * @@ -1300,22 +1327,20 @@ done: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD + static int -H5FD_ros3_cmp(const H5FD_t *_f1, - const H5FD_t *_f2) +H5FD_ros3_cmp( + const H5FD_t *_f1, + const H5FD_t *_f2) { -#ifdef H5_HAVE_ROS3_VFD const H5FD_ros3_t *f1 = (const H5FD_ros3_t *)_f1; const H5FD_ros3_t *f2 = (const H5FD_ros3_t *)_f2; const parsed_url_t *purl1 = NULL; const parsed_url_t *purl2 = NULL; -#endif int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef H5_HAVE_ROS3_VFD #if ROS3_DEBUG HDfprintf(stdout, "H5FD_ros3_cmp() called.\n"); @@ -1334,71 +1359,124 @@ H5FD_ros3_cmp(const H5FD_t *_f1, HDassert(purl2->host != NULL); /* URL: SCHEME */ - if (HDstrcmp(purl1->scheme, purl2->scheme)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->scheme, purl2->scheme)) { + HGOTO_DONE(-1); + } /* URL: HOST */ - if (HDstrcmp(purl1->host, purl2->host)) HGOTO_DONE(-1); + if (HDstrcmp(purl1->host, purl2->host)) { + HGOTO_DONE(-1); + } /* URL: PORT */ if (purl1->port && purl2->port) { - if (HDstrcmp(purl1->port, purl2->port)) HGOTO_DONE(-1); - } else if (purl1->port) { + if (HDstrcmp(purl1->port, purl2->port)) { + HGOTO_DONE(-1); + } + } + else + if (purl1->port) { HGOTO_DONE(-1); - } else if (purl2->port) { + } + else + if (purl2->port) { HGOTO_DONE(-1); } /* URL: PATH */ if (purl1->path && purl2->path) { - if (HDstrcmp(purl1->path, purl2->path)) HGOTO_DONE(-1); - } else if (purl1->path && !purl2->path) { + if (HDstrcmp(purl1->path, purl2->path)) { + HGOTO_DONE(-1); + } + } + else + if (purl1->path && !purl2->path) { HGOTO_DONE(-1); - } else if (purl2->path && !purl1->path) { + } + else + if (purl2->path && !purl1->path) { HGOTO_DONE(-1); } /* URL: QUERY */ if (purl1->query && purl2->query) { - if (HDstrcmp(purl1->query, purl2->query)) HGOTO_DONE(-1); - } else if (purl1->query && !purl2->query) { + if (HDstrcmp(purl1->query, purl2->query)) { + HGOTO_DONE(-1); + } + } + else + if (purl1->query && !purl2->query) { HGOTO_DONE(-1); - } else if (purl2->query && !purl1->query) { + } + else + if (purl2->query && !purl1->query) { HGOTO_DONE(-1); } /* FAPL: AWS_REGION */ if (f1->fa.aws_region[0] != '\0' && f1->fa.aws_region[0] != '\0') { - if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) HGOTO_DONE(-1); - } else if (f1->fa.aws_region[0] != '\0') { + if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) { + HGOTO_DONE(-1); + } + } + else + if (f1->fa.aws_region[0] != '\0') { HGOTO_DONE(-1); - } else if (f2->fa.aws_region[0] != '\0') { + } + else + if (f2->fa.aws_region[0] != '\0') { HGOTO_DONE(-1); } /* FAPL: SECRET_ID */ if (f1->fa.secret_id[0] != '\0' && f1->fa.secret_id[0] != '\0') { - if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) HGOTO_DONE(-1); - } else if (f1->fa.secret_id[0] != '\0') { + if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) { + HGOTO_DONE(-1); + } + } + else + if (f1->fa.secret_id[0] != '\0') { HGOTO_DONE(-1); - } else if (f2->fa.secret_id[0] != '\0') { + } + else + if (f2->fa.secret_id[0] != '\0') { HGOTO_DONE(-1); } /* FAPL: SECRET_KEY */ if (f1->fa.secret_key[0] != '\0' && f1->fa.secret_key[0] != '\0') { - if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) HGOTO_DONE(-1); - } else if (f1->fa.secret_key[0] != '\0') { + if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) { + HGOTO_DONE(-1); + } + } + else + if (f1->fa.secret_key[0] != '\0') { HGOTO_DONE(-1); - } else if (f2->fa.secret_key[0] != '\0') { + } + else + if (f2->fa.secret_key[0] != '\0') { HGOTO_DONE(-1); } -#endif /* H5_HAVE_ROS3_VFD */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_ros3_cmp() */ +#else /* H5_HAVE_ROS3_VFD not defined */ + +static int +H5FD_ros3_cmp( + const H5FD_t H5_ATTR_UNUSED *_f1, + const H5FD_t H5_ATTR_UNUSED *_f2) +{ + int ret_value = 0; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD_ros3_cmp() */ + +#endif /* H5_HAVE_ROS3_VFD */ + /*------------------------------------------------------------------------- * Function: H5FD_ros3_query @@ -1406,7 +1484,7 @@ done: * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Note that since the ROS3 VFD is read only, most flags + * Note that since the ROS3 VFD is read only, most flags * are irrelevant. * * The term "set" is highly misleading... @@ -1420,7 +1498,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, +H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1433,7 +1511,7 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, if (flags) { *flags = 0; /* OK to perform data sieving for faster raw data reads & writes */ - *flags |= H5FD_FEAT_DATA_SIEVE; + *flags |= H5FD_FEAT_DATA_SIEVE; } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1463,7 +1541,7 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eoa(const H5FD_t *_file, +H5FD_ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; @@ -1499,8 +1577,8 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_set_eoa(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, +H5FD_ros3_set_eoa(H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; @@ -1528,7 +1606,7 @@ H5FD_ros3_set_eoa(H5FD_t *_file, * * Return: * - * EOF: the first address past the end of the "file", either the + * EOF: the first address past the end of the "file", either the * filesystem file or the HDF5 file. * * Programmer: Jacob Smith @@ -1537,7 +1615,7 @@ H5FD_ros3_set_eoa(H5FD_t *_file, *------------------------------------------------------------------------- */ static haddr_t -H5FD_ros3_get_eof(const H5FD_t *_file, +H5FD_ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_ros3_t *file = (const H5FD_ros3_t *)_file; @@ -1573,8 +1651,8 @@ H5FD_ros3_get_eof(const H5FD_t *_file, *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_get_handle(H5FD_t *_file, - hid_t H5_ATTR_UNUSED fapl, +H5FD_ros3_get_handle(H5FD_t *_file, + hid_t H5_ATTR_UNUSED fapl, void **file_handle) { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; @@ -1586,8 +1664,9 @@ H5FD_ros3_get_handle(H5FD_t *_file, HDfprintf(stdout, "H5FD_ros3_get_handle() called.\n"); #endif - if(!file_handle) + if (!file_handle) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + } *file_handle = file->s3r_handle; @@ -1601,7 +1680,7 @@ done: * * Function: H5FD_ros3_read() * - * Purpose: + * Purpose * * Reads SIZE bytes of data from FILE beginning at address ADDR * into buffer BUF according to data transfer properties in DXPL_ID. @@ -1622,8 +1701,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_read(H5FD_t *_file, - H5FD_mem_t H5_ATTR_UNUSED type, +H5FD_ros3_read(H5FD_t *_file, + H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, /* start offset */ size_t size, /* length of read */ @@ -1631,13 +1710,13 @@ H5FD_ros3_read(H5FD_t *_file, { H5FD_ros3_t *file = (H5FD_ros3_t *)_file; size_t filesize = 0; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; #if ROS3_STATS /* working variables for storing stats */ ros3_statsbin *bin = NULL; unsigned bin_i = 0; #endif /* ROS3_STATS */ - + FUNC_ENTER_NOAPI_NOINIT @@ -1655,7 +1734,7 @@ H5FD_ros3_read(H5FD_t *_file, HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") } - if (FAIL == H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) ) { + if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) { HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") } @@ -1664,30 +1743,33 @@ H5FD_ros3_read(H5FD_t *_file, /* Find which "bin" this read fits in. Can be "overflow" bin. */ for (bin_i = 0; bin_i < ROS3_STATS_BIN_COUNT; bin_i++) { - if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) + if ((unsigned long long)size < ros3_stats_boundaries[bin_i]) { break; + } } bin = (type == H5FD_MEM_DRAW) ? &file->raw[bin_i] : &file->meta[bin_i]; - /* Store collected stats in appropriate bin + /* Store collected stats in appropriate bin */ if (bin->count == 0) { bin->min = size; bin->max = size; - } else { - if (size < bin->min) + } + else { + if (size < bin->min) { bin->min = size; - if (size > bin->max) + } + if (size > bin->max) { bin->max = size; + } } bin->count++; bin->bytes += (unsigned long long)size; #endif /* ROS3_STATS */ - done: FUNC_LEAVE_NOAPI(ret_value) @@ -1698,12 +1780,12 @@ done: * * Function: H5FD_ros3_write() * - * Purpose: + * Purpose: * * Write bytes to file. * UNSUPPORTED IN READ-ONLY ROS3 VFD. * - * Return: + * Return: * * FAIL (Not possible with Read-Only S3 file.) * @@ -1715,11 +1797,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, - H5FD_mem_t H5_ATTR_UNUSED type, +H5FD_ros3_write(H5FD_t H5_ATTR_UNUSED *_file, + H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, - haddr_t H5_ATTR_UNUSED addr, - size_t H5_ATTR_UNUSED size, + haddr_t H5_ATTR_UNUSED addr, + size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { herr_t ret_value = FAIL; @@ -1762,8 +1844,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, - hid_t H5_ATTR_UNUSED dxpl_id, +H5FD_ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, + hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { herr_t ret_value = SUCCEED; @@ -1807,7 +1889,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, +H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, hbool_t H5_ATTR_UNUSED rw) { FUNC_ENTER_NOAPI_NOINIT_NOERR diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 8c0515d..42b281f 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Source for S3 Communications module * @@ -51,6 +51,8 @@ */ #define S3COMMS_DEBUG 0 +#ifdef H5_HAVE_ROS3_VFD + /* manipulate verbosity of CURL output * operates separately from S3COMMS_DEBUG * @@ -65,6 +67,8 @@ */ #define S3COMMS_MAX_RANGE_STRING_SIZE 128 +#endif /* H5_HAVE_ROS3_VFD */ + /******************/ /* Local Typedefs */ /******************/ @@ -111,7 +115,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); /* Functions */ /*************/ - + /*---------------------------------------------------------------------------- * * Function: curlwritecallback() @@ -147,8 +151,9 @@ curlwritecallback(char *ptr, size_t product = (size * nmemb); size_t written = 0; - if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) + if (sds->magic != S3COMMS_CALLBACK_DATASTRUCT_MAGIC) { return written; + } if (size > 0) { HDmemcpy(&(sds->data[sds->size]), ptr, product); @@ -158,9 +163,9 @@ curlwritecallback(char *ptr, return written; -} /* curlwritecallback */ - +} /* end curlwritecallback() */ + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_node_set() @@ -223,9 +228,10 @@ curlwritecallback(char *ptr, *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_hrb_node_set(hrb_node_t **L, - const char *name, - const char *value) +H5FD_s3comms_hrb_node_set( + hrb_node_t **L, + const char *name, + const char *value) { size_t i = 0; char *valuecpy = NULL; @@ -238,8 +244,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, hbool_t is_looking = TRUE; herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -247,8 +251,9 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, HDprintf("NAME: %s\n", name); HDprintf("VALUE: %s\n", value); HDprintf("LIST:\n->"); - for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) + for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) { HDfprintf(stdout, "{%s}\n->", node_ptr->cat); + } HDprintf("(null)\n"); fflush(stdout); node_ptr = NULL; @@ -281,34 +286,37 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, * copies */ if (value != NULL) { - size_t valuelen = HDstrlen(value); - size_t catlen = namelen + valuelen + 2; /* HDstrlen(": ") -> +2 */ - int sprint_ret = 0; + int ret = 0; + size_t valuelen = HDstrlen(value); + size_t catlen = namelen + valuelen + 2; /* +2 from ": " */ + size_t catwrite = catlen + 3; /* 3 not 1 to quiet compiler warning */ + namecpy = (char *)H5MM_malloc(sizeof(char) * (namelen + 1)); if (namecpy == NULL) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for name copy.\n"); } - HDmemcpy(namecpy, name, namelen + 1); + HDmemcpy(namecpy, name, (namelen + 1)); valuecpy = (char *)H5MM_malloc(sizeof(char) * (valuelen + 1)); if (valuecpy == NULL) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for value copy.\n"); } - HDmemcpy(valuecpy, value, valuelen + 1); + HDmemcpy(valuecpy, value, (valuelen + 1)); - nvcat = (char *)H5MM_malloc(sizeof(char) * (catlen + 1)); + nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite); if (nvcat == NULL) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string.\n"); } - sprint_ret = HDsnprintf(nvcat, (catlen + 1), "%s: %s", name, value); - if (sprint_ret <= 0) + ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); + if (ret < 0 || (size_t)ret > catlen) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "error while concatenating `%s: %s", name, value); - HDassert( catlen == (size_t)sprint_ret ); + "cannot concatenate `%s: %s", name, value); + } + HDassert( catlen == HDstrlen(nvcat) ); /* create new_node, should we need it */ @@ -334,7 +342,8 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, if (value == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list"); - } else { + } + else { #if S3COMMS_DEBUG HDprintf("CREATE NEW\n"); fflush(stdout); #endif @@ -406,7 +415,8 @@ HDprintf("FREEING POINTER\n"); fflush(stdout); HDprintf("FREEING WORKING LOWERNAME\n"); fflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; - } else { + } + else { #if S3COMMS_DEBUG HDprintf("MODIFY HEAD\n"); fflush(stdout); #endif @@ -428,14 +438,17 @@ HDprintf("MODIFY HEAD\n"); fflush(stdout); H5MM_xfree(new_node); new_node = NULL; } - } else if (strcmp(lowername, node_ptr->lowername) < 0) { + } + else + if (strcmp(lowername, node_ptr->lowername) < 0) { is_looking = FALSE; if (value == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head"); - } else { + } + else { #if S3COMMS_DEBUG HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); #endif @@ -464,7 +477,8 @@ HDprintf("PREPEND NEW HEAD\n"); fflush(stdout); if (value == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); - } else { + } + else { #if S3COMMS_DEBUG HDprintf("APPEND A NODE\n"); fflush(stdout); #endif @@ -479,14 +493,17 @@ HDprintf("APPEND A NODE\n"); fflush(stdout); new_node->cat = nvcat; node_ptr->next = new_node; } - } else if (strcmp(lowername, node_ptr->next->lowername) < 0) { + } + else + if (strcmp(lowername, node_ptr->next->lowername) < 0) { is_looking = FALSE; if (value == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); - } else { + } + else { #if S3COMMS_DEBUG HDprintf("INSERT A NODE\n"); fflush(stdout); #endif @@ -502,7 +519,9 @@ HDprintf("INSERT A NODE\n"); fflush(stdout); new_node->next = node_ptr->next; node_ptr->next = new_node; } - } else if (strcmp(lowername, node_ptr->next->lowername) == 0) { + } + else + if (strcmp(lowername, node_ptr->next->lowername) == 0) { is_looking = FALSE; @@ -528,7 +547,8 @@ HDprintf("REMOVE A NODE\n"); fflush(stdout); H5MM_xfree(lowername); lowername = NULL; - } else { + } + else { #if S3COMMS_DEBUG HDprintf("MODIFY A NODE\n"); fflush(stdout); #endif @@ -552,23 +572,24 @@ HDprintf("MODIFY A NODE\n"); fflush(stdout); node_ptr->value = valuecpy; node_ptr->cat = nvcat; } - } else { + } + else { /**************** * KEEP LOOKING * ****************/ node_ptr = node_ptr->next; } - } + } /* end while is_looking */ done: if (ret_value == FAIL) { /* clean up */ - if (nvcat != NULL) H5MM_xfree(nvcat); - if (namecpy != NULL) H5MM_xfree(namecpy); - if (lowername != NULL) H5MM_xfree(lowername); - if (valuecpy != NULL) H5MM_xfree(valuecpy); + if (nvcat != NULL) { H5MM_xfree(nvcat); } + if (namecpy != NULL) { H5MM_xfree(namecpy); } + if (lowername != NULL) { H5MM_xfree(lowername); } + if (valuecpy != NULL) { H5MM_xfree(valuecpy); } if (new_node != NULL) { HDassert( new_node->magic == S3COMMS_HRB_NODE_MAGIC ); new_node->magic += 1ul; @@ -577,11 +598,9 @@ done: } FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_hrb_node_set() */ -} /* H5FD_s3comms_hrb_node_set */ - - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_destroy() @@ -637,8 +656,6 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) hrb_t *buf = NULL; herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -658,12 +675,11 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) buf->magic += 1ul; H5MM_xfree(buf); *_buf = NULL; - } + } /* end if `_buf` has some value */ done: FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_s3comms_hrb_destroy */ +} /* end H5FD_s3comms_hrb_destroy() */ /*---------------------------------------------------------------------------- @@ -728,8 +744,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb, char *vrsn = NULL; size_t vrsnlen = 0; - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -743,11 +757,13 @@ H5FD_s3comms_hrb_init_request(const char *_verb, /* populate valid NULLs with defaults */ - if (_verb == NULL) + if (_verb == NULL) { _verb = "GET"; + } - if (_http_version == NULL) + if (_http_version == NULL) { _http_version = "HTTP/1.1"; + } /* malloc space for and prepare structure */ @@ -765,28 +781,26 @@ H5FD_s3comms_hrb_init_request(const char *_verb, /* malloc and copy strings for the structure */ + reslen = HDstrlen(_resource); + if (_resource[0] == '/') { - reslen = HDstrlen(_resource) + 1; - res = (char *)H5MM_malloc(sizeof(char) * reslen); + res = (char *)H5MM_malloc(sizeof(char) * (reslen+1)); if (res == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); } - HDstrncpy(res, _resource, reslen); - } else { - int sprint_ret = 0; - reslen = HDstrlen(_resource) + 2; - res = (char *)H5MM_malloc(sizeof(char) * reslen); + HDmemcpy(res, _resource, (reslen+1)); + } + else { + res = (char *)H5MM_malloc(sizeof(char) * (reslen+2)); if (res == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, - "no space for resource string"); + "no space for resource string"); } - sprint_ret = HDsnprintf(res, reslen, "/%s", _resource); - if (sprint_ret <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "errro while appending resource string %s", _resource); - HDassert( (reslen - 1) == (size_t)sprint_ret ); - } /* start resource string with '/' */ + *res = '/'; + HDmemcpy((&res[1]), _resource, (reslen+1)); + HDassert( (reslen+1) == HDstrlen(res) ); + } /* end if (else resource string not starting with '/') */ verblen = HDstrlen(_verb) + 1; verb = (char *)H5MM_malloc(sizeof(char) * verblen); @@ -815,7 +829,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb, ret_value = request; done: - /* if there is an error, clean up after ourselves */ if (ret_value == NULL) { @@ -826,8 +839,7 @@ done: } FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_s3comms_hrb_init_request */ +} /* end H5FD_s3comms_hrb_init_request() */ @@ -835,7 +847,60 @@ done: * S3R FUNCTIONS ****************************************************************************/ +#ifndef H5_HAVE_ROS3_VFD +/* No-op, auto-fail, unused-variable implementations if ROS3 is not enabled */ + +herr_t +H5FD_s3comms_s3r_close(s3r_t H5_ATTR_UNUSED *handle) +{ + herr_t ret_value = SUCCEED; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_s3comms_s3r_close() */ + +size_t +H5FD_s3comms_s3r_get_filesize(s3r_t H5_ATTR_UNUSED *handle) +{ + size_t ret_value = 0; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_s3comms_s3r_get_filesize() */ + +herr_t +H5FD_s3comms_s3r_getsize(s3r_t H5_ATTR_UNUSED *handle) +{ + herr_t ret_value = FAIL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_s3r_getsize() */ + +s3r_t * +H5FD_s3comms_s3r_open( + const char H5_ATTR_UNUSED *url, + const char H5_ATTR_UNUSED *region, + const char H5_ATTR_UNUSED *id, + const unsigned char H5_ATTR_UNUSED *signing_key) +{ + s3r_t *ret_value = NULL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_s3comms_s3r_open() */ +herr_t +H5FD_s3comms_s3r_read( + s3r_t H5_ATTR_UNUSED *handle, + haddr_t H5_ATTR_UNUSED offset, + size_t H5_ATTR_UNUSED len, + void H5_ATTR_UNUSED *dest) +{ + herr_t ret_value = FAIL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_s3r_read() */ + +#else + + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_close() @@ -876,11 +941,8 @@ H5FD_s3comms_s3r_close(s3r_t *handle) { herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); #endif @@ -910,14 +972,11 @@ H5FD_s3comms_s3r_close(s3r_t *handle) H5MM_xfree(handle); -#endif /* H5_HAVE_ROS3_VFD */ - done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_s3comms_s3r_close */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_get_filesize() @@ -941,22 +1000,20 @@ done: *---------------------------------------------------------------------------- */ size_t -H5FD_s3comms_s3r_get_filesize(s3r_t *handle) { - +H5FD_s3comms_s3r_get_filesize(s3r_t *handle) +{ size_t ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOERR -#ifdef H5_HAVE_ROS3_VFD - if (handle != NULL) + if (handle != NULL) { ret_value = handle->filesize; -#endif /* H5_HAVE_ROS3_VFD */ + } FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_s3comms_s3r_get_filesize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_getsize() @@ -1143,7 +1200,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t\n"); } - if (content_length == 0 || + if (content_length == 0 || errno == ERANGE) /* errno set by strtoumax*/ { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -1187,7 +1244,7 @@ done: } /* H5FD_s3comms_s3r_getsize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_open() @@ -1463,7 +1520,7 @@ done: } /* H5FD_s3comms_s3r_open */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_read() @@ -1621,7 +1678,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, if (len > 0) { rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - S3COMMS_MAX_RANGE_STRING_SIZE ); + (S3COMMS_MAX_RANGE_STRING_SIZE+1) ); if (rangebytesstr == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.\n"); @@ -1631,12 +1688,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle, "bytes="H5_PRINTF_HADDR_FMT"-"H5_PRINTF_HADDR_FMT, offset, offset + len - 1); - if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } else if (offset > 0) { rangebytesstr = (char *)H5MM_malloc(sizeof(char) * \ - S3COMMS_MAX_RANGE_STRING_SIZE); + (S3COMMS_MAX_RANGE_STRING_SIZE+1)); if (rangebytesstr == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.\n"); @@ -1645,7 +1702,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes="H5_PRINTF_HADDR_FMT"-", offset); - if (ret == 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) + if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } @@ -1679,7 +1736,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, } else { /* authenticate request */ - char authorization[512]; + char authorization[512+1]; /* 512 := approximate max length... * 67 @@ -1689,10 +1746,10 @@ H5FD_s3comms_s3r_read(s3r_t *handle, * + 20 * + 128 */ - char buffer1[512]; /* -> Canonical Request -> Signature */ - char buffer2[256]; /* -> String To Sign -> Credential */ + char buffer1[512+1]; /* -> Canonical Request -> Signature */ + char buffer2[256+1]; /* -> String To Sign -> Credential */ char iso8601now[ISO8601_SIZE]; - char signed_headers[48]; + char signed_headers[48+1]; /* should be large enough for nominal listing: * "host;range;x-amz-content-sha256;x-amz-date" * + '\0', with "range;" possibly absent @@ -1821,8 +1878,11 @@ H5FD_s3comms_s3r_read(s3r_t *handle, /**** COMPUTE AUTHORIZATION ****/ if (FAIL == /* buffer1 -> canonical request */ - H5FD_s3comms_aws_canonical_request(buffer1, + H5FD_s3comms_aws_canonical_request( + buffer1, + 512, signed_headers, + 48, request) ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -1858,23 +1918,25 @@ H5FD_s3comms_s3r_read(s3r_t *handle, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string"); - ret = HDsnprintf(authorization, + ret = HDsnprintf( + authorization, 512, "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2, signed_headers, buffer1); - if (ret == 0 || ret >= 512) + if (ret <= 0 || ret >= 512) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); + } /* append authorization header to http request buffer */ - if (FAIL == - H5FD_s3comms_hrb_node_set( - &headers, - "Authorization", - (const char *)authorization) ) + if (H5FD_s3comms_hrb_node_set( + &headers, + "Authorization", + (const char *)authorization) + == FAIL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header") @@ -1914,17 +1976,18 @@ H5FD_s3comms_s3r_read(s3r_t *handle, /* finally, set http headers in curl handle */ - if (CURLE_OK != - curl_easy_setopt(curlh, - CURLOPT_HTTPHEADER, - curlheaders) ) + if (curl_easy_setopt( + curlh, + CURLOPT_HTTPHEADER, + curlheaders) + != CURLE_OK) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option " "(CURLOPT_HTTPHEADER). (placeholder flags)"); } - } /* if should authenticate (info provided) */ + } /* end if should authenticate (info provided) */ /******************* * PERFORM REQUEST * @@ -1983,14 +2046,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle, HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); if (sds == NULL) { HDfprintf(stderr, "sds is NULL!\n"); - } else { + } + else { HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); if (len > sds->size) { HDfprintf(stderr, "buffer overwrite\n"); } } - } else { + } + else { HDfprintf(stderr, "performed on entire file\n"); } #endif @@ -2028,29 +2093,30 @@ done: if (curlh != NULL) { /* clear any Range */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) + if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL) ) { HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_RANGE") + } /* clear headers */ - if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) + if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL) ) { HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_HTTPHEADER") + } } #endif /* H5_HAVE_ROS3_VFD */ FUNC_LEAVE_NOAPI(ret_value); - } /* H5FD_s3comms_s3r_read */ - +#endif /* H5_HAVE_ROS3_VFD */ /**************************************************************************** * MISCELLANEOUS FUNCTIONS ****************************************************************************/ - + /*---------------------------------------------------------------------------- * * Function: gmnow() @@ -2079,14 +2145,14 @@ gmnow(void) struct tm *ret_value = NULL; /* Doctor assert, checks against error in time() */ - if ( (time_t)(-1) != time(now_ptr) ) + if ( (time_t)(-1) != time(now_ptr) ) { ret_value = gmtime(now_ptr); + } HDassert( ret_value != NULL ); return ret_value; - -} /* gmnow */ +} /* end gmnow() */ /*---------------------------------------------------------------------------- @@ -2131,16 +2197,23 @@ gmnow(void) *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, - char *signed_headers_dest, - hrb_t *http_request) +H5FD_s3comms_aws_canonical_request( + char *canonical_request_dest, + int _cr_size, + char *signed_headers_dest, + int _sh_size, + hrb_t *http_request) { hrb_node_t *node = NULL; const char *query_params = ""; /* unused at present */ herr_t ret_value = SUCCEED; - int ret = 0; /* return value of HDsnprintf */ - size_t len = 0; /* working string length variable */ - char tmpstr[256]; + int ret = 0; + size_t cr_size = (size_t)_cr_size; + size_t sh_size = (size_t)_sh_size; + size_t cr_len = 0; /* working length of canonical request str */ + size_t sh_len = 0; /* working length of signed headers str */ + char tmpstr[256+1]; + tmpstr[256] = 0; /* terminating NULL */ /* "query params" refers to the optional element in the URL, e.g. * http://bucket.aws.com/myfile.txt?max-keys=2&prefix=J @@ -2152,8 +2225,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, * VFD use-cases. */ - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -2178,55 +2249,71 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, /* HTTP verb, resource path, and query string lines */ - len = (HDstrlen(http_request->verb) + + cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) + - 3 ); - ret = HDsnprintf(canonical_request_dest, - len + 1, - "%s\n%s\n%s\n", - http_request->verb, - http_request->resource, - query_params); - if (ret == 0 || (size_t)ret > len) + (size_t)3); /* three newline chars */ + if (cr_len >= cr_size) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "not enough space in canonical request"); + } + ret = HDsnprintf( /* TODO: compiler warning */ + canonical_request_dest, + (cr_size-1), + "%s\n%s\n%s\n", + http_request->verb, + http_request->resource, + query_params); + if (ret < 0 || (size_t)ret >= cr_size) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line"); + } /* write in canonical headers, building signed headers concurrently */ - node = http_request->first_header; /* assumed at first sorted */ + node = http_request->first_header; /* assumed sorted */ while (node != NULL) { - size_t join_len = 0; /* string len of joined header-value */ - - HDassert( node->magic == S3COMMS_HRB_NODE_MAGIC ); - - len = HDstrlen(node->lowername); - join_len = HDstrlen(node->value) + len + 2; /* +2 <- ":\n" */ - ret = HDsnprintf(tmpstr, - join_len + 1, /* +1 for null terminator */ - "%s:%s\n", - node->lowername, - node->value); - if (ret == 0 || (size_t)ret > join_len) + + HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); + + ret = HDsnprintf( + tmpstr, + 256, + "%s:%s\n", + node->lowername, + node->value); + if (ret < 0 || ret >= 256) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); + } + cr_len += HDstrlen(tmpstr); + if (cr_len + 1 > cr_size) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "not enough space in canonical request"); + } strcat(canonical_request_dest, tmpstr); - len += 1; /* semicolon */ - ret = HDsnprintf(tmpstr, - len + 1, - "%s;", - node->lowername); - if (ret == 0 || (size_t)ret > len) + ret = HDsnprintf( + tmpstr, + 256, + "%s;", + node->lowername); + if (ret < 0 || ret >= 256) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to append signed header %s", + "unable to append semicolon to lowername %s", node->lowername); + } + sh_len += HDstrlen(tmpstr); + if (sh_len + 1 > sh_size) { + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "not enough space in signed headers"); + } strcat(signed_headers_dest, tmpstr); node = node->next; - } + } /* end while node is not NULL */ /* remove tailing ';' from signed headers sequence */ @@ -2243,10 +2330,9 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, done: FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_aws_canonical_request() */ -} /* H5FD_s3comms_aws_canonical_request */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_bytes_to_hex() @@ -2293,16 +2379,15 @@ done: *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_bytes_to_hex(char *dest, - const unsigned char *msg, - size_t msg_len, - hbool_t lowercase) +H5FD_s3comms_bytes_to_hex( + char *dest, + const unsigned char *msg, + size_t msg_len, + hbool_t lowercase) { size_t i = 0; herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -2319,24 +2404,23 @@ H5FD_s3comms_bytes_to_hex(char *dest, } for (i = 0; i < msg_len; i++) { - int chars_written = - HDsnprintf(&(dest[i * 2]), - 3, /* 'X', 'X', '\n' */ - (lowercase == TRUE) ? "%02x" - : "%02X", - msg[i]); - if (chars_written != 2) + int chars_written = HDsnprintf(&(dest[i * 2]), + 3, /* 'X', 'X', '\n' */ + (lowercase == TRUE) ? "%02x" : "%02X", + msg[i]); + if (chars_written != 2) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]); + } } done: FUNC_LEAVE_NOAPI(ret_value); -} /* H5FD_s3comms_bytes_to_hex */ - +} /* end H5FD_s3comms_bytes_to_hex() */ + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_free_purl() @@ -2369,19 +2453,19 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) if (purl != NULL) { HDassert( purl->magic == S3COMMS_PARSED_URL_MAGIC ); - if (purl->scheme != NULL) H5MM_xfree(purl->scheme); - if (purl->host != NULL) H5MM_xfree(purl->host); - if (purl->port != NULL) H5MM_xfree(purl->port); - if (purl->path != NULL) H5MM_xfree(purl->path); - if (purl->query != NULL) H5MM_xfree(purl->query); + if (purl->scheme != NULL) { H5MM_xfree(purl->scheme); } + if (purl->host != NULL) { H5MM_xfree(purl->host); } + if (purl->port != NULL) { H5MM_xfree(purl->port); } + if (purl->path != NULL) { H5MM_xfree(purl->path); } + if (purl->query != NULL) { H5MM_xfree(purl->query); } purl->magic += 1ul; H5MM_xfree(purl); } FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5FD_s3comms_free_purl */ - +} /* end H5FD_s3comms_free_purl() */ + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_HMAC_SHA256() @@ -2424,27 +2508,22 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) * *---------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD + herr_t -H5FD_s3comms_HMAC_SHA256(const unsigned char *key, - size_t key_len, - const char *msg, - size_t msg_len, - char *dest) +H5FD_s3comms_HMAC_SHA256( + const unsigned char *key, + size_t key_len, + const char *msg, + size_t msg_len, + char *dest) { -#ifdef H5_HAVE_ROS3_VFD unsigned char md[SHA256_DIGEST_LENGTH]; unsigned int md_len = SHA256_DIGEST_LENGTH; herr_t ret_value = SUCCEED; -#else - herr_t ret_value = FAIL; -#endif /* H5_HAVE_ROS3_VFD */ - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); #endif @@ -2462,24 +2541,39 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, md, &md_len); - if (FAIL == - H5FD_s3comms_bytes_to_hex(dest, - (const unsigned char *)md, - (size_t)md_len, - true)) + if (H5FD_s3comms_bytes_to_hex( + dest, + (const unsigned char *)md, + (size_t)md_len, + true) + == FAIL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert to hex string."); } -#endif /* H5_HAVE_ROS3_VFD */ - done: FUNC_LEAVE_NOAPI(ret_value); - } /* H5FD_s3comms_HMAC_SHA256 */ +#else /* H5_HAVE_ROS3_VFD not defined */ + +herr_t +H5FD_s3comms_HMAC_SHA256( + const unsigned char H5_ATTR_UNUSED *key, + size_t H5_ATTR_UNUSED key_len, + const char H5_ATTR_UNUSED *msg, + size_t H5_ATTR_UNUSED msg_len, + char H5_ATTR_UNUSED *dest) +{ + herr_t ret_value = FAIL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_HMAC_SHA256() */ + +#endif /* H5_HAVE_ROS3_VFD */ + /*----------------------------------------------------------------------------- * * Function: H5FD__s3comms_load_aws_creds_from_file() @@ -2565,85 +2659,98 @@ H5FD__s3comms_load_aws_creds_from_file( #endif /* format target line for start of profile */ - if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) + if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label") + } /* look for start of profile */ do { /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; + for (buffer_i=0; buffer_i < 128; buffer_i++) { + buffer[buffer_i] = 0; + } line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) /* reached end of file */ + if (line_buffer == NULL) { /* reached end of file */ goto done; + } } while (strncmp(line_buffer, profile_line, HDstrlen(profile_line))); /* extract credentials from lines */ do { - size_t setting_name_len = 0; - const char *setting_name = NULL; - char line_prefix[128]; - /* clear buffer */ - for (buffer_i=0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; + for (buffer_i=0; buffer_i < 128; buffer_i++) { + buffer[buffer_i] = 0; + } /* collect a line from file */ line_buffer = fgets(line_buffer, 128, file); - if (line_buffer == NULL) + if (line_buffer == NULL) { goto done; /* end of file */ + } /* loop over names to see if line looks like assignment */ for (setting_i = 0; setting_i < setting_count; setting_i++) { + size_t setting_name_len = 0; + const char *setting_name = NULL; + char line_prefix[128]; + setting_name = setting_names[setting_i]; setting_name_len = HDstrlen(setting_name); - if (128 < HDsnprintf( - line_prefix, - setting_name_len+2, - "%s=", - setting_name)) + if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix") + } /* found a matching name? */ if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { found_setting = 1; /* skip NULL destination buffer */ - if (setting_pointers[setting_i] == NULL) + if (setting_pointers[setting_i] == NULL) { break; + } /* advance to end of name in string */ do { line_buffer++; } while (*line_buffer != 0 && *line_buffer != '='); - if (*line_buffer == 0 || *(line_buffer+1) == 0) + if (*line_buffer == 0 || *(line_buffer+1) == 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file") + } line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ - HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, - HDstrlen(line_buffer)); + if (HDstrncpy( + setting_pointers[setting_i], + (const char *)line_buffer, + HDstrlen(line_buffer)) + == NULL) + { + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, + "unable to copy line into pointer") + } /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; - while (!isspace(setting_pointers[setting_i][buffer_i])) + while (!isspace(setting_pointers[setting_i][buffer_i])) { buffer_i++; + } setting_pointers[setting_i][buffer_i] = '\0'; break; /* have read setting; don't compare with others */ - } - } + } /* end if possible name match */ + } /* end for each setting name */ } while (found_setting); done: FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD__s3comms_load_aws_creds_from_file() */ -} /* H5FD__s3comms_load_aws_creds_from_file */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_load_aws_profile() @@ -2688,6 +2795,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, FILE *credfile = NULL; char awspath[117]; char filepath[128]; + int ret = 0; FUNC_ENTER_NOAPI_NOINIT @@ -2696,47 +2804,61 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, #endif /* TODO: Windows and other path gotchas */ - if (117 < HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME"))) + ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ; + if (ret < 0 || (size_t)ret >= 117) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") - if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "credentials")) + } + ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); + if (ret < 0 || (size_t)ret >= 128) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") + } credfile = fopen(filepath, "r"); if (credfile != NULL) { - if (FAIL == H5FD__s3comms_load_aws_creds_from_file( + if (H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, key_id_out, secret_access_key_out, - aws_region_out)) + aws_region_out) + == FAIL) + { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") - if (EOF == fclose(credfile)) + } + if (fclose(credfile) == EOF) { HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") + } credfile = NULL; - } + } /* end if credential file opened */ - if (128 < HDsnprintf(filepath, 128, "%s%s", awspath, "config")) + ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); + if (ret < 0 || (size_t)ret >= 128) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") + } credfile = fopen(filepath, "r"); if (credfile != NULL) { - if (FAIL == H5FD__s3comms_load_aws_creds_from_file( + if (H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, - (*aws_region_out == 0) ? aws_region_out : NULL)) + (*aws_region_out == 0) ? aws_region_out : NULL) + == FAIL) + { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") - if (EOF == fclose(credfile)) + } + if (fclose(credfile) == EOF) { HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") + } credfile = NULL; - } + } /* end if credential file opened */ /* fail if not all three settings were loaded */ if (*key_id_out == 0 || @@ -2748,16 +2870,15 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, done: if (credfile != NULL) { - if (EOF == fclose(credfile)) + if (fclose(credfile) == EOF) { HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") + } } - FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_load_aws_profile() */ -} /* H5FD_s3comms_load_aws_profile */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_nlowercase() @@ -2787,9 +2908,10 @@ done: *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_nlowercase(char *dest, - const char *s, - size_t len) +H5FD_s3comms_nlowercase( + char *dest, + const char *s, + size_t len) { herr_t ret_value = SUCCEED; @@ -2814,10 +2936,9 @@ H5FD_s3comms_nlowercase(char *dest, done: FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_nlowercase() */ -} /* H5FD_s3comms_nlowercase */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_parse_url() @@ -2852,8 +2973,9 @@ done: *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_parse_url(const char *str, - parsed_url_t **_purl) +H5FD_s3comms_parse_url( + const char *str, + parsed_url_t **_purl) { parsed_url_t *purl = NULL; /* pointer to new structure */ const char *tmpstr = NULL; /* working pointer in string */ @@ -2863,8 +2985,6 @@ H5FD_s3comms_parse_url(const char *str, unsigned int i = 0; herr_t ret_value = FAIL; - - FUNC_ENTER_NOAPI_NOINIT; #if S3COMMS_DEBUG @@ -2946,7 +3066,8 @@ H5FD_s3comms_parse_url(const char *str, tmpstr++; } tmpstr++; - } else { + } /* end if (IPv6) */ + else { while (0 != *tmpstr) { if (':' == *tmpstr || '/' == *tmpstr || @@ -2956,12 +3077,14 @@ H5FD_s3comms_parse_url(const char *str, } tmpstr++; } - } /* if IPv4 or IPv6 */ + } /* end else (IPv4) */ len = tmpstr - curstr; if (len == 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty"); - } else if (len > urllen) { + } + else + if (len > urllen) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of HOST substring"); } @@ -2990,7 +3113,9 @@ H5FD_s3comms_parse_url(const char *str, if (len == 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty"); - } else if (len > urllen) { + } + else + if (len > urllen) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring"); } @@ -3005,12 +3130,12 @@ H5FD_s3comms_parse_url(const char *str, */ purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); if (purl->port == NULL) { /* cannot malloc */ - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, - "can't allocate space for PORT"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, + "can't allocate space for PORT"); } (void)HDstrncpy(purl->port, curstr, (size_t)len); purl->port[len] = 0; - } /* if PORT element */ + } /* end if PORT element */ /************* * READ PATH * @@ -3040,7 +3165,7 @@ H5FD_s3comms_parse_url(const char *str, (void)HDstrncpy(purl->path, curstr, (size_t)len); purl->path[len] = 0; } - } /* if PATH element */ + } /* end if PATH element */ /************** * READ QUERY * @@ -3067,9 +3192,7 @@ H5FD_s3comms_parse_url(const char *str, } /* cannot malloc path pointer */ (void)HDstrncpy(purl->query, curstr, (size_t)len); purl->query[len] = 0; - } /* if QUERY exists */ - - + } /* end if QUERY exists */ *_purl = purl; ret_value = SUCCEED; @@ -3079,10 +3202,9 @@ done: H5FD_s3comms_free_purl(purl); } FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_parse_url() */ -} /* H5FD_s3comms_parse_url */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_percent_encode_char() @@ -3129,15 +3251,12 @@ done: *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_percent_encode_char(char *repr, - const unsigned char c, - size_t *repr_len) +H5FD_s3comms_percent_encode_char( + char *repr, + const unsigned char c, + size_t *repr_len) { - unsigned int acc = 0; unsigned int i = 0; - unsigned int k = 0; - unsigned int stack[4] = {0, 0, 0, 0}; - unsigned int stack_size = 0; int chars_written = 0; herr_t ret_value = SUCCEED; #if S3COMMS_DEBUG @@ -3145,8 +3264,6 @@ H5FD_s3comms_percent_encode_char(char *repr, unsigned char hex[3] = {0, 0, 0}; #endif - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG @@ -3172,13 +3289,19 @@ H5FD_s3comms_percent_encode_char(char *repr, #endif *repr_len = 3; chars_written = HDsnprintf(repr, 4, "%%%02X", c); - if (chars_written != 3) + if (chars_written < 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); - } else { + } + } /* end if single-byte unicode char */ + else { /* multi-byte, multi-percent representation */ + unsigned int acc = 0; /* byte accumulator */ + unsigned int k = 0; /* uint character representation */ + unsigned int stack_size = 0; + unsigned char stack[4] = {0, 0, 0, 0}; #if S3COMMS_DEBUG HDfprintf(stdout, " MULTI-BYTE\n"); #endif @@ -3191,21 +3314,22 @@ H5FD_s3comms_percent_encode_char(char *repr, acc = k; acc >>= 6; /* cull least */ acc <<= 6; /* six bits */ - stack[stack_size++] = k - acc; /* max six-bit number */ + stack[stack_size++] = (unsigned char)(k - acc); k = acc >> 6; } while (k > 0); - /* now have "stack" of two to four six-bit numbers - * to be put into UTF-8 byte fields + /* `stack` now has two to four six-bit 'numbers' to be put into + * UTF-8 byte fields. */ #if S3COMMS_DEBUG HDfprintf(stdout, " STACK:\n {\n"); for (i = 0; i < stack_size; i++) { - H5FD_s3comms_bytes_to_hex((char *)hex, - (unsigned char *)(&stack[i]), - 1, - FALSE); + H5FD_s3comms_bytes_to_hex( + (char *)hex, + (&stack[i]), + 1, + FALSE); hex[2] = 0; HDfprintf(stdout, " %s,\n", hex); } @@ -3218,15 +3342,20 @@ H5FD_s3comms_percent_encode_char(char *repr, /* prepend 11[1[1]]0 to first byte */ /* 110xxxxx, 1110xxxx, or 11110xxx */ - acc = 0xC0; /* 2^7 + 2^6 -> 11000000 */ - acc += (stack_size > 2) ? 0x20 : 0; - acc += (stack_size > 3) ? 0x10 : 0; - stack_size -= 1; - chars_written = HDsnprintf(repr, 4, "%%%02X", acc + stack[stack_size]); - if (chars_written != 3) + acc = 0xC0; /* 0x11000000 */ + acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */ + acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */ + stack_size--; + chars_written = HDsnprintf( + repr, + 4, + "%%%02X", + (unsigned char)(acc + stack[stack_size])); + if (chars_written < 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); + } *repr_len += 3; /************************ @@ -3235,25 +3364,27 @@ H5FD_s3comms_percent_encode_char(char *repr, /* 10xxxxxx */ for (i = 0; i < stack_size; i++) { - chars_written = HDsnprintf(&repr[i*3 + 3], - 4, - "%%%02X", - 128 + stack[stack_size - 1 - i]); - if (chars_written != 3) + chars_written = HDsnprintf( + &repr[i*3 + 3], + 4, + "%%%02X", + (unsigned char)(0x80 + stack[stack_size - 1 - i])); + if (chars_written < 0) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c); + } *repr_len += 3; - } - } + } /* end for each continuation byte */ + } /* end else (multi-byte) */ + *(repr + *repr_len) = '\0'; done: FUNC_LEAVE_NOAPI(ret_value); - } /* H5FD_s3comms_percent_encode_char */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_signing_key() @@ -3301,13 +3432,15 @@ done: * *---------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD + herr_t -H5FD_s3comms_signing_key(unsigned char *md, - const char *secret, - const char *region, - const char *iso8601now) +H5FD_s3comms_signing_key( + unsigned char *md, + const char *secret, + const char *region, + const char *iso8601now) { -#ifdef H5_HAVE_ROS3_VFD char *AWS4_secret = NULL; size_t AWS4_secret_len = 0; unsigned char datekey[SHA256_DIGEST_LENGTH]; @@ -3315,16 +3448,9 @@ H5FD_s3comms_signing_key(unsigned char *md, unsigned char dateregionservicekey[SHA256_DIGEST_LENGTH]; int ret = 0; /* return value of HDsnprintf */ herr_t ret_value = SUCCEED; -#else - herr_t ret_value = SUCCEED; -#endif /* H5_HAVE_ROS3_VFD */ - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n"); #endif @@ -3356,10 +3482,11 @@ H5FD_s3comms_signing_key(unsigned char *md, /* prepend "AWS4" to start of the secret key */ ret = HDsnprintf(AWS4_secret, AWS4_secret_len,"%s%s", "AWS4", secret); - if ((size_t)ret != (AWS4_secret_len - 1)) + if ((size_t)ret != (AWS4_secret_len - 1)) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem writing AWS4+secret `%s`", secret); + } /* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest * we know digest length, so ignore via NULL @@ -3396,13 +3523,26 @@ H5FD_s3comms_signing_key(unsigned char *md, done: H5MM_xfree(AWS4_secret); -#endif /* H5_HAVE_ROS3_VFD */ - FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_signing_key() */ + +#else /* H5_HAVE_ROS3_VFD not defined */ -} /* H5FD_s3comms_signing_key */ +herr_t +H5FD_s3comms_signing_key( + unsigned char H5_ATTR_UNUSED *md, + const char H5_ATTR_UNUSED *secret, + const char H5_ATTR_UNUSED *region, + const char H5_ATTR_UNUSED *iso8601now) +{ + herr_t ret_value = SUCCEED; + FUNC_ENTER_NOAPI_NOINIT_NOERR; + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5FD_s3comms_signing_key() */ +#endif /* H5_HAVE_ROS3_VFD */ + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_tostringtosign() @@ -3450,13 +3590,14 @@ done: * *---------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD herr_t -H5FD_s3comms_tostringtosign(char *dest, - const char *req, - const char *now, - const char *region) +H5FD_s3comms_tostringtosign( + char *dest, + const char *req, + const char *now, + const char *region) { -#ifdef H5_HAVE_ROS3_VFD unsigned char checksum[SHA256_DIGEST_LENGTH * 2 + 1]; size_t d = 0; char day[9]; @@ -3465,15 +3606,9 @@ H5FD_s3comms_tostringtosign(char *dest, int ret = 0; /* HDsnprintf return value */ herr_t ret_value = SUCCEED; char tmp[128]; -#else - herr_t ret_value = FAIL; -#endif /* H5_HAVE_ROS3_VFD */ - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); #endif @@ -3495,8 +3630,6 @@ H5FD_s3comms_tostringtosign(char *dest, "Region cannot be NULL.\n") } - - for (i = 0; i < 128; i++) { tmp[i] = '\0'; } @@ -3507,11 +3640,10 @@ H5FD_s3comms_tostringtosign(char *dest, HDstrncpy(day, now, 8); day[8] = '\0'; ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); - if (ret <= 0 || ret >= 127) + if (ret <= 0 || ret >= 127) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string") - - + } HDmemcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); d = 17; @@ -3528,11 +3660,12 @@ H5FD_s3comms_tostringtosign(char *dest, HDstrlen(req), checksum); - if (FAIL == - H5FD_s3comms_bytes_to_hex(hexsum, - (const unsigned char *)checksum, - SHA256_DIGEST_LENGTH, - true)) + if (H5FD_s3comms_bytes_to_hex( + hexsum, + (const unsigned char *)checksum, + SHA256_DIGEST_LENGTH, + true) + == FAIL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not create hex string"); @@ -3544,14 +3677,27 @@ H5FD_s3comms_tostringtosign(char *dest, dest[d] = '\0'; -#endif /* H5_HAVE_ROS3_VFD */ - done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5ros3_tostringtosign() */ + +#else /* H5_HAVE_ROS3_VFD not defined */ -} /* H5ros3_tostringtosign */ +herr_t +H5FD_s3comms_tostringtosign( + char H5_ATTR_UNUSED *dest, + const char H5_ATTR_UNUSED *req, + const char H5_ATTR_UNUSED *now, + const char H5_ATTR_UNUSED *region) +{ + herr_t ret_value = FAIL; + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5ros3_tostringtosign() */ +#endif /* H5_HAVE_ROS3_VFD */ + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_trim() @@ -3594,9 +3740,7 @@ H5FD_s3comms_trim(char *dest, size_t s_len, size_t *n_written) { - herr_t ret_value = SUCCEED; - - + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -3612,8 +3756,6 @@ H5FD_s3comms_trim(char *dest, s_len = 0; } - - if (s_len > 0) { /* Find first non-whitespace character from start; * reduce total length per character. @@ -3645,10 +3787,9 @@ H5FD_s3comms_trim(char *dest, done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5FD_s3comms_trim() */ -} /* H5FD_s3comms_trim */ - - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_uriencode() @@ -3698,11 +3839,12 @@ done: *---------------------------------------------------------------------------- */ herr_t -H5FD_s3comms_uriencode(char *dest, - const char *s, - size_t s_len, - hbool_t encode_slash, - size_t *n_written) +H5FD_s3comms_uriencode( + char *dest, + const char *s, + size_t s_len, + hbool_t encode_slash, + size_t *n_written) { char c = 0; size_t dest_off = 0; @@ -3712,20 +3854,20 @@ H5FD_s3comms_uriencode(char *dest, herr_t ret_value = SUCCEED; size_t s_off = 0; - - FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n"); #endif - if (s == NULL) + if (s == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source string cannot be NULL"); - if (dest == NULL) + } + if (dest == NULL) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be NULL"); + } /* Write characters to destination, converting to percent-encoded * "hex-utf-8" strings if necessary. @@ -3741,12 +3883,14 @@ H5FD_s3comms_uriencode(char *dest, (c == '/' && encode_slash == FALSE)) { dest[dest_off++] = c; - } else { + } + else { hex_off = 0; - if (FAIL == - H5FD_s3comms_percent_encode_char(hex_buffer, - (const unsigned char)c, - &hex_len)) + if (H5FD_s3comms_percent_encode_char( + hex_buffer, + (const unsigned char)c, + &hex_len) + == FAIL) { hex_buffer[0] = c; hex_buffer[1] = 0; @@ -3758,8 +3902,8 @@ H5FD_s3comms_uriencode(char *dest, for (hex_off = 0; hex_off < hex_len; hex_off++) { dest[dest_off++] = hex_buffer[hex_off]; } - } - } + } /* end else (not a regular character) */ + } /* end for each character */ if (dest_off < s_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -3769,7 +3913,6 @@ H5FD_s3comms_uriencode(char *dest, done: FUNC_LEAVE_NOAPI(ret_value) - } /* H5FD_s3comms_uriencode */ diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 93a5a81..16f6a8b 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -577,7 +577,9 @@ H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, H5_DLL struct tm * gmnow(void); herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, + int cr_size, char *signed_headers_dest, + int sh_size, hrb_t *http_request); H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest, diff --git a/test/hdfs.c b/test/hdfs.c index 57dbac9..ab39da6 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -11,9 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only HDFS Virtual File Driver (VFD) + * Read-Only HDFS Virtual File Driver (VFD) * - * Purpose: + * Purpose: * * Verify behavior for Read-Only HDFS VFD. * @@ -27,11 +27,10 @@ #include "H5FDhdfs.h" /* this file driver's utilities */ +#ifdef H5_HAVE_LIBHDFS #define HDFS_TEST_DEBUG 0 #define HDFS_TEST_MAX_BUF_SIZE 256 -#if 0 -#define S3_TEST_MAX_URL_SIZE 256 -#endif /* s3comms relic */ +#endif /* H5_HAVE_LIBHDFS */ /***************************************************************************** * @@ -39,7 +38,7 @@ * * Purpose: * - * 1) Upon test failure, goto-jump to single-location teardown in test + * 1) Upon test failure, goto-jump to single-location teardown in test * function. E.g., `error:` (consistency with HDF corpus) or * `failed:` (reflects purpose). * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. @@ -48,22 +47,22 @@ * requires reading of entire line to know whether this if/call is * part of the test setup, test operation, or a test unto itself. * 3) Provide testing macros with optional user-supplied failure message; - * if not supplied (NULL), generate comparison output in the spirit of + * if not supplied (NULL), generate comparison output in the spirit of * test-driven development. E.g., "expected 5 but was -3" * User messages clarify test's purpose in code, encouraging description * without relying on comments. * 4) Configurable expected-actual order in generated comparison strings. - * Some prefer `VERIFY(expected, actual)`, others + * Some prefer `VERIFY(expected, actual)`, others * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch * to satifsy both parties, assuming one paradigm per test file. * (One could #undef and redefine the flag through the file as desired, * but _why_.) * - * Provided as courtesy, per consideration for inclusion in the library + * Provided as courtesy, per consideration for inclusion in the library * proper. * * Macros: - * + * * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order * FAIL_IF() - check condition * FAIL_UNLESS() - check _not_ condition @@ -80,8 +79,8 @@ /*---------------------------------------------------------------------------- * * ifdef flag: JSVERIFY_EXP_ACT - * - * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) * *---------------------------------------------------------------------------- @@ -114,10 +113,10 @@ * * Macro: FAIL_IF() * - * Purpose: + * Purpose: * * Make tests more accessible and less cluttered than - * `if (thing == otherthing()) TEST_ERROR` + * `if (thing == otherthing()) TEST_ERROR` * paradigm. * * The following lines are roughly equivalent: @@ -148,7 +147,7 @@ if (condition) { \ * * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", * e.g., "a != b". - * + * * Opposite of FAIL_IF; fails if the given condition is _not_ true. * * `FAIL_IF( 5 != my_op() )` @@ -254,10 +253,10 @@ if (!(condition)) { \ * * Macro: JSVERIFY() * - * Purpose: + * Purpose: * * Verify that two long integers are equal. - * If unequal, print failure message + * If unequal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -277,10 +276,10 @@ if ((long)(actual) != (long)(expected)) { \ * * Macro: JSVERIFY_NOT() * - * Purpose: + * Purpose: * * Verify that two long integers are _not_ equal. - * If equal, print failure message + * If equal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -300,10 +299,10 @@ if ((long)(actual) == (long)(expected)) { \ * * Macro: JSVERIFY_STR() * - * Purpose: + * Purpose: * * Verify that two strings are equal. - * If unequal, print failure message + * If unequal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -319,8 +318,8 @@ if (strcmp((actual), (expected)) != 0) { \ } /* JSVERIFY_STR */ -#else -/* JSVERIFY_EXP_ACT not defined +#else +/* JSVERIFY_EXP_ACT not defined * * Repeats macros above, but with actual/expected parameters reversed. */ @@ -373,23 +372,30 @@ if (strcmp((actual), (expected)) != 0) { \ * OTHER MACROS AND DEFINITIONS * ********************************/ -/* copied from src/hdfs.c +/* copied from src/hdfs.c */ +#ifdef H5_HAVE_LIBHDFS #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#define MAX_HDFS_NAMENODE_NAME 128 +#endif /* H5_HAVE_LIBHDFS */ + +#define HDFS_NAMENODE_NAME_MAX_SIZE 128 /******************************* * FILE-LOCAL GLOBAL VARIABLES * *******************************/ + +#ifdef H5_HAVE_LIBHDFS static const char filename_missing[] = "/tmp/missing.txt"; static const char filename_bard[] = "/tmp/t8.shakespeare.txt"; static const char filename_raven[] = "/tmp/Poe_Raven.txt"; static const char filename_example_h5[] = "/tmp/t.h5"; +#endif /* H5_HAVE_LIBHDFS */ + static H5FD_hdfs_fapl_t default_fa = { 1, /* fa version */ "localhost", /* namenode name */ 0, /* namenode port */ - "", /* user name */ + "", /* user name */ "", /* kerberos path */ 1024, /* buffer size */ }; @@ -403,7 +409,7 @@ static H5FD_hdfs_fapl_t default_fa = { * * Function: test_fapl_config_validation() * - * Purpose: + * Purpose: * * Test data consistency of fapl configuration. * Tests `H5FD_hdfs_validate_config` indirectly through `H5Pset_fapl_hdfs`. @@ -522,7 +528,7 @@ test_fapl_config_validation(void) for (i = 0; i < ncases; i++) { /*--------------- - * per-test setup + * per-test setup *--------------- */ case_ptr = &cases_arr[i]; @@ -535,7 +541,7 @@ test_fapl_config_validation(void) *----------------------------------- */ H5E_BEGIN_TRY { - /* `H5FD_hdfs_validate_config(...)` is static/private + /* `H5FD_hdfs_validate_config(...)` is static/private * to src/hdfs.c and cannot (and should not?) be tested directly? * Instead, validate config through public api. */ @@ -543,7 +549,7 @@ test_fapl_config_validation(void) } H5E_END_TRY; JSVERIFY( case_ptr->expected, success, case_ptr->msg ) - + /* Make sure we can get back what we put in. * Only valid if the fapl configuration does not result in error. */ @@ -566,7 +572,7 @@ test_fapl_config_validation(void) "streambuffer size mismatch" ) JSVERIFY_STR( config.namenode_name, fa_fetch.namenode_name, - NULL ) + NULL ) JSVERIFY_STR( config.user_name, fa_fetch.user_name, NULL ) @@ -599,7 +605,7 @@ error: } return 1; -} /* test_fapl_config_validation */ +} /* end test_fapl_config_validation() */ /*------------------------------------------------------------------------- @@ -608,7 +614,7 @@ error: * * Purpose: Tests the file handle interface for the HDFS driver. * - * For now, test only fapl & flags. Extend as the + * For now, test only fapl & flags. Extend as the * work on the VFD continues. * * Return: Success: 0 @@ -642,7 +648,7 @@ test_hdfs_fapl(void) TESTING("HDFS fapl "); - /* Set property list and file name for HDFS driver. + /* Set property list and file name for HDFS driver. */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( fapl_id < 0 ) @@ -654,12 +660,12 @@ test_hdfs_fapl(void) /**************** * Check that the VFD feature flags are correct - * SPEC MAY CHANGE + * SPEC MAY CHANGE ******************/ FAIL_IF( H5FDdriver_query(driver_id, &driver_flags) < 0 ) - JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE), + JSVERIFY_NOT( 0, (driver_flags & H5FD_FEAT_DATA_SIEVE), "bit(s) in `driver_flags` must align with " "H5FD_FEAT_DATA_SIEVE" ) @@ -676,14 +682,14 @@ error: return 1; -} /* test_hdfs_fapl() */ +} /* end test_hdfs_fapl() */ /*--------------------------------------------------------------------------- * * Function: test_vfd_open() * - * Purpose: + * Purpose: * * Demonstrate/specify VFD-level "Open" failure cases * @@ -700,6 +706,16 @@ error: static int test_vfd_open(void) { + +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS VFD-level open"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -709,7 +725,6 @@ test_vfd_open(void) #define FAPL_UNCONFIGURED -3 /* H5P_FILE_ACCESS */ #define FAPL_HDFS -4 -#ifdef H5_HAVE_LIBHDFS /************************* * test-local structures * *************************/ @@ -799,21 +814,14 @@ test_vfd_open(void) FALSE, }, }; -#endif /* H5_HAVE_LIBHDFS */ + unsigned i = 0; + unsigned failing_conditions_count = 10; H5FD_t *fd = NULL; hid_t fapl_hdfs = -1; hid_t fapl_unconfigured = -1; - unsigned i = 0; - unsigned failing_conditions_count = 10; TESTING("HDFS VFD-level open"); -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else fapl_unconfigured = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( fapl_unconfigured < 0 ) @@ -833,10 +841,13 @@ test_vfd_open(void) fd = NULL; - if (T.which_fapl == FAPL_UNCONFIGURED) + if (T.which_fapl == FAPL_UNCONFIGURED) { fapl_id = fapl_unconfigured; - else if (T.which_fapl == FAPL_HDFS) + } + else + if (T.which_fapl == FAPL_HDFS) { fapl_id = fapl_hdfs; + } #if HDFS_TEST_DEBUG HDfprintf(stderr, "testing: %s\n", T.message); @@ -852,10 +863,11 @@ test_vfd_open(void) HDfprintf(stderr, "\n!!!!! WARNING !!!!!\n" \ " Successful open of file on local system " \ "with non-HDFS VFD.\n"); - JSVERIFY(SUCCEED, H5FDclose(fd), + JSVERIFY(SUCCEED, H5FDclose(fd), "unable to close errant open"); fd = NULL; - } else { + } + else { JSVERIFY(1, 0, T.message); /* print message and fail */ } } @@ -867,14 +879,14 @@ test_vfd_open(void) HDfprintf(stderr, "nominal open\n"); #endif /* HDFS_TEST_DEBUG */ - /* finally, show that a file can be opened + /* finally, show that a file can be opened */ fd = H5FDopen( - filename_bard, - H5F_ACC_RDONLY, - fapl_hdfs, + filename_bard, + H5F_ACC_RDONLY, + fapl_hdfs, MAXADDR); - FAIL_IF( NULL == fd ) + FAIL_IF( NULL == fd ) /************ * TEARDOWN * @@ -895,20 +907,23 @@ test_vfd_open(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: + /*********** * CLEANUP * ***********/ - if (fd) - (void)H5FDclose(fd); + if (fd) { + (void)H5FDclose(fd); + } H5E_BEGIN_TRY { - if (fapl_hdfs >= 0) + if (fapl_hdfs >= 0) { (void)H5Pclose(fapl_hdfs); - if (fapl_unconfigured >= 0) + } + if (fapl_unconfigured >= 0) { (void)H5Pclose(fapl_unconfigured); + } } H5E_END_TRY; return 1; @@ -917,14 +932,16 @@ error: #undef FAPL_UNCONFIGURED #undef FAPL_HDFS -} /* test_vfd_open */ +#endif /* H5_HAVE_LIBHDFS */ + +} /* end test_vfd_open() */ /*--------------------------------------------------------------------------- * * Function: test_eof_eoa() * - * Purpose: + * Purpose: * * Demonstrate behavior of get_eof, get_eoa, and set_eoa. * @@ -941,6 +958,15 @@ error: static int test_eof_eoa(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS eof/eoa gets and sets"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -958,16 +984,10 @@ test_eof_eoa(void) TESTING("HDFS eof/eoa gets and sets"); -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else /********* * SETUP * *********/ - + fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( 0 > fapl_id ) FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) @@ -990,31 +1010,31 @@ test_eof_eoa(void) H5FDget_eof(fd_shakespeare, H5FD_MEM_DRAW), "mismatch between DEFAULT and RAW memory types" ) JSVERIFY( 0, - H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA should be unset by H5FDopen" ) /* set EoA below EoF */ - JSVERIFY( SUCCEED, - H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 44442202), "unable to set EoA (lower)" ) - JSVERIFY( 5458199, - H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed" ) - JSVERIFY( 44442202, - H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + JSVERIFY( 44442202, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged" ) /* set EoA above EoF */ - JSVERIFY( SUCCEED, - H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), + JSVERIFY( SUCCEED, + H5FDset_eoa(fd_shakespeare, H5FD_MEM_DEFAULT, 6789012), "unable to set EoA (higher)" ) - JSVERIFY( 5458199, - H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), + JSVERIFY( 5458199, + H5FDget_eof(fd_shakespeare, H5FD_MEM_DEFAULT), "EoF changed" ) - JSVERIFY( 6789012, - H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), + JSVERIFY( 6789012, + H5FDget_eoa(fd_shakespeare, H5FD_MEM_DEFAULT), "EoA unchanged" ) /************ @@ -1029,9 +1049,9 @@ test_eof_eoa(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: + /*********** * CLEANUP * ***********/ @@ -1039,7 +1059,7 @@ error: if (fd_shakespeare != NULL) { (void)H5FDclose(fd_shakespeare); } - if (fapl_id >= 0) { + if (fapl_id >= 0) { H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } H5E_END_TRY; @@ -1047,15 +1067,17 @@ error: return 1; -} /* test_eof_eoa */ +#endif /* H5_HAVE_LIBHDFS */ + +} /* end test_eof_eoa() */ /*----------------------------------------------------------------------------- * * Function: test_H5FDread_without_eoa_set_fails() - * + * * Purpose: - * + * * Demonstrate a not-obvious constraint by the library, preventing * file read before EoA is set * @@ -1067,26 +1089,27 @@ error: static int test_H5FDread_without_eoa_set_fails(void) { -#ifdef H5_HAVE_LIBHDFS +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS VFD read-eoa temporal coupling library limitation"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + char buffer[HDFS_TEST_MAX_BUF_SIZE]; unsigned int i = 0; -#endif /* H5_HAVE_LIBHDFS */ H5FD_t *file_shakespeare = NULL; hid_t fapl_id = -1; TESTING("HDFS VFD read-eoa temporal coupling library limitation"); -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else /********* * SETUP * *********/ - /* create HDFS fapl + /* create HDFS fapl */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( fapl_id < 0 ) @@ -1137,9 +1160,9 @@ test_H5FDread_without_eoa_set_fails(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: + /*********** * CLEANUP * ***********/ @@ -1155,7 +1178,9 @@ error: return 1; -} /* test_H5FDread_without_eoa_set_fails */ +#endif /* H5_HAVE_LIBHDFS */ + +} /* end test_H5FDread_without_eoa_set_fails() */ @@ -1163,7 +1188,7 @@ error: * * Function: test_read() * - * Purpose: + * Purpose: * * Return: * @@ -1178,11 +1203,19 @@ error: static int test_read(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS VFD read/range-gets"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ -#ifdef H5_HAVE_LIBHDFS /************************* * test-local structures * *************************/ @@ -1248,23 +1281,16 @@ test_read(void) herr_t open_return = FAIL; char buffer[HDFS_TEST_MAX_BUF_SIZE]; unsigned int i = 0; -#endif /* H5_HAVE_LIBHDFS */ H5FD_t *file_raven = NULL; hid_t fapl_id = -1; TESTING("HDFS VFD read/range-gets"); -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else /********* * SETUP * *********/ - /* create HDFS fapl + /* create HDFS fapl */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( fapl_id < 0 ) @@ -1275,7 +1301,7 @@ test_read(void) buffer[i] = 0; } - /* open file + /* open file */ file_raven = H5FDopen( filename_raven, @@ -1301,7 +1327,7 @@ test_read(void) FAIL_IF( HDFS_TEST_MAX_BUF_SIZE < test.len ) /* buffer too small! */ - FAIL_IF( FAIL == + FAIL_IF( FAIL == H5FDset_eoa( file_raven, H5FD_MEM_DEFAULT, test.eoa_set) ) /* zero buffer contents */ @@ -1345,15 +1371,16 @@ test_read(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: + /*********** * CLEANUP * ***********/ - if (file_raven != 0) + if (file_raven != 0) { (void)H5FDclose(file_raven); + } if (fapl_id >= 0) { H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); @@ -1362,14 +1389,16 @@ error: return 1; -} /* test_read */ +#endif /* H5_HAVE_LIBHDFS */ + +} /* end test_read() */ /*--------------------------------------------------------------------------- * * Function: test_noops_and_autofails() * - * Purpose: + * Purpose: * * Demonstrate the unavailable and do-nothing routines unique to * Read-Only VFD. @@ -1391,6 +1420,15 @@ error: static int test_noops_and_autofails(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS VFD always-fail and no-op routines"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -1413,13 +1451,7 @@ test_noops_and_autofails(void) * SETUP * *********/ -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else - /* create HDFS fapl + /* create HDFS fapl */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( fapl_id < 0 ) @@ -1441,7 +1473,7 @@ test_noops_and_autofails(void) /* auto-fail calls to write and truncate */ H5E_BEGIN_TRY { - JSVERIFY( FAIL, + JSVERIFY( FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), "write must fail" ) } H5E_END_TRY; @@ -1485,9 +1517,9 @@ test_noops_and_autofails(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: + /*********** * CLEANUP * ***********/ @@ -1503,14 +1535,16 @@ error: return 1; -} /* test_noops_and_autofails*/ +#endif /* H5_HAVE_LIBHDFS */ + +} /* end test_noops_and_autofails() */ /*--------------------------------------------------------------------------- * * Function: test_cmp() * - * Purpose: + * Purpose: * * Verify "file comparison" behavior. * @@ -1527,117 +1561,6 @@ error: static int test_cmp(void) { -#if 0 - /********************* - * test-local macros * - *********************/ - - /************************* - * test-local structures * - *************************/ - - /************************ - * test-local variables * - ************************/ - - H5FD_t *fd_raven = NULL; - H5FD_t *fd_shakes = NULL; - H5FD_t *fd_raven_2 = NULL; - hbool_t curl_ready = FALSE; - hid_t fapl_id = -1; - - - - TESTING("HDFS cmp (comparison)"); - - if (s3_test_credentials_loaded == 0) { - SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); - return 0; - } - - /********* - * SETUP * - *********/ - - FAIL_IF( CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT) ) - curl_ready = TRUE; - - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - FAIL_IF( 0 > fapl_id ) - JSVERIFY( SUCCEED, H5Pset_fapl_hdfs(fapl_id, &restricted_access_fa), NULL ) - - fd_raven = H5FDopen( - url_text_public, - H5F_ACC_RDONLY, - fapl_id, - HADDR_UNDEF); - FAIL_IF( NULL == fd_raven ) - - fd_shakes = H5FDopen( - url_text_restricted, - H5F_ACC_RDONLY, - fapl_id, - HADDR_UNDEF); - FAIL_IF( NULL == fd_shakes ) - - fd_raven_2 = H5FDopen( - url_text_public, - H5F_ACC_RDONLY, - fapl_id, - HADDR_UNDEF); - FAIL_IF( NULL == fd_raven_2 ) - - /********* - * TESTS * - *********/ - - JSVERIFY( 0, H5FDcmp(fd_raven, fd_raven_2), NULL ) - JSVERIFY( -1, H5FDcmp(fd_raven, fd_shakes), NULL ) - JSVERIFY( 1, H5FDcmp(fd_shakes, fd_raven_2), NULL ) - - /************ - * TEARDOWN * - ************/ - - FAIL_IF( FAIL == H5FDclose(fd_raven) ) - fd_raven = NULL; - FAIL_IF( FAIL == H5FDclose(fd_shakes) ) - fd_shakes = NULL; - FAIL_IF( FAIL == H5FDclose(fd_raven_2) ) - fd_raven_2 = NULL; - FAIL_IF( FAIL == H5Pclose(fapl_id) ) - fapl_id = -1; - - curl_global_cleanup(); - curl_ready = FALSE; - - PASSED(); - return 0; - -error: - /*********** - * CLEANUP * - ***********/ - - if (fd_raven != NULL) (void)H5FDclose(fd_raven); - if (fd_raven_2 != NULL) (void)H5FDclose(fd_raven_2); - if (fd_shakes != NULL) (void)H5FDclose(fd_shakes); - if (TRUE == curl_ready) curl_global_cleanup(); - if (fapl_id >= 0) { - H5E_BEGIN_TRY { - (void)H5Pclose(fapl_id); - } H5E_END_TRY; - } - -#else - /* - JSFAILED_AT() - HDprintf("TODO\n"); - return 1; - */ - TESTING("HDFS cmp (comparison)"); SKIPPED(); HDfprintf( @@ -1645,16 +1568,15 @@ error: " TODO: Distinct valid fapls to open the same file.\n"); return 0; -#endif /* s3comms relic */ -} /* test_cmp */ +} /* end test_cmp() */ /*--------------------------------------------------------------------------- * * Function: test_H5F_integration() * - * Purpose: + * Purpose: * * Demonstrate H5F (File interface) behavior with files on HDFS. * @@ -1675,6 +1597,15 @@ error: static int test_H5F_integration(void) { +#ifndef H5_HAVE_LIBHDFS + TESTING("HDFS file access through HD5F library (H5F API)"); + SKIPPED(); + puts(" HDFS VFD is not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -1696,12 +1627,6 @@ test_H5F_integration(void) * SETUP * *********/ -#ifndef H5_HAVE_LIBHDFS - SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); - return 0; -#else fapl_id = H5Pcreate(H5P_FILE_ACCESS); FAIL_IF( 0 > fapl_id ) FAIL_IF( FAIL == H5Pset_fapl_hdfs(fapl_id, &default_fa) ) @@ -1749,7 +1674,6 @@ test_H5F_integration(void) PASSED(); return 0; -#endif /* H5_HAVE_LIBHDFS */ error: /*********** @@ -1771,6 +1695,8 @@ error: return 1; +#endif /* H5_HAVE_LIBHDFS */ + } /* test_H5F_integration */ @@ -1796,15 +1722,19 @@ main(void) /****************** * commence tests * ******************/ - - static char hdfs_namenode_name[MAX_HDFS_NAMENODE_NAME] = ""; + + static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = ""; const char *hdfs_namenode_name_env = NULL; hdfs_namenode_name_env = HDgetenv("HDFS_TEST_NAMENODE_NAME"); if (hdfs_namenode_name_env == NULL || hdfs_namenode_name_env[0] == '\0') { - HDstrncpy(hdfs_namenode_name, "localhost", 9); - } else { - HDstrncpy(default_fa.namenode_name, hdfs_namenode_name_env, MAX_HDFS_NAMENODE_NAME); + HDstrncpy(hdfs_namenode_name, "localhost", HDFS_NAMENODE_NAME_MAX_SIZE); + } + else { + HDstrncpy( /* TODO: error-check? */ + default_fa.namenode_name, + hdfs_namenode_name_env, + HDFS_NAMENODE_NAME_MAX_SIZE); } h5_reset(); @@ -1823,14 +1753,15 @@ main(void) if (nerrors > 0) { HDprintf("***** %d hdfs TEST%s FAILED! *****\n", - nerrors, + nerrors, nerrors > 1 ? "S" : ""); nerrors = 1; - } else { + } + else { HDprintf("All hdfs tests passed.\n"); } return nerrors; /* 0 if no errors, 1 if any errors */ -} /* main() */ +} /* end main() */ diff --git a/test/ros3.c b/test/ros3.c index 60d3932..6d58af0 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Purpose: * @@ -32,6 +32,9 @@ +/* only include the testing macros if needed */ +#ifdef H5_HAVE_ROS3_VFD + /***************************************************************************** * * FILE-LOCAL TESTING MACROS @@ -368,15 +371,16 @@ if (strcmp((actual), (expected)) != 0) { \ #endif /* ifdef/else JSVERIFY_EXP_ACT */ +#endif /* H5_HAVE_ROS3_VFD */ + /******************************** * OTHER MACROS AND DEFINITIONS * ********************************/ -/* copied from src/ros3.c - */ +#ifdef H5_HAVE_ROS3_VFD + #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#ifdef H5_HAVE_ROS3_VFD #define S3_TEST_PROFILE_NAME "ros3_vfd_test" #define S3_TEST_MAX_URL_SIZE 256 @@ -440,6 +444,15 @@ H5FD_ros3_fapl_t anonymous_fa = { static int test_fapl_config_validation(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 fapl configuration validation"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3_VFD defined */ + /********************* * test-local macros * *********************/ @@ -458,7 +471,6 @@ test_fapl_config_validation(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD hid_t fapl_id = -1; /* file access property list ID */ H5FD_ros3_fapl_t config; H5FD_ros3_fapl_t fa_fetch; @@ -544,21 +556,12 @@ test_fapl_config_validation(void) }, }; -#endif /* H5_HAVE_ROS3_VFD */ - TESTING("ROS3 fapl configuration validation"); /********* * TESTS * *********/ -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else - if (FALSE == s3_test_bucket_defined) { SKIPPED(); puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); @@ -655,7 +658,7 @@ error: * Purpose: Tests the file handle interface for the ROS3 driver * * As the ROS3 driver is 1) read only, 2) requires access - * to an S3 server (minio for now), this test is quite + * to an S3 server, this test is quite * different from the other tests. * * For now, test only fapl & flags. Extend as the @@ -675,11 +678,19 @@ error: static int test_ros3_fapl(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 fapl "); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3 defined */ + /************************ * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD hid_t fapl_id = -1; /* file access property list ID */ hid_t driver_id = -1; /* ID for this VFD */ unsigned long driver_flags = 0; /* VFD feature flags */ @@ -690,16 +701,9 @@ test_ros3_fapl(void) "", /* secret_id */ "plugh", /* secret_key */ }; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 fapl "); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else /* Set property list and file name for ROS3 driver. */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); @@ -759,11 +763,19 @@ error: static int test_vfd_open(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 VFD-level open"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3_VFD defined */ + /********************* * test-local macros * *********************/ -#ifdef H5_HAVE_ROS3_VFD #define FAPL_H5P_DEFAULT -2 #define FAPL_FILE_ACCESS -3 @@ -853,17 +865,9 @@ test_vfd_open(void) hid_t fapl_file_access = -1; unsigned i = 0; unsigned tests_count = 10; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 VFD-level open"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else - if (FALSE == s3_test_bucket_defined) { SKIPPED(); puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); @@ -989,6 +993,15 @@ error: static int test_eof_eoa(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 eof/eoa gets and sets"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3_VFD defined */ + /********************* * test-local macros * *********************/ @@ -1001,20 +1014,12 @@ test_eof_eoa(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD H5FD_t *fd_shakespeare = NULL; hbool_t curl_ready = FALSE; hid_t fapl_id = -1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 eof/eoa gets and sets"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -1136,21 +1141,22 @@ error: static int test_H5FDread_without_eoa_set_fails(void) { -#ifdef H5_HAVE_ROS3_VFD +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 VFD read-eoa temporal coupling library limitation "); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3_VFD defined */ + char buffer[256]; unsigned int i = 0; H5FD_t *file_shakespeare = NULL; hid_t fapl_id = -1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 VFD read-eoa temporal coupling library limitation "); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -1256,6 +1262,15 @@ error: static int test_read(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 VFD read/range-gets"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else /* H5_HAVE_ROS3_VFD defined */ + /********************* * test-local macros * *********************/ @@ -1275,7 +1290,6 @@ test_read(void) /************************ * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD struct testcase cases[] = { { "successful range-get", 6464, @@ -1328,16 +1342,9 @@ test_read(void) unsigned int i = 0; H5FD_t *file_raven = NULL; hid_t fapl_id = -1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 VFD read/range-gets"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -1471,6 +1478,15 @@ error: static int test_noops_and_autofails(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 VFD always-fail and no-op routines"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -1483,21 +1499,13 @@ test_noops_and_autofails(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD hbool_t curl_ready = FALSE; hid_t fapl_id = -1; H5FD_t *file = NULL; const char data[36] = "The Force shall be with you, always"; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 VFD always-fail and no-op routines"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (FALSE == s3_test_bucket_defined) { SKIPPED(); @@ -1624,6 +1632,15 @@ error: static int test_cmp(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("ROS3 cmp (comparison)"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -1636,22 +1653,14 @@ test_cmp(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD H5FD_t *fd_raven = NULL; H5FD_t *fd_shakes = NULL; H5FD_t *fd_raven_2 = NULL; hbool_t curl_ready = FALSE; hid_t fapl_id = -1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("ROS3 cmp (comparison)"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -1767,6 +1776,15 @@ error: static int test_H5F_integration(void) { +#ifndef H5_HAVE_ROS3_VFD + TESTING("S3 file access through HD5F library (H5F API)"); + SKIPPED(); + puts(" ROS3 VFD not enabled"); + fflush(stdout); + return 0; + +#else + /********************* * test-local macros * *********************/ @@ -1779,19 +1797,11 @@ test_H5F_integration(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD hid_t file = -1; hid_t fapl_id = -1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("S3 file access through HD5F library (H5F API)"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); diff --git a/test/s3comms.c b/test/s3comms.c index a797e04..d636550 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Purpose: Unit tests for the S3 Communications (s3comms) module. * @@ -386,7 +386,7 @@ static hbool_t s3_test_bucket_defined = FALSE; #endif /* H5_HAVE_ROS3_VFD */ - + /*--------------------------------------------------------------------------- * * Function: test_macro_format_credential() @@ -408,7 +408,6 @@ test_macro_format_credential(void) * test-local variables * ************************/ -#ifdef H5_HAVE_ROS3_VFD char dest[256]; const char access[] = "AKIAIOSFODNN7EXAMPLE"; const char date[] = "20130524"; @@ -416,16 +415,9 @@ test_macro_format_credential(void) const char service[] = "s3"; const char expected[] = "AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request"; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("test_macro_format_credential"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else FAIL_IF( S3COMMS_MAX_CREDENTIAL_SIZE < S3COMMS_FORMAT_CREDENTIAL(dest, access, date, region, service) ) @@ -433,14 +425,13 @@ test_macro_format_credential(void) PASSED(); return 0; -#endif /* H5_HAVE_ROS3_VFD */ error: return -1; -} /* test_macro_format_credential */ - +} /* end test_macro_format_credential() */ + /*--------------------------------------------------------------------------- * * Function: test_aws_canonical_request() @@ -465,7 +456,6 @@ test_aws_canonical_request(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD struct header { const char *name; const char *value; @@ -520,16 +510,9 @@ test_aws_canonical_request(void) hrb_node_t *node = NULL; /* http headers list pointer */ unsigned int n_cases = 3; char sh_dest[64]; /* signed headers */ -#endif /* H5_HAVE_ROS3_VFD */ TESTING("test_aws_canonical_request"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < n_cases; i++) { /* pre-test bookkeeping */ @@ -559,16 +542,22 @@ test_aws_canonical_request(void) /* test */ JSVERIFY( SUCCEED, - H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, hrb), + H5FD_s3comms_aws_canonical_request( + cr_dest, + 512, + sh_dest, + 64, + hrb), " unable to compose canonical request" ) JSVERIFY_STR( C->exp_headers, sh_dest, NULL ) JSVERIFY_STR( C->exp_request, cr_dest, NULL ) /* tear-down */ - while (node != NULL) + while (node != NULL) { FAIL_IF( FAIL == H5FD_s3comms_hrb_node_set(&node, node->name, NULL)); + } HDassert(NULL == node); FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb)); HDassert(NULL == hrb); @@ -581,14 +570,29 @@ test_aws_canonical_request(void) /* malformed hrb and/or node-list */ - JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, sh_dest, NULL), + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request( + cr_dest, + 20, + sh_dest, + 20, + NULL), "http request object cannot be null" ) hrb = H5FD_s3comms_hrb_init_request("GET", "/", "HTTP/1.1"); - JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(NULL, sh_dest, hrb), + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request( + NULL, + 20, + sh_dest, + 20, + hrb), "canonical request destination cannot be NULL" ) - JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request(cr_dest, NULL, hrb), + JSVERIFY( FAIL, H5FD_s3comms_aws_canonical_request( + cr_dest, + 20, + NULL, + 20, + hrb), "signed headers destination cannot be null" ) FAIL_IF( FAIL == H5FD_s3comms_hrb_destroy(&hrb) ) @@ -604,15 +608,15 @@ error: (void)H5FD_s3comms_hrb_node_set(&node, node->name, NULL); HDassert( node == NULL ); } - if (hrb != NULL) + if (hrb != NULL) { (void)H5FD_s3comms_hrb_destroy(&hrb); + } return -1; -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_aws_canonical_request */ +} /* end test_aws_canonical_request() */ + /*--------------------------------------------------------------------------- * * Function: test_bytes_to_hex @@ -706,9 +710,9 @@ test_bytes_to_hex(void) error: return -1; -} /* test_bytes_to_hex */ - +} /* end test_bytes_to_hex() */ + /*--------------------------------------------------------------------------- * * Function: test_hrb_init_request() @@ -725,7 +729,6 @@ error: static herr_t test_hrb_init_request(void) { -#ifdef H5_HAVE_ROS3_VFD /********************* * test-local macros * *********************/ @@ -769,7 +772,7 @@ test_hrb_init_request(void) "HTTP/1.1", FALSE, }, - { "slash prepented to resource path, if necessary", + { "slash prepended to resource path, if necessary", NULL, "MYPATH/MYFILE.tiff", "/MYPATH/MYFILE.tiff", @@ -788,29 +791,25 @@ test_hrb_init_request(void) unsigned int i = 0; unsigned int ncases = 5; hrb_t *req = NULL; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("hrb_init_request"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < ncases; i++) { C = &cases[i]; - req = H5FD_s3comms_hrb_init_request(C->verb, - C->resource, - C->version); + req = H5FD_s3comms_hrb_init_request( + C->verb, + C->resource, + C->version); if (cases[i].ret_null == TRUE) { FAIL_IF( req != NULL ); - } else { + } + else { FAIL_IF( req == NULL ); JSVERIFY( S3COMMS_HRB_MAGIC, req->magic, NULL ) if (C->verb == NULL) { JSVERIFY_STR( "GET", req->verb, NULL ) - } else { + } + else { JSVERIFY_STR( req->verb, C->verb, NULL ) } JSVERIFY_STR( "HTTP/1.1", req->version, NULL ) @@ -823,7 +822,7 @@ test_hrb_init_request(void) FAIL_IF( NULL != req ); /* should annull pointer as well as free */ } - } /* for each testcase */ + } /* end for each testcase */ PASSED(); return 0; @@ -832,11 +831,10 @@ error: (void)H5FD_s3comms_hrb_destroy(&req); return -1; -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_hrb_init_request */ +} /* end test_hrb_init_request() */ + /*--------------------------------------------------------------------------- * * Function: test_hrb_node_set() @@ -853,7 +851,6 @@ error: static herr_t test_hrb_node_set(void) { -#ifdef H5_HAVE_ROS3_VFD /************************* * test-local structures * *************************/ @@ -1071,18 +1068,10 @@ test_hrb_node_set(void) }; unsigned testcases_count = 16; unsigned test_i = 0; - hrb_node_t *list = NULL; -#endif /* H5_HAVE_ROS3_VFD */ - TESTING("test_hrb_node_t"); + TESTING("hrb_node_t (test_hrb_node_set)"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (test_i = 0; test_i < testcases_count; test_i++) { const hrb_node_t *node = NULL; const testcase *test = &(cases[test_i]); @@ -1137,21 +1126,22 @@ test_hrb_node_set(void) FAIL_IF( SUCCEED != H5FD_s3comms_hrb_node_set(&list, list->name, NULL) ) } - } + } /* end for each testcase */ PASSED(); return 0; error: - while (list != NULL) + while (list != NULL) { (void)H5FD_s3comms_hrb_node_set(&list, list->name, NULL); + } return -1; -#endif /* H5_HAVE_ROS3_VFD */ -} /* test_hrb_node_t */ +} /* end test_hrb_node_t() */ + /*--------------------------------------------------------------------------- * * Function: test_HMAC_SHA256() @@ -1265,13 +1255,13 @@ test_HMAC_SHA256(void) dest); TEST_ERROR; } -#else +#else /* VERBOSE not defined */ /* simple pass/fail test */ JSVERIFY( 0, strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL); -#endif +#endif /* VERBOSE */ } free(dest); } @@ -1284,9 +1274,9 @@ error: return -1; #endif /* H5_HAVE_ROS3_VFD */ -} /* test_HMAC_SHA256 */ - +} /* end test_HMAC_SHA256() */ + /*---------------------------------------------------------------------------- * * Function: test_nlowercase() @@ -1307,7 +1297,6 @@ test_nlowercase(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD struct testcase { const char *in; size_t len; @@ -1338,16 +1327,9 @@ test_nlowercase(void) char *dest = NULL; int i = 0; int n_cases = 3; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("nlowercase"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < n_cases; i++) { dest = (char *)HDmalloc(sizeof(char) * 16); @@ -1360,7 +1342,7 @@ test_nlowercase(void) JSVERIFY( 0, strncmp(dest, cases[i].exp, cases[i].len), NULL ) } free(dest); - } + } /* end for each testcase */ JSVERIFY( FAIL, H5FD_s3comms_nlowercase(NULL, @@ -1374,11 +1356,10 @@ test_nlowercase(void) error: free(dest); return -1; -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_nlowercase */ +} /* end test_nlowercase() */ + /*--------------------------------------------------------------------------- * * Function: test_parse_url() @@ -1399,7 +1380,6 @@ test_parse_url(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD typedef struct { const char *scheme; const char *host; @@ -1540,16 +1520,9 @@ test_parse_url(void) "non-decimal PORT (01a3)", }, }; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("url-parsing functionality"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else /********* * TESTS * *********/ @@ -1564,7 +1537,8 @@ test_parse_url(void) if (cases[i].exp_ret == FAIL) { /* on FAIL, `purl` should be untouched--remains NULL */ FAIL_UNLESS( purl == NULL ) - } else { + } + else { /* on SUCCEED, `purl` should be set */ FAIL_IF( purl == NULL ) @@ -1612,7 +1586,7 @@ test_parse_url(void) } else { FAIL_UNLESS( NULL == purl->query ) } - } /* if parse-url return SUCCEED/FAIL */ + } /* end if parse-url return SUCCEED/FAIL */ /* per-test cleanup * well-behaved, even if `purl` is NULL @@ -1620,7 +1594,7 @@ test_parse_url(void) FAIL_IF( FAIL == H5FD_s3comms_free_purl(purl) ) purl = NULL; - } /* for each testcase */ + } /* end for each testcase */ PASSED(); return 0; @@ -1632,11 +1606,10 @@ error: (void)H5FD_s3comms_free_purl(purl); return -1; -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_parse_url */ +} /* end test_parse_url() */ + /*--------------------------------------------------------------------------- * * Function: test_percent_encode_char() @@ -1662,7 +1635,6 @@ test_percent_encode_char(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD struct testcase { const char c; const char *exp; @@ -1692,16 +1664,9 @@ test_percent_encode_char(void) size_t dest_len = 0; int i = 0; int n_cases = 5; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("percent encode characters"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < n_cases; i++) { JSVERIFY( SUCCEED, H5FD_s3comms_percent_encode_char( @@ -1726,11 +1691,9 @@ test_percent_encode_char(void) error: return -1; -#endif /* H5_HAVE_ROS3_VFD */ - -} /* test_percent_encode_char */ - +} /* end test_percent_encode_char() */ + /*--------------------------------------------------------------------------- * Function: test_s3r_open() * @@ -1798,9 +1761,9 @@ error: return -1; #endif /* H5_HAVE_ROS3_VFD */ -} /* test_s3r_get_filesize */ - +} /* end test_s3r_get_filesize() */ + /*--------------------------------------------------------------------------- * Function: test_s3r_open() * @@ -2039,9 +2002,9 @@ error: return -1; #endif /* H5_HAVE_ROS3_VFD */ -} /* test_s3r_open */ - +} /* end test_s3r_open() */ + /*--------------------------------------------------------------------------- * * Function: test_s3r_read() @@ -2265,7 +2228,7 @@ error: #undef S3COMMS_TEST_BUFFER_SIZE #endif /* H5_HAVE_ROS3_VFD */ -} /* test_s3r_read */ +} /* end test_s3r_read() */ /*--------------------------------------------------------------------------- @@ -2404,9 +2367,9 @@ error: return -1; #endif /* H5_HAVE_ROS3_VFD */ -} /* test_signing_key */ - +} /* end test_signing_key() */ + /*--------------------------------------------------------------------------- * * Function: test_tostringtosign() @@ -2476,9 +2439,9 @@ error : return -1; #endif /* H5_HAVE_ROS3_VFD */ -} /* test_tostringtosign */ - +} /* end test_tostringtosign() */ + /*---------------------------------------------------------------------------- * * Function: test_trim() @@ -2563,7 +2526,7 @@ test_trim(void) } free(str); str = NULL; - } + } /* end for each testcase */ JSVERIFY( SUCCEED, H5FD_s3comms_trim(dest, NULL, 3, &dest_len), "should not fail when trimming a null string" ); @@ -2582,13 +2545,14 @@ test_trim(void) return 0; error: - if (str != NULL) + if (str != NULL) { free(str); + } return -1; -} /* test_trim */ - +} /* end test_trim() */ + /*---------------------------------------------------------------------------- * * Function: test_uriencode() @@ -2685,7 +2649,7 @@ test_uriencode(void) free(dest); dest = NULL; - } + } /* end for each testcase */ /*************** * ERROR CASES * @@ -2713,11 +2677,11 @@ error: } return -1; -} /* test_uriencode */ - +} /* end test_uriencode() */ + /*------------------------------------------------------------------------- * Function: main() * @@ -2774,7 +2738,8 @@ main(void) if (bucket_url_env == NULL || bucket_url_env[0] == '\0') { HDprintf("WARNING: S3 bucket url is not defined in enviornment " \ "variable 'HDF5_ROS3_TEST_BUCKET_URL'!\n"); - } else { + } + else { HDstrncpy(s3_test_bucket_url, bucket_url_env, S3_TEST_MAX_URL_SIZE); s3_test_bucket_defined = TRUE; } @@ -2799,12 +2764,12 @@ main(void) nerrors += test_s3r_get_filesize() < 0 ? 1 : 0; nerrors += test_s3r_read() < 0 ? 1 : 0; - if(nerrors) { + if (nerrors) { HDprintf("***** %d S3comms TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; - } /* end if */ + } HDprintf("All S3comms tests passed.\n"); diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 347c189..5df701a 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -24,6 +24,7 @@ static int doxml = 0; static int useschema = 1; static const char *xml_dtd_uri = NULL; +#ifdef H5_HAVE_ROS3_VFD static H5FD_ros3_fapl_t ros3_fa = { 1, /* version */ false, /* authenticate */ @@ -31,7 +32,9 @@ static H5FD_ros3_fapl_t ros3_fa = { "", /* access key id */ "", /* secret access key */ }; +#endif /* H5_HAVE_ROS3_VFD */ +#ifdef H5_HAVE_LIBHDFS static H5FD_hdfs_fapl_t hdfs_fa = { 1, /* fapl version */ "localhost", /* namenode name */ @@ -40,6 +43,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = { "", /* user name */ 2048, /* stream buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ /* module-scoped variables for XML option */ #define DEFAULT_XSD "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd" diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 2364f23..7e2a431 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -2612,6 +2612,7 @@ main(int argc, const char *argv[]) int err_exit = 0; hid_t fapl_id = H5P_DEFAULT; +#ifdef H5_HAVE_ROS3_VFD /* default "anonymous" s3 configuration */ H5FD_ros3_fapl_t ros3_fa = { 1, /* fapl version */ @@ -2620,7 +2621,9 @@ main(int argc, const char *argv[]) "", /* access key id */ "", /* secret access key */ }; +#endif /* H5_HVAE_ROS3_VFD */ +#ifdef H5_HAVE_LIBHDFS /* "default" HDFS configuration */ H5FD_hdfs_fapl_t hdfs_fa = { 1, /* fapl version */ @@ -2630,6 +2633,7 @@ main(int argc, const char *argv[]) "", /* user name */ 2048, /* stream buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index dd03f18..75d325a 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -120,6 +120,7 @@ typedef struct iter_t { static const char *drivername = ""; +#ifdef H5_HAVE_ROS3_VFD /* default "anonymous" s3 configuration */ static H5FD_ros3_fapl_t ros3_fa = { @@ -129,7 +130,9 @@ static H5FD_ros3_fapl_t ros3_fa = { "", /* access key id */ "", /* secret access key */ }; +#endif /* H5_HAVE_ROS3_VFD */ +#ifdef H5_HAVE_LIBHDFS /* default HDFS access configuration */ static H5FD_hdfs_fapl_t hdfs_fa = { @@ -140,6 +143,7 @@ static H5FD_hdfs_fapl_t hdfs_fa = { "", /* user name */ 2048, /* stream buffer size */ }; +#endif /* H5_HAVE_LIBHDFS */ static int display_all = TRUE; @@ -544,8 +548,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); /* Get storage info */ - if((storage = H5Dget_storage_size(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed"); + /* Failure 0 indistinguishable from no-data-stored 0 */ + storage = H5Dget_storage_size(did); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) -- cgit v0.12 From bd8da502cf5b763433e3c628a4043a4264529cec Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 14 Aug 2019 16:22:06 -0700 Subject: Some refactoring prior to implementing new H5P MPI functions. * Macro cleanup and obvious warning fixes in parallel code. * Moved H5FD comm and info dup/free wrapper code to a new H5mpi.c file and separated it to deal with each MPI type separately. --- MANIFEST | 1 + src/CMakeLists.txt | 1 + src/H5ACmpio.c | 6 +- src/H5FDmpi.c | 109 --------- src/H5FDmpio.c | 637 ++++++++++++++++++++++++++--------------------------- src/H5FDprivate.h | 3 - src/H5Fmpi.c | 86 ++++---- src/H5mpi.c | 198 +++++++++++++++++ src/H5private.h | 8 + src/Makefile.am | 2 +- 10 files changed, 567 insertions(+), 484 deletions(-) create mode 100644 src/H5mpi.c diff --git a/MANIFEST b/MANIFEST index 29b34a5..1232411 100644 --- a/MANIFEST +++ b/MANIFEST @@ -481,6 +481,7 @@ ./src/H5err.txt ./src/H5detect.c ./src/H5make_libsettings.c +./src/H5mpi.c ./src/H5overflow.txt ./src/H5private.h ./src/H5public.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17fd949..313d231 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,7 @@ set (H5_SOURCES ${HDF5_SRC_DIR}/H5.c ${HDF5_SRC_DIR}/H5checksum.c ${HDF5_SRC_DIR}/H5dbg.c + ${HDF5_SRC_DIR}/H5mpi.c ${HDF5_SRC_DIR}/H5system.c ${HDF5_SRC_DIR}/H5timer.c ${HDF5_SRC_DIR}/H5trace.c diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index b60b933..e4b81fa 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -821,9 +821,8 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(entry_ptr); @@ -853,8 +852,7 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) /* Decrement the dirty byte count */ aux_ptr->dirty_bytes -= entry_ptr->size; -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5AC__log_cleaned_entry() */ diff --git a/src/H5FDmpi.c b/src/H5FDmpi.c index 7d58b7a..b2959a5 100644 --- a/src/H5FDmpi.c +++ b/src/H5FDmpi.c @@ -267,115 +267,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/) FUNC_LEAVE_NOAPI(ret_value) } - -/*------------------------------------------------------------------------- - * Function: H5FD_mpi_comm_info_dup - * - * Purpose: Make duplicates of communicator and Info object. - * If the Info object is in fact MPI_INFO_NULL, no duplicate - * is made but the same value assigned to the new Info object - * handle. - * - * Return: Success: Non-negative. The new communicator and Info - * object handles are returned via comm_new and - * info_new pointers. - * - * Failure: Negative. - * - * Programmer: Albert Cheng - * Jan 8, 2003 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, MPI_Comm *comm_new, MPI_Info *info_new) -{ - herr_t ret_value=SUCCEED; - MPI_Comm comm_dup=MPI_COMM_NULL; - MPI_Info info_dup=MPI_INFO_NULL; - int mpi_code; - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument") - if (!comm_new || !info_new) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "bad pointers") - - /* Dup them. Using temporary variables for error recovery cleanup. */ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(comm, &comm_dup))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) - if (MPI_INFO_NULL != info){ - if (MPI_SUCCESS != (mpi_code=MPI_Info_dup(info, &info_dup))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - }else{ - /* No dup, just copy it. */ - info_dup = info; - } - - /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal, - and return codes can be checked and handled. May 23, 2017 FTW */ - if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN))) - HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code) - - /* copy them to the return arguments */ - *comm_new = comm_dup; - *info_new = info_dup; - -done: - if (FAIL == ret_value){ - /* need to free anything created here */ - if (MPI_COMM_NULL != comm_dup) - MPI_Comm_free(&comm_dup); - if (MPI_INFO_NULL != info_dup) - MPI_Info_free(&info_dup); - } - - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5FD_mpi_comm_info_free - * - * Purpose: Free the communicator and Info object. - * If comm or info is in fact MPI_COMM_NULL or MPI_INFO_NULL - * respectively, no action occurs to it. - * - * Return: Success: Non-negative. The values the pointers refer - * to will be set to the corresponding NULL - * handles. - * - * Failure: Negative. - * - * Programmer: Albert Cheng - * Jan 8, 2003 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info) -{ - herr_t ret_value=SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if (!comm || !info) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "not a valid argument") - - if (MPI_COMM_NULL != *comm) - MPI_Comm_free(comm); - if (MPI_INFO_NULL != *info) - MPI_Info_free(info); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - #ifdef NOT_YET /*------------------------------------------------------------------------- diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index d5aa170..6ca7aa4 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -167,7 +167,7 @@ USAGE herr_t H5FD__init_package() RETURNS - Non-negative on success/Negative on failure + SUCCEED/FAIL DESCRIPTION Initializes any interface-specific data or routines. (Just calls @@ -249,9 +249,9 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD__mpio_term + * Function: H5FD__mpio_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -263,7 +263,7 @@ done: static herr_t H5FD__mpio_term(void) { - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Reset VFL ID */ H5FD_MPIO_g = 0; @@ -273,40 +273,40 @@ H5FD__mpio_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_mpio + * Function: H5Pset_fapl_mpio * - * Purpose: Store the user supplied MPIO communicator comm and info in - * the file access property list FAPL_ID which can then be used - * to create and/or open the file. This function is available - * only in the parallel HDF5 library and is not collective. + * Purpose: Store the user supplied MPIO communicator comm and info in + * the file access property list FAPL_ID which can then be used + * to create and/or open the file. This function is available + * only in the parallel HDF5 library and is not collective. * - * comm is the MPI communicator to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of comm. Any modification to comm after this function - * call returns has no effect on the access property list. + * comm is the MPI communicator to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of comm. Any modification to comm after this function + * call returns has no effect on the access property list. * - * info is the MPI Info object to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of info. Any modification to info after this - * function call returns has no effect on the access property - * list. + * info is the MPI Info object to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of info. Any modification to info after this + * function call returns has no effect on the access property + * list. * * If fapl_id has previously set comm and info values, they * will be replaced and the old communicator and Info object * are freed. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Albert Cheng - * Feb 3, 1998 + * Programmer: Albert Cheng + * Feb 3, 1998 * *------------------------------------------------------------------------- */ herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) { - H5FD_mpio_fapl_t fa; + H5FD_mpio_fapl_t fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; @@ -319,7 +319,7 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") /* Initialize driver specific properties */ HDmemset(&fa, 0, sizeof(H5FD_mpio_fapl_t)); @@ -335,25 +335,25 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_mpio - * - * Purpose: If the file access property list is set to the H5FD_MPIO - * driver then this function returns duplicates of the MPI - * communicator and Info object stored through the comm and - * info pointers. It is the responsibility of the application - * to free the returned communicator and Info object. - * - * Return: Success: Non-negative with the communicator and - * Info object returned through the comm and - * info arguments if non-null. Since they are - * duplicates of the stored objects, future - * modifications to the access property list do - * not affect them and it is the responsibility - * of the application to free them. - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 + * Function: H5Pget_fapl_mpio + * + * Purpose: If the file access property list is set to the H5FD_MPIO + * driver then this function returns duplicates of the MPI + * communicator and Info object stored through the comm and + * info pointers. It is the responsibility of the application + * to free the returned communicator and Info object. + * + * Return: Success: Non-negative with the communicator and + * Info object returned through the comm and + * info arguments if non-null. Since they are + * duplicates of the stored objects, future + * modifications to the access property list do + * not affect them and it is the responsibility + * of the application to free them. + * Failure: Negative + * + * Programmer: Robb Matzke + * Thursday, February 26, 1998 * *------------------------------------------------------------------------- */ @@ -362,9 +362,9 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ - MPI_Comm comm_tmp = MPI_COMM_NULL; + MPI_Comm comm_tmp = MPI_COMM_NULL; hbool_t comm_copied = FALSE; /* MPI Comm has been duplicated */ - int mpi_code; /* MPI return code */ + int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -381,19 +381,19 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) /* Store the duplicated communicator in a temporary variable for error */ /* recovery in case the INFO duplication fails. */ if(comm) { - if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) comm_copied = TRUE; } /* end if */ if(info) { - if(MPI_INFO_NULL != fa->info) { - if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - } /* end if */ + if(MPI_INFO_NULL != fa->info) { + if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) + } /* end if */ else - /* do not dup it */ - *info = MPI_INFO_NULL; + /* do not dup it */ + *info = MPI_INFO_NULL; } /* end if */ /* Store the copied communicator, now that the Info object has been @@ -404,33 +404,33 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) done: if(ret_value < 0) - /* need to free anything created here */ - if(comm_copied) - MPI_Comm_free(&comm_tmp); + /* need to free anything created here */ + if(comm_copied) + MPI_Comm_free(&comm_tmp); FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_mpio() */ /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio + * Function: H5Pset_dxpl_mpio * - * Purpose: Set the data transfer property list DXPL_ID to use transfer - * mode XFER_MODE. The property list can then be used to control - * the I/O transfer mode during data I/O operations. The valid - * transfer modes are: + * Purpose: Set the data transfer property list DXPL_ID to use transfer + * mode XFER_MODE. The property list can then be used to control + * the I/O transfer mode during data I/O operations. The valid + * transfer modes are: * - * H5FD_MPIO_INDEPENDENT: - * Use independent I/O access (the default). + * H5FD_MPIO_INDEPENDENT: + * Use independent I/O access (the default). * - * H5FD_MPIO_COLLECTIVE: - * Use collective I/O access. + * H5FD_MPIO_COLLECTIVE: + * Use collective I/O access. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 + * Programmer: Albert Cheng + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -461,18 +461,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_dxpl_mpio + * Function: H5Pget_dxpl_mpio * - * Purpose: Queries the transfer mode current set in the data transfer - * property list DXPL_ID. This is not collective. + * Purpose: Queries the transfer mode current set in the data transfer + * property list DXPL_ID. This is not collective. * - * Return: Success: Non-negative, with the transfer mode returned - * through the XFER_MODE argument if it is - * non-null. - * Failure: Negative + * Return: Success: Non-negative, with the transfer mode returned + * through the XFER_MODE argument if it is + * non-null. + * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 + * Programmer: Albert Cheng + * April 2, 1998 * *------------------------------------------------------------------------- */ @@ -500,21 +500,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_collective_opt + * Function: H5Pset_dxpl_mpio_collective_opt * - * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O - * without involving decision-making inside HDF5 + * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O + * without involving decision-making inside HDF5 * - * Note: The library will do linked chunk I/O or multi-chunk I/O without - * involving communications for decision-making process. - * The library won't behave as it asks for only when we find - * that the low-level MPI-IO package doesn't support this. + * Note: The library will do linked chunk I/O or multi-chunk I/O without + * involving communications for decision-making process. + * The library won't behave as it asks for only when we find + * that the low-level MPI-IO package doesn't support this. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -543,21 +542,20 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt + * Function: H5Pset_dxpl_mpio_chunk_opt * - * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O - * without involving decision-making inside HDF5 + * Purpose: To set a flag to choose linked chunk I/O or multi-chunk I/O + * without involving decision-making inside HDF5 * - * Note: The library will do linked chunk I/O or multi-chunk I/O without - * involving communications for decision-making process. - * The library won't behave as it asks for only when we find - * that the low-level MPI-IO package doesn't support this. + * Note: The library will do linked chunk I/O or multi-chunk I/O without + * involving communications for decision-making process. + * The library won't behave as it asks for only when we find + * that the low-level MPI-IO package doesn't support this. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -586,19 +584,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_num + * Function: H5Pset_dxpl_mpio_chunk_opt_num * - * Purpose: To set a threshold for doing linked chunk IO + * Purpose: To set a threshold for doing linked chunk IO * - * Note: If the number is greater than the threshold set by the user, - * the library will do linked chunk I/O; otherwise, I/O will be - * done for every chunk. + * Note: If the number is greater than the threshold set by the user, + * the library will do linked chunk I/O; otherwise, I/O will be + * done for every chunk. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -627,22 +624,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_mpio_chunk_opt_ratio + * Function: H5Pset_dxpl_mpio_chunk_opt_ratio * - * Purpose: To set a threshold for doing collective I/O for each chunk + * Purpose: To set a threshold for doing collective I/O for each chunk * - * Note: The library will calculate the percentage of the number of - * process holding selections at each chunk. If that percentage - * of number of process in the individual chunk is greater than - * the threshold set by the user, the library will do collective - * chunk I/O for this chunk; otherwise, independent I/O will be - * done for this chunk. + * Note: The library will calculate the percentage of the number of + * process holding selections at each chunk. If that percentage + * of number of process in the individual chunk is greater than + * the threshold set by the user, the library will do collective + * chunk I/O for this chunk; otherwise, independent I/O will be + * done for this chunk. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Kent Yang - * ? ?, ? + * Programmer: Kent Yang * *------------------------------------------------------------------------- */ @@ -671,16 +667,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_get + * Function: H5FD__mpio_fapl_get * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. + * Purpose: Returns a file access property list which could be used to + * create another file the same as this one. * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. - * Failure: NULL + * Return: Success: Ptr to new file access property list with all + * fields copied from the file pointer. + * Failure: NULL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 13, 1999 * *------------------------------------------------------------------------- @@ -688,9 +684,9 @@ done: static void * H5FD__mpio_fapl_get(H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - H5FD_mpio_fapl_t *fa = NULL; - void *ret_value; /* Return value */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_fapl_t *fa = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -701,28 +697,38 @@ H5FD__mpio_fapl_get(H5FD_t *_file) /* Check arguments */ if(NULL == (fa = (H5FD_mpio_fapl_t *)H5MM_calloc(sizeof(H5FD_mpio_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + fa->comm = MPI_COMM_NULL; + fa->info = MPI_INFO_NULL; - /* Duplicate communicator and Info object. */ - if(FAIL == H5FD_mpi_comm_info_dup(file->comm, file->info, &fa->comm, &fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + /* Duplicate MPI communicator and info */ + if(FAIL == H5_mpi_comm_dup(file->comm, &fa->comm)) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") + if(FAIL == H5_mpi_info_dup(file->info, &fa->info)) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") /* Set return value */ ret_value = fa; done: + /* Clean up badness if we're failing */ + if(NULL == ret_value && fa) { + H5_mpi_comm_free(&fa->comm); + H5_mpi_info_free(&fa->info); + H5MM_xfree(fa); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mpio_fapl_get() */ /*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_copy + * Function: H5FD__mpio_fapl_copy * - * Purpose: Copies the mpio-specific file access properties. + * Purpose: Copies the mpio-specific file access properties. * - * Return: Success: Ptr to a new property list - * Failure: NULL + * Return: Success: Ptr to a new property list + * Failure: NULL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * *------------------------------------------------------------------------- @@ -730,9 +736,9 @@ done: static void * H5FD__mpio_fapl_copy(const void *_old_fa) { - const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; - H5FD_mpio_fapl_t *new_fa = NULL; - void *ret_value = NULL; + const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; + H5FD_mpio_fapl_t *new_fa = NULL; + void *ret_value = NULL; FUNC_ENTER_STATIC @@ -747,18 +753,22 @@ if(H5FD_mpio_Debug[(int)'t']) /* Copy the general information */ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); - /* Duplicate communicator and Info object. */ - if(H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + /* Duplicate MPI communicator and info */ + if(H5_mpi_comm_dup(old_fa->comm, &new_fa->comm) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") + if(H5_mpi_info_dup(old_fa->info, &new_fa->info) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") /* Set return value */ ret_value = new_fa; done: - if(NULL == ret_value) - /* cleanup */ - if(new_fa) - H5MM_xfree(new_fa); + /* Clean up badness if we're failing */ + if(NULL == ret_value && new_fa) { + H5_mpi_comm_free(&new_fa->comm); + H5_mpi_info_free(&new_fa->info); + H5MM_xfree(new_fa); + } #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) @@ -770,14 +780,13 @@ if(H5FD_mpio_Debug[(int)'t']) /*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_free + * Function: H5FD__mpio_fapl_free * - * Purpose: Frees the mpio-specific file access properties. + * Purpose: Frees the mpio-specific file access properties. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Jan 8, 2003 * *------------------------------------------------------------------------- @@ -785,10 +794,9 @@ if(H5FD_mpio_Debug[(int)'t']) static herr_t H5FD__mpio_fapl_free(void *_fa) { - H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; - herr_t ret_value = SUCCEED; + H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) @@ -800,7 +808,8 @@ if(H5FD_mpio_Debug[(int)'t']) /* Free the internal communicator and INFO object */ HDassert(MPI_COMM_NULL != fa->comm); - H5FD_mpi_comm_info_free(&fa->comm, &fa->info); + H5_mpi_comm_free(&fa->comm); + H5_mpi_info_free(&fa->info); H5MM_xfree(fa); #ifdef H5FDmpio_DEBUG @@ -808,21 +817,19 @@ if(H5FD_mpio_Debug[(int)'t']) HDfprintf(stderr, "%s: leaving\n", FUNC); #endif - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__mpio_fapl_free() */ /*------------------------------------------------------------------------- - * Function: H5FD_set_mpio_atomicity - * - * Purpose: Sets the atomicity mode + * Function: H5FD_set_mpio_atomicity * - * Return: Success: Non-negative + * Purpose: Sets the atomicity mode * - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -838,7 +845,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif if(FALSE == flag) @@ -853,7 +860,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -861,16 +868,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_get_mpio_atomicity - * - * Purpose: Returns the atomicity mode + * Function: H5FD_get_mpio_atomicity * - * Return: Success: Non-negative + * Purpose: Returns the atomicity mode * - * Failure: Negative + * Return: SUCCEED/FAIL * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -886,7 +891,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif /* Get atomicity value */ @@ -901,7 +906,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -912,14 +917,14 @@ done: * Function: H5FD__mpio_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with - * purpose similar to the second argument of open(2) and which - * are defined in H5Fpublic.h. The file access property list - * FAPL_ID contains the properties driver properties and MAXADDR - * is the largest address which this file will be expected to - * access. This is collective. + * purpose similar to the second argument of open(2) and which + * are defined in H5Fpublic.h. The file access property list + * FAPL_ID contains the properties driver properties and MAXADDR + * is the largest address which this file will be expected to + * access. This is collective. * - * Return: Success: A new file pointer. - * Failure: NULL + * Return: Success: A new file pointer + * Failure: NULL * * Programmer: Robert Kim Yates * January 30, 1998 @@ -943,30 +948,32 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, H5P_genplist_t *plist; /* Property list pointer */ MPI_Comm comm_dup = MPI_COMM_NULL; MPI_Info info_dup = MPI_INFO_NULL; - H5FD_t *ret_value; /* Return value */ + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr); + HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif /* Obtain a pointer to mpio-specific file access properties */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { - _fa.comm = MPI_COMM_SELF; /*default*/ - _fa.info = MPI_INFO_NULL; /*default*/ - fa = &_fa; + _fa.comm = MPI_COMM_SELF; /*default*/ + _fa.info = MPI_INFO_NULL; /*default*/ + fa = &_fa; } /* end if */ else if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") - /* Duplicate communicator and Info object for use by this file. */ - if(FAIL == H5FD_mpi_comm_info_dup(fa->comm, fa->info, &comm_dup, &info_dup)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "Communicator/Info duplicate failed") + /* Duplicate MPI communicator and info */ + if(FAIL == H5_mpi_comm_dup(fa->comm, &comm_dup)) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") + if(FAIL == H5_mpi_info_dup(fa->info, &info_dup)) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") /* convert HDF5 flags to MPI-IO flags */ /* some combinations are illegal; let MPI-IO figure it out */ @@ -1046,12 +1053,10 @@ done: if(ret_value == NULL) { if(file_opened) MPI_File_close(&fh); - if(MPI_COMM_NULL != comm_dup) - MPI_Comm_free(&comm_dup); - if(MPI_INFO_NULL != info_dup) - MPI_Info_free(&info_dup); - if(file) - H5MM_xfree(file); + MPI_Comm_free(&comm_dup); + MPI_Info_free(&info_dup); + if(file) + H5MM_xfree(file); } /* end if */ #ifdef H5FDmpio_DEBUG @@ -1068,8 +1073,7 @@ done: * * Purpose: Closes a file. This is collective. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Unknown * January 30, 1998 @@ -1079,15 +1083,15 @@ done: static herr_t H5FD__mpio_close(H5FD_t *_file) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - int mpi_code; /* MPI return code */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif /* Sanity checks */ @@ -1099,13 +1103,14 @@ H5FD__mpio_close(H5FD_t *_file) HMPI_GOTO_ERROR(FAIL, "MPI_File_close failed", mpi_code) /* Clean up other stuff */ - H5FD_mpi_comm_info_free(&file->comm, &file->info); + H5_mpi_comm_free(&file->comm); + H5_mpi_info_free(&file->info); H5MM_xfree(file); done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1113,15 +1118,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_query + * Function: H5FD__mpio_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * *------------------------------------------------------------------------- @@ -1129,7 +1133,7 @@ done: static herr_t H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out */) { - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -1146,16 +1150,16 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out /*------------------------------------------------------------------------- - * Function: H5FD__mpio_get_eoa + * Function: H5FD__mpio_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * *------------------------------------------------------------------------- @@ -1163,9 +1167,9 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1176,16 +1180,15 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) /*------------------------------------------------------------------------- - * Function: H5FD__mpio_set_eoa + * Function: H5FD__mpio_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * *------------------------------------------------------------------------- @@ -1193,9 +1196,9 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) static herr_t H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1208,27 +1211,27 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD__mpio_get_eof + * Function: H5FD__mpio_get_eof * - * Purpose: Gets the end-of-file marker for the file. The EOF marker - * is the real size of the file. + * Purpose: Gets the end-of-file marker for the file. The EOF marker + * is the real size of the file. * - * The MPIO driver doesn't bother keeping this field updated - * since that's a relatively expensive operation. Fortunately - * the library only needs the EOF just after the file is opened - * in order to determine whether the file is empty, truncated, - * or okay. Therefore, any MPIO I/O function will set its value - * to HADDR_UNDEF which is the error return value of this - * function. + * The MPIO driver doesn't bother keeping this field updated + * since that's a relatively expensive operation. Fortunately + * the library only needs the EOF just after the file is opened + * in order to determine whether the file is empty, truncated, + * or okay. Therefore, any MPIO I/O function will set its value + * to HADDR_UNDEF which is the error return value of this + * function. * * Keeping the EOF updated (during write calls) is expensive * because any process may extend the physical end of the * file. -QAK * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-file marker + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, August 6, 1999 * *------------------------------------------------------------------------- @@ -1236,9 +1239,9 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) static haddr_t H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1253,7 +1256,7 @@ H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Purpose: Returns the file handle of MPIO file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: Raymond Lu * Sept. 16, 2002 @@ -1283,13 +1286,11 @@ done: * * Purpose: Returns the file info of MPIO file driver. * - * Returns: Non-negative if succeed or negative if fails. + * Returns: SUCCEED/FAIL * * Programmer: John Mainzer * April 4, 2017 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1312,23 +1313,23 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_read + * Function: H5FD__mpio_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Reading past the end of the MPI file returns zeros instead of - * failing. MPI is able to coalesce requests from different - * processes (collective or independent). + * Reading past the end of the MPI file returns zeros instead of + * failing. MPI is able to coalesce requests from different + * processes (collective or independent). * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: SUCCEED. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, Contents of buffer BUF are undefined. + * Failure: FAIL. Contents of buffer BUF are undefined. * - * Programmer: rky, 1998-01-30 + * Programmer: rky, 1998-01-30 * *------------------------------------------------------------------------- */ @@ -1531,22 +1532,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_write + * Function: H5FD__mpio_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * MPI is able to coalesce requests from different processes - * (collective and independent). + * MPI is able to coalesce requests from different processes + * (collective and independent). * - * Return: Success: Zero. USE_TYPES and OLD_USE_TYPES in the - * access params are altered. - * Failure: -1, USE_TYPES and OLD_USE_TYPES in the - * access params may be altered. + * Return: Success: SUCCEED. USE_TYPES and OLD_USE_TYPES in the + * access params are altered. + * Failure: FAIL. USE_TYPES and OLD_USE_TYPES in the + * access params may be altered. * - * Programmer: Robert Kim Yates + * Programmer: Robert Kim Yates * January 30, 1998 * *------------------------------------------------------------------------- @@ -1555,13 +1556,13 @@ static herr_t H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, const void *buf) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - MPI_Offset mpi_off; - MPI_Status mpi_stat; /* Status from I/O operation */ - MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int mpi_code; /* MPI return code */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ + int mpi_code; /* MPI return code */ #if MPI_VERSION >= 3 - MPI_Count bytes_written; + MPI_Count bytes_written; MPI_Count type_size; /* MPI datatype used for I/O's size */ MPI_Count io_size; /* Actual number of bytes requested */ #else @@ -1570,15 +1571,15 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, int io_size; /* Actual number of bytes requested */ #endif int size_i; - hbool_t use_view_this_time = FALSE; + hbool_t use_view_this_time = FALSE; H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif /* Sanity checks */ @@ -1615,7 +1616,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, * could mean "use MPI_BYTE" by convention). */ if(xfer_mode == H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + MPI_Datatype file_type; /* Remember that views are used */ use_view_this_time = TRUE; @@ -1713,7 +1714,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value ); + HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", FUNC, file->mpi_rank, ret_value ); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1725,9 +1726,7 @@ done: * * Purpose: Makes sure that all data is on disk. This is collective. * - * Return: Success: Non-negative - * - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Robb Matzke * January 30, 1998 @@ -1737,15 +1736,15 @@ done: static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - int mpi_code; /* mpi return code */ - herr_t ret_value = SUCCEED; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + int mpi_code; /* mpi return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif /* Sanity checks */ @@ -1760,7 +1759,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1782,8 +1781,7 @@ done: * only call MPI_File_set_size() if this value disagrees * with the current eoa. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * January 31, 2008 @@ -1793,14 +1791,14 @@ done: static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UNUSED closing) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; herr_t ret_value = SUCCEED; FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Entering\n", FUNC); + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif /* Sanity checks */ @@ -1869,7 +1867,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stdout, "%s: Leaving\n", FUNC); + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1877,14 +1875,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_mpi_rank + * Function: H5FD__mpio_mpi_rank * - * Purpose: Returns the MPI rank for a process + * Purpose: Returns the MPI rank for a process * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 16, 2002 * *------------------------------------------------------------------------- @@ -1892,9 +1890,9 @@ done: static int H5FD__mpio_mpi_rank(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1905,14 +1903,14 @@ H5FD__mpio_mpi_rank(const H5FD_t *_file) /*------------------------------------------------------------------------- - * Function: H5FD__mpio_mpi_size + * Function: H5FD__mpio_mpi_size * - * Purpose: Returns the number of MPI processes + * Purpose: Returns the number of MPI processes * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 16, 2002 * *------------------------------------------------------------------------- @@ -1920,9 +1918,9 @@ H5FD__mpio_mpi_rank(const H5FD_t *_file) static int H5FD__mpio_mpi_size(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1933,15 +1931,14 @@ H5FD__mpio_mpi_size(const H5FD_t *_file) /*------------------------------------------------------------------------- - * Function: H5FD__mpio_communicator - * - * Purpose: Returns the MPI communicator for the file. + * Function: H5FD__mpio_communicator * - * Return: Success: The communicator + * Purpose: Returns the MPI communicator for the file. * - * Failure: NULL + * Return: Success: The communicator + * Failure: Can't fail * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 9, 1999 * *------------------------------------------------------------------------- @@ -1949,9 +1946,9 @@ H5FD__mpio_mpi_size(const H5FD_t *_file) static MPI_Comm H5FD__mpio_communicator(const H5FD_t *_file) { - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; + const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* Sanity checks */ HDassert(file); @@ -1971,8 +1968,6 @@ H5FD__mpio_communicator(const H5FD_t *_file) * Programmer: John Mainzer * April 4, 2017 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index c79d676..0db66af 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -160,9 +160,6 @@ H5_DLL herr_t H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged); /* General routines */ H5_DLL haddr_t H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off); H5_DLL herr_t H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off/*out*/); -H5_DLL herr_t H5FD_mpi_comm_info_dup(MPI_Comm comm, MPI_Info info, - MPI_Comm *comm_new, MPI_Info *info_new); -H5_DLL herr_t H5FD_mpi_comm_info_free(MPI_Comm *comm, MPI_Info *info); #ifdef NOT_YET H5_DLL herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file); H5_DLL herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file); diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 5bbd717..12bcbc0 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -90,14 +90,14 @@ herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) { herr_t ret_value = SUCCEED; - hid_t fapl = -1; + hid_t fapl_id = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) HDassert(f && f->shared); /* Dispatch to driver */ - if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0) + if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl_id, (void **)f_handle)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") done: @@ -106,33 +106,31 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_mpi_get_rank + * Function: H5F_mpi_get_rank * - * Purpose: Retrieves the rank of an MPI process. + * Purpose: Retrieves the rank of an MPI process. * - * Return: Success: The rank (non-negative) + * Return: Success: The rank (non-negative) * - * Failure: Negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5F_mpi_get_rank(const H5F_t *f) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(f && f->shared); /* Dispatch to driver */ - if ((ret_value=H5FD_mpi_get_rank(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed") + if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_rank request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -140,32 +138,30 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_mpi_get_comm + * Function: H5F_mpi_get_comm * - * Purpose: Retrieves the file's communicator + * Purpose: Retrieves the file's communicator * - * Return: Success: The communicator (non-negative) + * Return: Success: The communicator (non-negative) * - * Failure: Negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, January 30, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ MPI_Comm H5F_mpi_get_comm(const H5F_t *f) { - MPI_Comm ret_value; + MPI_Comm ret_value = MPI_COMM_NULL; FUNC_ENTER_NOAPI(MPI_COMM_NULL) HDassert(f && f->shared); /* Dispatch to driver */ - if ((ret_value=H5FD_mpi_get_comm(f->shared->lf))==MPI_COMM_NULL) + if ((ret_value = H5FD_mpi_get_comm(f->shared->lf)) == MPI_COMM_NULL) HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") done: @@ -185,22 +181,20 @@ done: * Programmer: John Mainzer * Friday, May 6, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ int H5F_mpi_get_size(const H5F_t *f) { - int ret_value; + int ret_value = -1; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI((-1)) HDassert(f && f->shared); /* Dispatch to driver */ - if ((ret_value=H5FD_mpi_get_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed") + if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -208,16 +202,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fset_mpi_atomicity + * Function: H5Fset_mpi_atomicity * - * Purpose: Sets the atomicity mode + * Purpose: Sets the atomicity mode * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -248,16 +242,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Fget_mpi_atomicity + * Function: H5Fget_mpi_atomicity * - * Purpose: Returns the atomicity mode + * Purpose: Returns the atomicity mode * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ @@ -288,18 +282,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_mpi_retrieve_comm + * Function: H5F_mpi_retrieve_comm * - * Purpose: Retrieves an MPI communicator from the file the location ID + * Purpose: Retrieves an MPI communicator from the file the location ID * is in. If the loc_id is invalid, the fapl_id is used to * retrieve the communicator. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 * *------------------------------------------------------------------------- */ diff --git a/src/H5mpi.c b/src/H5mpi.c new file mode 100644 index 0000000..ea6b33f --- /dev/null +++ b/src/H5mpi.c @@ -0,0 +1,198 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: Common MPI routines + * + */ + + +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpi.h" /* Common MPI file driver */ +#include "H5Pprivate.h" /* Property lists */ + +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5_mpi_comm_dup + * + * Purpose: Duplicate an MPI communicator. + * + * The new communicator is returned via the comm_new pointer. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new) +{ + herr_t ret_value = SUCCEED; + MPI_Comm comm_dup = MPI_COMM_NULL; + int mpi_code; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!comm_new) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL") + if (MPI_COMM_NULL == comm) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't duplicate MPI_COMM_NULL") + + /* Duplicate the MPI communicator */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(comm, &comm_dup))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + + /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal, + * and return codes can be checked and handled. + */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN))) + HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code) + + /* Copy the new communicator to the return argument */ + *comm_new = comm_dup; + +done: + if (FAIL == ret_value) { + /* need to free anything created here */ + if (MPI_COMM_NULL != comm_dup) + MPI_Comm_free(&comm_dup); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_mpi_comm_dup() */ + + +/*------------------------------------------------------------------------- + * Function: H5_mpi_info_dup + * + * Purpose: Duplicate an MPI info. + * + * If the info object is MPI_INFO_NULL, no duplicate + * is made but the same value assigned to the new info object + * handle. + * + * The new info is returned via the info_new pointer. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new) +{ + herr_t ret_value = SUCCEED; + MPI_Info info_dup = MPI_INFO_NULL; + int mpi_code; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!info_new) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info_new cannot be NULL") + + /* Duplicate the MPI info */ + if (info == MPI_INFO_NULL) { + /* Don't duplicate MPI_INFO_NULL. Just copy it. */ + info_dup = info; + } + else { + /* Duplicate the info */ + if (MPI_SUCCESS != (mpi_code = MPI_Info_dup(info, &info_dup))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) + } + + /* Copy the new info to the return argument */ + *info_new = info_dup; + +done: + if (FAIL == ret_value) { + /* need to free anything created here */ + if (MPI_INFO_NULL != info_dup) + MPI_Info_free(&info_dup); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_mpi_info_dup() */ + + +/*------------------------------------------------------------------------- + * Function: H5_mpi_comm_free + * + * Purpose: Free an MPI communicator. + * + * If comm is MPI_COMM_NULL this call does nothing. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_comm_free(MPI_Comm *comm) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!comm) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL") + + /* Free the communicator */ + if (MPI_COMM_NULL != *comm) + MPI_Comm_free(comm); + + *comm = MPI_COMM_NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* End H5_mpi_comm_free() */ + +/*------------------------------------------------------------------------- + * Function: H5_mpi_info_free + * + * Purpose: Free the MPI info. + * + * If info is MPI_INFO_NULL this call does nothing. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_info_free(MPI_Info *info) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!info) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info pointer cannot be NULL") + + /* Free the info */ + if (MPI_INFO_NULL != *info) + MPI_Info_free(info); + + *info = MPI_INFO_NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* End H5_mpi_info_free() */ + +#endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5private.h b/src/H5private.h index 537e860..18b52a0 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2668,6 +2668,14 @@ H5_DLL double H5_get_time(void); H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); +#ifdef H5_HAVE_PARALLEL +/* Generic MPI functions */ +H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new); +H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new); +H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm); +H5_DLL herr_t H5_mpi_info_free(MPI_Info *info); +#endif /* H5_HAVE_PARALLEL */ + /* Functions for debugging */ H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *marker, size_t buf_offset, size_t buf_size); diff --git a/src/Makefile.am b/src/Makefile.am index 1e6578e..1e1273c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -126,7 +126,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL - libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c + libhdf5_la_SOURCES += H5mpi.c H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c endif # Only compile the direct VFD if necessary -- cgit v0.12 From c490fefbc3199d45fa4d3af09dd567671a244e8d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 14 Aug 2019 17:09:11 -0700 Subject: Added public H5Sselect_adjust_u and H5Shyper_adjust_s calls. --- src/H5Shyper.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/H5Spublic.h | 2 ++ src/H5Sselect.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 492cd9e..153f4be 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -7025,6 +7025,47 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_adjust_s() */ +/*-------------------------------------------------------------------------- + NAME + H5Shyper_adjust_s + PURPOSE + Adjust a hyperslab selection by subtracting an offset + USAGE + herr_t H5Shyper_adjust_s(space_id,offset) + hid_t space_id; IN: ID of the dataspace to adjust + const hssize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Moves a hyperslab selection by subtracting an offset from it. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset) +{ + H5S_t *space; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Hs", space_id, offset); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + if(NULL == offset) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") + + if(H5S_hyper_adjust_s(space, offset) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Shyper_adjust_s() */ + /*-------------------------------------------------------------------------- NAME diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 9e76b4b..a04f3c1 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -143,6 +143,7 @@ H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); H5_DLL htri_t H5Sselect_valid(hid_t spaceid); +H5_DLL herr_t H5Sselect_adjust_u(hid_t spaceid, const hsize_t *offset); H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t start[], hsize_t end[]); H5_DLL htri_t H5Sselect_shape_same(hid_t space1_id, hid_t space2_id); @@ -170,6 +171,7 @@ H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t buf[/*numblocks*/]); +H5_DLL herr_t H5Shyper_adjust_s(hid_t space_id, const hssize_t *offset); /* Operations on dataspace selection iterators */ H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index e632b11..1a13f2c 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -971,6 +971,45 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_adjust_u() */ +/*-------------------------------------------------------------------------- + NAME + H5Sselect_adjust_u + PURPOSE + Adjust a selection by subtracting an offset + USAGE + herr_t H5Sselect_adjust_u(space_id, offset) + hid_t space_id; IN: ID of dataspace to adjust + const hsize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Moves a selection by subtracting an offset from it. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5Sselect_adjust_u(hid_t space_id, const hsize_t *offset) +{ + H5S_t *space; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*h", space_id, offset); + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + if(NULL == offset) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") + + if(H5S_select_adjust_u(space, offset) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Sselect_adjust_u() */ + /*-------------------------------------------------------------------------- NAME -- cgit v0.12 From f5a250e77cf0455e14fc3c2bcd78d5373cf6d01e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Aug 2019 09:03:03 -0500 Subject: Whitespace cleanup --- tools/test/perform/perf.c | 12 ++++++------ tools/test/perform/sio_engine.c | 12 ++++++------ tools/test/perform/sio_perf.c | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 1d52471..34b8a2d 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -64,13 +64,13 @@ #define H5FATAL 1 #define VRFY(val, mesg, fatal) do { \ if (!val) { \ - printf("Proc %d: ", mynod); \ + printf("Proc %d: ", mynod); \ printf("*** Assertion failed (%s) at line %4d in %s\n", \ - mesg, (int)__LINE__, __FILE__); \ - if (fatal){ \ - fflush(stdout); \ - goto die_jar_jar_die; \ - } \ + mesg, (int)__LINE__, __FILE__); \ + if (fatal){ \ + fflush(stdout); \ + goto die_jar_jar_die; \ + } \ } \ } while(0) #define RANK 1 diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index ed15fa5..aefd2b3 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -264,7 +264,7 @@ done: case HDF5: if (fd.h5fd != -1) hrc = do_fclose(iot, &fd); - break; + break; default: /* unknown request */ HDassert(0 && "Unknown IO type"); @@ -685,7 +685,7 @@ dset_write(int local_dim, file_descr *fd, parameters *parms, void *buffer) VRFY((hrc >= 0), "H5Dwrite"); break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -863,7 +863,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) GOTOERROR(FAIL); } break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -987,7 +987,7 @@ dset_read(int local_dim, file_descr *fd, parameters *parms, void *buffer, h5dset_space_id, h5dxpl, buffer); VRFY((hrc >= 0), "H5Dread"); break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)parms->io_type); @@ -1114,7 +1114,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) GOTOERROR(FAIL); } break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)param->io_type); @@ -1242,7 +1242,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) fd->h5fd = -1; break; - + default: /* unknown request */ HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot); diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index e77b99e..731be47 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -98,7 +98,7 @@ static const char *progname = "h5perf_serial"; * It seems that only the options that accept additional information * such as dataset size (-e) require the colon next to it. */ -static const char *s_opts = "a:A:B:b:c:Cd:D:e:F:G:ghi:Imno:p:P:r:stT:v:wx:X:"; +static const char *s_opts = "a:A:B:c:Cd:D:e:F:ghi:Imno:p:P:r:stT:v:wx:X:"; static struct long_options l_opts[] = { { "align", require_arg, 'a' }, { "alig", require_arg, 'a' }, -- cgit v0.12 From 98c8c6e45b1cc0603d9730fa235956712373701a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Aug 2019 10:28:40 -0500 Subject: Mostly whitespace in testpar, addl changes for tmp dir --- test/CMakeTests.cmake | 10 +- test/Makefile.am | 3 +- test/links.c | 194 ++++++++++++------------- test/links_env.c | 76 +++++----- test/testlinks_env.sh.in | 12 +- test/testvds_env.sh.in | 8 +- testpar/t_chunk_alloc.c | 159 ++++++++++---------- testpar/testphdf5.c | 366 +++++++++++++++++++++++------------------------ 8 files changed, 414 insertions(+), 414 deletions(-) diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 587af80..b7eaa56 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -444,7 +444,7 @@ set (test_CLEANFILES cache_logging.out vds_swmr.h5 vds_swmr_src_*.h5 - tmp/vds_src_2.h5 + tmp_vds_env/vds_src_2.h5 direct_chunk.h5 native_vol_test.h5 ) @@ -613,7 +613,7 @@ else () -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" -D "TEST_ENV_VAR:STRING=HDF5_VDS_PREFIX" - -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp" + -D "TEST_ENV_VALUE:STRING=\${ORIGIN}/tmp_vds_env" -D "TEST_EXPECT=0" -D "TEST_SKIP_COMPARE=TRUE" -D "TEST_OUTPUT=vds_env.txt" @@ -837,7 +837,7 @@ add_test (NAME H5TEST-links_env-clear-objects COMMAND ${CMAKE_COMMAND} -E remove extlinks_env0.h5 extlinks_env1.h5 - tmp/extlinks_env1.h5 + tmp_links_env/extlinks_env1.h5 WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -850,7 +850,7 @@ else () -D "TEST_PROGRAM=$" -D "TEST_ARGS:STRING=" #-D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" - #-D "TEST_ENV_VALUE:STRING=.:tmp" + #-D "TEST_ENV_VALUE:STRING=.:tmp_links_env" -D "TEST_EXPECT=0" -D "TEST_OUTPUT=links_env.txt" -D "TEST_REFERENCE=links_env.out" @@ -860,7 +860,7 @@ else () endif () set_tests_properties (H5TEST-links_env PROPERTIES FIXTURES_REQUIRED clear_links_env - ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp" + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_EXT_PREFIX=.:tmp_links_env" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) diff --git a/test/Makefile.am b/test/Makefile.am index aa6afee..ff6d1c6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -184,7 +184,8 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ ohdr_min_a.h5 ohdr_min_b.h5 min_dset_ohdr_testfile.h5\ - dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ + dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 \ + tmp tmp_links tmp2_links tmp_links_env tmp_vds_env \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \ diff --git a/test/links.c b/test/links.c index 4ade33a..cd44433 100644 --- a/test/links.c +++ b/test/links.c @@ -106,7 +106,7 @@ const char *FILENAME[] = { #define CORE_INCREMENT 1024 #define NUM40 40 -/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ +/* do not do check_all_closed() for "ext*" files and "tmp_links/ext*" */ #define EXTSTOP 12 #define LINK_BUF_SIZE 1024 @@ -2562,9 +2562,9 @@ error: * * Purpose: 1. target link: "extlinks2" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set + * 3. target file: "tmp_links/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp_links" + * Should be able to access the target file in tmp_links directory via the prefix set * by H5Pset_elink_prefix() * * @@ -2592,11 +2592,11 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks2" */ h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file: "tmp/extlinks2" */ + /* set up name for target file: "tmp_links/extlinks2" */ h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2626,7 +2626,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2650,8 +2650,8 @@ error: * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" + * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Windows: ":/CWD/tmp_links/extlinks0" + * 3. target file: "tmp_links/extlinks3" * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 @@ -2676,17 +2676,17 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* set up name for external linked target file: "extlinks3" */ h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks3" */ + /* set up name for target file: "tmp_links/extlinks3" */ h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Window: ":/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Window: ":/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -2714,7 +2714,7 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from absolute path set for main file */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2738,8 +2738,8 @@ error: * Function: external_link_rel_mainpath: test 4 * * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" + * 2. main file: "tmp_links/extlinks0" + * 3. target file: "tmp_links/extlinks4" * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 @@ -2766,9 +2766,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for main file: "tmp/extlinks0" */ + /* set up name for main file: "tmp_links/extlinks0" */ h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1); - /* set up name for target file: "tmp/extlinks4" */ + /* set up name for target file: "tmp_links/extlinks4" */ h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2817,7 +2817,7 @@ error: * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 2. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: ":/CWD/tmp_links/extlinks0" * 3. target file: "extlinks5" * Should be able to access the target file in the current working directory * @@ -2849,8 +2849,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: ":/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -2901,9 +2901,9 @@ error: /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * - * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" + * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:":/CWD/tmp_links/extlinks6" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" + * 3. target file: "tmp_links/extlinks6" * Should be able to access the target file's absolute path * * Return: Success: 0 @@ -2929,19 +2929,19 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks6" - * Windows: ":/CWD/tmp/extlinks6" + * Linux: "/CWD/tmp_links/extlinks6" + * Windows: ":/CWD/tmp_links/extlinks6" */ fix_ext_filename(tmpname, cwdpath, FILENAME[23]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks6" */ + /* set up name for target file: "tmp_links/extlinks6" */ h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -2966,7 +2966,7 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -2988,7 +2988,7 @@ error: /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * - * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" + * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: ":/CWD/tmp_links/extlinks7" * 2. main file: "extlinks0" * 3. target file: "extlinks7" * Should be able to access the target file via the main file's CWD. @@ -3019,14 +3019,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* set up name for target file name: "extlinks7" */ h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR /* * set up name for external linked target file: - * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Linux: "/CWD/tmp_links/extlinks7" + * Windows: ":/CWD/tmp_links/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3076,9 +3076,9 @@ error: /*------------------------------------------------------------------------- * Function: external_link_reltar: test 8 * - * Purpose: 1. target link: Linux:"tmp/extlinks8" + * Purpose: 1. target link: Linux:"tmp_links/extlinks8" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" + * 3. target file: "tmp_links/extlinks8" * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 @@ -3101,11 +3101,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name: "tmp/extlinks8" */ - /* set up name for external linked target file: "tmp/extlinks8" */ + /* set up name for target file name: "tmp_links/extlinks8" */ + /* set up name for external linked target file: "tmp_links/extlinks8" */ h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2); /* Create the target file */ @@ -3126,7 +3126,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } /* end if */ @@ -3152,8 +3152,8 @@ error: * Purpose: * 1. target link: "extlinks9" * 2. main file: "extlinks0" - * 3. target file" "tmp/extlinks9" - * 3. chdir "tmp" + * 3. target file" "tmp_links/extlinks9" + * 3. chdir "tmp_links" * Should be able to access the target file in current working directory * * Return: Success: 0 @@ -3179,10 +3179,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) /* set up name for external linked target file ("extlinks9") */ h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target file name ("tmp/extlinks9") */ + /* set up name for target file name ("tmp_links/extlinks9") */ h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -3215,7 +3215,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); + HDputs(" Should have found the file in tmp_links directory."); goto error; } @@ -3243,7 +3243,7 @@ error: * * 1. target link: "extlinks16" * 2. target file: "extlinks16" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: ":/CWD/tmp_links/extlinks0" * 4. Create target file A to be a "family" file: extlinks16A * 4. Create target file B to be a "multi" file: extlinks16B * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A @@ -3285,8 +3285,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: ":/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -3435,7 +3435,7 @@ error: * * 1. target link: "extlinks17" * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: ":/CWD/tmp_links/extlinks0" * 4. Create target file to be a "core" file:/A/Dataset * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset * 6. Set the file access property list of the link access to use "core" file without @@ -3474,8 +3474,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" - * Windows: ":/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp_links/extlinks0" + * Windows: ":/CWD/tmp_links/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -4108,7 +4108,7 @@ error: * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" + * 1. target link: "/CWD/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" * Should be able to find the target file via main file's current drive/rel path @@ -4139,7 +4139,7 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks10" */ + /* set up name for target link: "/CWD/tmp_links/extlinks10" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -4194,9 +4194,9 @@ error: * Function: external_link_win2 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks11" + * 1. target link: "/CWD/tmp_links/extlinks11" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" + * 3. target file: "tmp_links/extlinks11" * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 @@ -4222,17 +4222,17 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) TEST_ERROR - /* set up name for target link: "/CWD/tmp/extlinks11" */ + /* set up name for target link: "/CWD/tmp_links/extlinks11" */ HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[31]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks11" */ + /* set up name for target file: "tmp_links/extlinks11" */ h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4258,7 +4258,7 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4282,9 +4282,9 @@ error: * Function: external_link_win3 * * Purpose: - * 1. target link: ":tmp/extlinks12" + * 1. target link: ":tmp_links/extlinks12" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" + * 3. target file: "tmp_links/extlinks12" * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 @@ -4310,16 +4310,16 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for target link: ":tmp/extlinks12" */ + /* set up name for target link: ":tmp_links/extlinks12" */ drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks12" */ + /* set up name for target file: "tmp_links/extlinks12" */ h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4345,7 +4345,7 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4369,8 +4369,8 @@ external_link_win3(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":extlinks13" - * 2. main file: ":tmp/extlinks0" - * 3. target file: tmp/extlinks13 + * 2. main file: ":tmp_links/extlinks0" + * 3. target file: tmp_links/extlinks13 * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 @@ -4393,7 +4393,7 @@ external_link_win4(hid_t fapl, hbool_t new_format) else TESTING("external links via main file's abs drive/rel path (windows)") - /* set up name for main file: ":tmp/extlinks0" */ + /* set up name for main file: ":tmp_links/extlinks0" */ drive = HDgetdrive(); HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); @@ -4402,7 +4402,7 @@ external_link_win4(hid_t fapl, hbool_t new_format) HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks13" */ + /* set up name for target file: "tmp_links/extlinks13" */ h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4451,9 +4451,9 @@ error: * Function: external_link_win5 * * Purpose: - * 1. target link: ":tmp/extlinks14" + * 1. target link: ":tmp_links/extlinks14" * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" + * 3. target file: "tmp_links/extlinks14" * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 @@ -4491,11 +4491,11 @@ external_link_win5(hid_t fapl, hbool_t new_format) HDstrcat(tmpname, FILENAME[12]); h5_fixname(tmpname, fapl, filename1, sizeof filename1); - /* set up name for target link: ":tmp/extlinks14" */ + /* set up name for target link: ":tmp_links/extlinks14" */ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); - /* set up name for target file: "tmp/extlinks14" */ + /* set up name for target file: "tmp_links/extlinks14" */ h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3); /* Create the target file */ @@ -4544,9 +4544,9 @@ error: * Function: external_link_win6 * * Purpose: - * 1. target link: ":tmp/extlinks15" + * 1. target link: ":tmp_links/extlinks15" * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" + * 3. target file: "tmp_links/extlinks15" * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 @@ -4569,7 +4569,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) else TESTING("external links via target's current drive/rel path (windows)") - /* create tmp directory */ + /* create tmp_links directory */ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR drive = HDgetdrive(); @@ -4581,7 +4581,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - /* set up name for target link: ":tmp/extlinks15" */ + /* set up name for target link: ":tmp_links/extlinks15" */ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -4610,7 +4610,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4634,7 +4634,7 @@ error: * Function: external_link_win7 * * Purpose: - * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10" + * 1. UNC target link: "\\127.0.01\c$/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" * Should be able to find the target file via main file's local host/main drive/rel path @@ -4665,7 +4665,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */ + /* set up name for target link: "\\127.0.0.1\c$/tmp_links/extlinks10" */ HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -4752,7 +4752,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* create tmp directory */ + /* create tmp_links directory */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target link: ":\CWD\extlinks10" */ @@ -4785,7 +4785,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { H5_FAILED(); - HDputs(" Should have found the file in tmp."); + HDputs(" Should have found the file in tmp_links."); goto error; } @@ -4809,7 +4809,7 @@ error: * Function: external_link_win9 * * Purpose: - * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10" + * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp_links/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" * Should be able to find the target file via main file's local host/main drive/rel path @@ -4839,7 +4839,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR - /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ + /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp_links/extlinks10" */ HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ HDstrcat(tmpname, "/"); HDstrcat(tmpname, FILENAME[30]); @@ -6087,7 +6087,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks21A" */ h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1)); - /* create tmp directory and get current working directory path */ + /* create tmp_links directory and get current working directory path */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST) @@ -6097,29 +6097,29 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Set up names for files in the subdirectories */ - /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */ + /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */ h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a)); fix_ext_filename(tmpname, cwdpath, FILENAME[46]); h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b)); /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */ - /* (i.e. tmp/sym1.h5 -> /tmp2/extlinks21B.h5) */ + /* (i.e. tmp_links/sym1.h5 -> /tmp2_links/extlinks21B.h5) */ if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */ + /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */ h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a)); h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b)); - /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */ + /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */ h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a)); fix_ext_filename(tmpname, cwdpath, FILENAME[49]); h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b)); /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */ - /* (i.e. tmp2/sym2.h5 -> /tmp/extlinks21D.h5) */ + /* (i.e. tmp2_links/sym2.h5 -> /tmp_links/extlinks21D.h5) */ if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR - /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */ + /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */ h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); @@ -6132,11 +6132,11 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ + /* Create file #2 in tmp_links directory #2 */ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(file2) < 0) TEST_ERROR - /* Re-open file #2 in tmp directory through symlink */ + /* Re-open file #2 in tmp_links directory through symlink */ if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create group in file #2 in temporary directory */ @@ -9154,7 +9154,7 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, if(flags & H5Z_FLAG_REVERSE) { if(link_filter_state != LFS_ENCODED) return 0; link_filter_state = LFS_DECODED; - } + } else { if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0; link_filter_state = LFS_ENCODED; @@ -13937,7 +13937,7 @@ main(void) HDprintf("\n-Testing with minimzed dataset object headers-\n"); dcpl_g = H5Pcreate(H5P_DATASET_CREATE); if (0 > dcpl_g) TEST_ERROR - } + } else { HDprintf("\n-Testing with unminimzed dataset object headers-\n"); dcpl_g = H5P_DEFAULT; @@ -13950,7 +13950,7 @@ main(void) if(new_format) { my_fapl = fapl2; HDprintf("\n--Testing with 'new format'--\n"); - } + } else { my_fapl = fapl; HDprintf("\n--Testing with 'old format'--\n"); @@ -13977,7 +13977,7 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on the fapl + /* Test external file cache first, so it sees the default efc setting on the fapl */ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; @@ -13987,7 +13987,7 @@ main(void) nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent + * reopen a cached file with a different intent */ nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; @@ -14133,7 +14133,7 @@ main(void) HDremove(SYMLINK1); HDremove(SYMLINK2); - /* clean up tmp directory created by external link tests */ + /* clean up tmp_links and tmp2_links directory created by external link tests */ HDrmdir(TMPDIR); HDrmdir(TMPDIR2); diff --git a/test/links_env.c b/test/links_env.c index cc31d92..dff185c 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -12,39 +12,39 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: Tests hard, soft (symbolic) & external links. + * Purpose: Tests hard, soft (symbolic) & external links. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "h5test.h" -#include "H5Gpkg.h" /* Groups */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #define TMPDIR "tmp_links_env/" #define NAME_BUF_SIZE 1024 const char *FILENAME[] = { - "extlinks_env0", /* 0: main file */ - "extlinks_env1", /* 1: target file */ + "extlinks_env0", /* 0: main file */ + "extlinks_env1", /* 1: target file */ TMPDIR "extlinks_env1", /* 2 */ NULL }; static int external_link_env(hid_t fapl, hbool_t new_format); - + /*------------------------------------------------------------------------- * Function: external_link_env (moved from links.c) * - * Purpose: Verify that the target file is found successfully in "tmp" directory - * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX. - * 1. Target link: "extlinks_env1" - * 2. Main file: "extlinks_env0" - * 3. Target file is created in: "tmp/extlinks_env1" - * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp" + * Purpose: Verify that the target file is found successfully in "tmp_links_env" directory + * via searching the pathnames set in the environment variable HDF5_EXT_PREFIX. + * 1. Target link: "extlinks_env1" + * 2. Main file: "extlinks_env0" + * 3. Target file is created in: "tmp_links_env/extlinks_env1" + * 4. The environment variable "HDF5_EXT_PREFIX" is set to ".:tmp_links_env" * * Return: Success: 0 * Failure: -1 @@ -59,12 +59,12 @@ static int external_link_env(hid_t fapl, hbool_t new_format); static int external_link_env(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - const char *envval = NULL; /* Pointer to environment variable */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; /* Holders for filename */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ + const char *envval = NULL; /* Pointer to environment variable */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; /* Holders for filename */ if(new_format) TESTING("external links via environment variable (w/new group format)") @@ -73,7 +73,7 @@ external_link_env(hid_t fapl, hbool_t new_format) if ((envval = HDgetenv("HDF5_EXT_PREFIX")) == NULL) envval = "nomatch"; - if (HDstrcmp(envval, ".:tmp")) TEST_ERROR + if (HDstrcmp(envval, ".:tmp_links_env")) TEST_ERROR /* Set up name for main file:"extlinks_env0" */ h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); @@ -81,14 +81,14 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Set up name for external linked target file: "extlinks_env1" */ h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - /* Create "tmp" directory */ + /* Create "tmp_links_env" directory */ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + TEST_ERROR - /* Set up name (location) for the target file: "tmp/extlinks1" */ + /* Set up name (location) for the target file: "tmp_links_env/extlinks1" */ h5_fixname(FILENAME[2], fapl, filename3, sizeof filename3); - /* Create the target file in "tmp" directory */ + /* Create the target file in "tmp_links_env" directory */ if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -110,9 +110,9 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ if (gid < 0) { - H5_FAILED(); - puts(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + puts(" Should have found the file in tmp_links_env directory."); + goto error; } /* closing for main file */ @@ -124,30 +124,30 @@ external_link_env(hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; return -1; } /* end external_link_env() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test external link with environment variable HDF5_EXT_PREFIX + * Purpose: Test external link with environment variable HDF5_EXT_PREFIX * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) * - * Programmer: Vailin Choi; Nov 2010 + * Programmer: Vailin Choi; Nov 2010 * *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl; /* File access property lists */ - int nerrors = 0; /* Error from tests */ + hid_t fapl; /* File access property lists */ + int nerrors = 0; /* Error from tests */ h5_reset(); fapl = h5_fileaccess(); @@ -172,7 +172,7 @@ main(void) } HDprintf("All external Link (HDF5_EXT_PREFIX) tests passed.\n"); - /* clean up tmp directory created by external link tests */ + /* clean up tmp_links_env directory created by external link tests */ HDrmdir(TMPDIR); return 0; diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in index 94e6c7e..7f2302d 100644 --- a/test/testlinks_env.sh.in +++ b/test/testlinks_env.sh.in @@ -19,15 +19,15 @@ nerrors=0 ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## # test for external links with HDF5_EXT_PREFIX echo "Testing external link with HDF5_EXT_PREFIX" -TEST_NAME=links_env # The test name -TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_EXT_PREFIX=.:tmp" # The environment variable & value +TEST_NAME=links_env # The test name +TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary +ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links" # The environment variable & value # # Run the test echo "$ENVCMD $RUNSERIAL $TEST_BIN" @@ -36,7 +36,7 @@ exitcode=$? if [ $exitcode -eq 0 ]; then echo "Test for HDF5_EXT_PREFIX PASSED" else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_EXT_PREFIX test***" + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_EXT_PREFIX test***" fi exit $nerrors diff --git a/test/testvds_env.sh.in b/test/testvds_env.sh.in index 894e52e..e9a27da 100644 --- a/test/testvds_env.sh.in +++ b/test/testvds_env.sh.in @@ -19,7 +19,7 @@ nerrors=0 ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## @@ -27,7 +27,7 @@ nerrors=0 echo "Testing basic virtual dataset I/O via H5Pset_vds_prefix(): all selection with ENV prefix" TEST_NAME=vds_env # The test name TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp" # Set the environment variable & value +ENVCMD="env HDF5_VDS_PREFIX=\${ORIGIN}/tmp_vds_env" # Set the environment variable & value UNENVCMD="unset HDF5_VDS_PREFIX" # Unset the environment variable & value # # Run the test @@ -37,8 +37,8 @@ exitcode=$? if [ $exitcode -eq 0 ]; then echo "Test prefix for HDF5_VDS_PREFIX PASSED" else - nerrors="`expr $nerrors + 1`" - echo "***Error encountered for HDF5_VDS_PREFIX test***" + nerrors="`expr $nerrors + 1`" + echo "***Error encountered for HDF5_VDS_PREFIX test***" fi $UNENVCMD exit $nerrors diff --git a/testpar/t_chunk_alloc.c b/testpar/t_chunk_alloc.c index 2340ae0..bfa0bfe 100644 --- a/testpar/t_chunk_alloc.c +++ b/testpar/t_chunk_alloc.c @@ -20,23 +20,23 @@ */ #include "testphdf5.h" -static int mpi_size, mpi_rank; +static int mpi_size, mpi_rank; #define DSET_NAME "ExtendibleArray" -#define CHUNK_SIZE 1000 /* #elements per chunk */ -#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */ +#define CHUNK_SIZE 1000 /* #elements per chunk */ +#define CHUNK_FACTOR 200 /* default dataset size in terms of chunks */ #define CLOSE 1 #define NO_CLOSE 0 static MPI_Offset get_filesize(const char *filename) { - int mpierr; - MPI_File fd; - MPI_Offset filesize; + int mpierr; + MPI_File fd; + MPI_Offset filesize; mpierr = MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_RDONLY, - MPI_INFO_NULL, &fd); + MPI_INFO_NULL, &fd); VRFY((mpierr == MPI_SUCCESS), ""); mpierr = MPI_File_get_size(fd, &filesize); @@ -85,8 +85,8 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ long nchunks; herr_t hrc; - MPI_Offset filesize, /* actual file size */ - est_filesize; /* estimated file size */ + MPI_Offset filesize, /* actual file size */ + est_filesize; /* estimated file size */ /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -95,34 +95,33 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ /* Only MAINPROCESS should create the file. Others just wait. */ if (MAINPROCESS){ nchunks=chunk_factor*mpi_size; - dims[0]=nchunks*CHUNK_SIZE; - /* Create the data space with unlimited dimensions. */ - dataspace = H5Screate_simple (1, dims, maxdims); - VRFY((dataspace >= 0), ""); + dims[0]=nchunks*CHUNK_SIZE; + /* Create the data space with unlimited dimensions. */ + dataspace = H5Screate_simple (1, dims, maxdims); + VRFY((dataspace >= 0), ""); - memspace = H5Screate_simple(1, chunk_dims, NULL); - VRFY((memspace >= 0), ""); + memspace = H5Screate_simple(1, chunk_dims, NULL); + VRFY((memspace >= 0), ""); - /* Create a new file. If file exists its contents will be overwritten. */ - file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, - H5P_DEFAULT); - VRFY((file_id >= 0), "H5Fcreate"); + /* Create a new file. If file exists its contents will be overwritten. */ + file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + VRFY((file_id >= 0), "H5Fcreate"); - /* Modify dataset creation properties, i.e. enable chunking */ - cparms = H5Pcreate(H5P_DATASET_CREATE); - VRFY((cparms >= 0), ""); + /* Modify dataset creation properties, i.e. enable chunking */ + cparms = H5Pcreate(H5P_DATASET_CREATE); + VRFY((cparms >= 0), ""); - hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY); - VRFY((hrc >= 0), ""); + hrc = H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY); + VRFY((hrc >= 0), ""); - hrc = H5Pset_chunk(cparms, 1, chunk_dims); - VRFY((hrc >= 0), ""); + hrc = H5Pset_chunk(cparms, 1, chunk_dims); + VRFY((hrc >= 0), ""); - /* Create a new dataset within the file using cparms creation properties. */ - dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT); - VRFY((dataset >= 0), ""); + /* Create a new dataset within the file using cparms creation properties. */ + dataset = H5Dcreate2(file_id, DSET_NAME, H5T_NATIVE_UCHAR, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + VRFY((dataset >= 0), ""); - if(write_pattern == sec_last) { + if(write_pattern == sec_last) { HDmemset(buffer, 100, CHUNK_SIZE); count[0] = 1; @@ -138,28 +137,28 @@ create_chunked_dataset(const char *filename, int chunk_factor, write_type write_ VRFY((hrc >= 0), "H5Dwrite"); } /* end if */ - /* Close resources */ - hrc = H5Dclose (dataset); - VRFY((hrc >= 0), ""); - dataset = -1; + /* Close resources */ + hrc = H5Dclose (dataset); + VRFY((hrc >= 0), ""); + dataset = -1; - hrc = H5Sclose (dataspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (dataspace); + VRFY((hrc >= 0), ""); - hrc = H5Sclose (memspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (memspace); + VRFY((hrc >= 0), ""); - hrc = H5Pclose (cparms); - VRFY((hrc >= 0), ""); + hrc = H5Pclose (cparms); + VRFY((hrc >= 0), ""); - hrc = H5Fclose (file_id); - VRFY((hrc >= 0), ""); - file_id = -1; + hrc = H5Fclose (file_id); + VRFY((hrc >= 0), ""); + file_id = -1; - /* verify file size */ - filesize = get_filesize(filename); - est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char); - VRFY((filesize >= est_filesize), "file size check"); + /* verify file size */ + filesize = get_filesize(filename); + est_filesize = nchunks * CHUNK_SIZE * sizeof(unsigned char); + VRFY((filesize >= est_filesize), "file size check"); } @@ -200,8 +199,8 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti int i; long nchunks; /* MPI Gubbins */ - MPI_Offset filesize, /* actual file size */ - est_filesize; /* estimated file size */ + MPI_Offset filesize, /* actual file size */ + est_filesize; /* estimated file size */ /* Initialize MPI */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -241,19 +240,19 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti /* all chunks are written by all the processes in an interleaved way*/ case write_all: - memset(buffer, mpi_rank+1, CHUNK_SIZE); - count[0] = 1; - stride[0] = 1; - block[0] = chunk_dims[0]; - for (i=0; i= 0), ""); + hrc = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, stride, count, block); + VRFY((hrc >= 0), ""); - /* Write the buffer out */ - hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer); - VRFY((hrc >= 0), "H5Dwrite"); + /* Write the buffer out */ + hrc = H5Dwrite(*dataset, H5T_NATIVE_UCHAR, memspace, dataspace, H5P_DEFAULT, buffer); + VRFY((hrc >= 0), "H5Dwrite"); } break; @@ -318,7 +317,7 @@ parallel_access_dataset(const char *filename, int chunk_factor, access_type acti * interleaved pattern. */ static void -verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose, +verify_data(const char *filename, int chunk_factor, write_type write_pattern, int vclose, hid_t *file_id, hid_t *dataset) { /* HDF5 gubbins */ @@ -372,8 +371,8 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in stride[0] = 1; block[0] = chunk_dims[0]; for (i=0; i= 0), "H5Dread"); /* set expected value according the write pattern */ - switch (write_pattern) { - case all: - value = i%mpi_size + 1; - break; - case none: - value = 0; - break; - case sec_last: - if (i==nchunks-2) - value = 100; - else - value = 0; + switch (write_pattern) { + case all: + value = i%mpi_size + 1; + break; + case none: + value = 0; + break; + case sec_last: + if (i==nchunks-2) + value = 100; + else + value = 0; break; default: HDassert(0); - } + } /* verify content of the chunk */ for (index_l = 0; index_l < CHUNK_SIZE; index_l++) @@ -408,10 +407,10 @@ verify_data(const char *filename, int chunk_factor, write_type write_pattern, in } hrc = H5Sclose (dataspace); - VRFY((hrc >= 0), ""); + VRFY((hrc >= 0), ""); - hrc = H5Sclose (memspace); - VRFY((hrc >= 0), ""); + hrc = H5Sclose (memspace); + VRFY((hrc >= 0), ""); /* Can close some plists */ hrc = H5Pclose(access_plist); @@ -469,7 +468,7 @@ test_chunk_alloc(void) filename = (const char*)GetTestParameters(); if (VERBOSE_MED) - printf("Extend Chunked allocation test on file %s\n", filename); + HDprintf("Extend Chunked allocation test on file %s\n", filename); /* Case 1 */ /* Create chunked dataset without writing anything.*/ diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index e1ccbed..b89c790 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -29,7 +29,7 @@ int chunkdim1; int nerrors = 0; /* errors count */ int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root - * group. */ + * group. */ int facc_type = FACC_MPIO; /*Test file access type */ int dxfer_coll_type = DXFER_COLLECTIVE_IO; @@ -79,15 +79,15 @@ void pause_proc(void) MPI_Get_processor_name(mpi_name, &mpi_namelen); if (MAINPROCESS) - while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ - if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", - mpi_rank, mpi_namelen, mpi_name, pid, pid); - } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); - fflush(stdout); + while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ + if (!loops++){ + HDprintf("Proc %d (%*s, %d): to debug, attach %d\n", + mpi_rank, mpi_namelen, mpi_name, pid, pid); + } + HDprintf("waiting(%ds) for file %s ...\n", time_int, greenlight); + HDfflush(stdout); HDsleep(time_int); - } + } MPI_Barrier(MPI_COMM_WORLD); } @@ -108,18 +108,18 @@ int MPI_Init(int *argc, char ***argv) static void usage(void) { - printf(" [-r] [-w] [-m] [-n] " - "[-o] [-f ] [-d ]\n"); - printf("\t-m" - "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" - "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", - ROW_FACTOR, COL_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + HDprintf(" [-r] [-w] [-m] [-n] " + "[-o] [-f ] [-d ]\n"); + HDprintf("\t-m" + "\tset number of datasets for the multiple dataset test\n"); + HDprintf("\t-n" + "\tset number of groups for the multiple group test\n"); + HDprintf("\t-f \tfilename prefix\n"); + HDprintf("\t-2\t\tuse Split-file together with MPIO\n"); + HDprintf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", + ROW_FACTOR, COL_FACTOR); + HDprintf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + HDprintf("\n"); } @@ -140,44 +140,44 @@ parse_options(int argc, char **argv) chunkdim1 = (dim1+9)/10; while (--argc){ - if (**(++argv) != '-'){ - break; - }else{ - switch(*(*argv+1)){ - case 'm': ndatasets = atoi((*argv+1)+1); - if (ndatasets < 0){ + if (**(++argv) != '-'){ + break; + }else{ + switch(*(*argv+1)){ + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ nerrors++; return(1); - } - break; + } + break; case 'n': ngroups = atoi((*argv+1)+1); - if (ngroups < 0){ - nerrors++; - return(1); - } - break; - case 'f': if (--argc < 1) { + if (ngroups < 0){ nerrors++; return(1); - } - if (**(++argv) == '-') { + } + break; + case 'f': if (--argc < 1) { nerrors++; return(1); - } - paraprefix = *argv; - break; - case 'i': /* Collective MPI-IO access with independent IO */ + } + if (**(++argv) == '-') { + nerrors++; + return(1); + } + paraprefix = *argv; + break; + case 'i': /* Collective MPI-IO access with independent IO */ dxfer_coll_type = DXFER_INDEPENDENT_IO; break; - case '2': /* Use the split-file driver with MPIO access */ + case '2': /* Use the split-file driver with MPIO access */ /* Can use $HDF5_METAPREFIX to define the */ /* meta-file-prefix. */ facc_type = FACC_MPIO | FACC_SPLIT; break; - case 'd': /* dimensizes */ + case 'd': /* dimensizes */ if (--argc < 2){ - nerrors++; - return(1); + nerrors++; + return(1); } dim0 = atoi(*(++argv))*mpi_size; argc--; @@ -186,61 +186,61 @@ parse_options(int argc, char **argv) chunkdim0 = (dim0+9)/10; chunkdim1 = (dim1+9)/10; break; - case 'c': /* chunk dimensions */ + case 'c': /* chunk dimensions */ if (--argc < 2){ - nerrors++; - return(1); + nerrors++; + return(1); } chunkdim0 = atoi(*(++argv)); argc--; chunkdim1 = atoi(*(++argv)); break; - case 'h': /* print help message--return with nerrors set */ - return(1); - default: printf("Illegal option(%s)\n", *argv); - nerrors++; + case 'h': /* print help message--return with nerrors set */ return(1); + default: HDprintf("Illegal option(%s)\n", *argv); + nerrors++; + return(1); + } } - } } /*while*/ /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); - nerrors++; - return(1); + HDprintf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + nerrors++; + return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); - nerrors++; - return(1); + HDprintf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + nerrors++; + return(1); } /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ - if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", - dim0, dim1, mpi_size); - nerrors++; - return(1); + if (MAINPROCESS) + HDprintf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + dim0, dim1, mpi_size); + nerrors++; + return(1); } /* compose the test filenames */ { - int i, n; + int i, n; - n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ + n = sizeof(FILENAME)/sizeof(FILENAME[0]) - 1; /* exclude the NULL */ - for (i=0; i < n; i++) - if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) - == NULL){ - printf("h5_fixname failed\n"); - nerrors++; - return(1); - } - printf("Test filenames are:\n"); - for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + for (i=0; i < n; i++) + if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) + == NULL){ + HDprintf("h5_fixname failed\n"); + nerrors++; + return(1); + } + HDprintf("Test filenames are:\n"); + for (i=0; i < n; i++) + HDprintf(" %s\n", filenames[i]); } return(0); @@ -264,36 +264,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); - VRFY((ret >= 0), ""); + VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); - VRFY((ret >= 0), ""); - return(ret_pl); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } /* unknown file access types */ @@ -323,18 +323,18 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("PHDF5 TESTS START\n"); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("PHDF5 TESTS START\n"); + HDprintf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors - * happen during the test and the process is aborted, it will not get - * hang in the atexit post processing in which it may try to make MPI - * calls. By then, MPI calls may not work. - */ + * happen during the test and the process is aborted, it will not get + * hang in the atexit post processing in which it may try to make MPI + * calls. By then, MPI calls may not work. + */ if (H5dont_atexit() < 0){ - printf("Failed to turn off atexit processing. Continue.\n"); + HDprintf("Failed to turn off atexit processing. Continue.\n"); }; H5open(); h5_show_hostname(); @@ -344,10 +344,10 @@ int main(int argc, char **argv) /* Tests are generally arranged from least to most complexity... */ AddTest("mpiodup", test_fapl_mpio_dup, NULL, - "fapl_mpio duplicate", NULL); + "fapl_mpio duplicate", NULL); AddTest("split", test_split_comm_access, NULL, - "dataset using split communicators", PARATESTFILE); + "dataset using split communicators", PARATESTFILE); #ifdef PB_OUT /* temporary: disable page buffering when parallel */ AddTest("page_buffer", test_page_buffer_access, NULL, @@ -355,57 +355,57 @@ int main(int argc, char **argv) #endif AddTest("props", test_file_properties, NULL, - "Coll Metadata file property settings", PARATESTFILE); + "Coll Metadata file property settings", PARATESTFILE); AddTest("idsetw", dataset_writeInd, NULL, - "dataset independent write", PARATESTFILE); + "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, - "dataset independent read", PARATESTFILE); + "dataset independent read", PARATESTFILE); AddTest("cdsetw", dataset_writeAll, NULL, - "dataset collective write", PARATESTFILE); + "dataset collective write", PARATESTFILE); AddTest("cdsetr", dataset_readAll, NULL, - "dataset collective read", PARATESTFILE); + "dataset collective read", PARATESTFILE); AddTest("eidsetw", extend_writeInd, NULL, - "extendible dataset independent write", PARATESTFILE); + "extendible dataset independent write", PARATESTFILE); AddTest("eidsetr", extend_readInd, NULL, - "extendible dataset independent read", PARATESTFILE); + "extendible dataset independent read", PARATESTFILE); AddTest("ecdsetw", extend_writeAll, NULL, - "extendible dataset collective write", PARATESTFILE); + "extendible dataset collective write", PARATESTFILE); AddTest("ecdsetr", extend_readAll, NULL, - "extendible dataset collective read", PARATESTFILE); + "extendible dataset collective read", PARATESTFILE); AddTest("eidsetw2", extend_writeInd2, NULL, - "extendible dataset independent write #2", PARATESTFILE); + "extendible dataset independent write #2", PARATESTFILE); AddTest("selnone", none_selection_chunk, NULL, "chunked dataset with none-selection", PARATESTFILE); AddTest("calloc", test_chunk_alloc, NULL, "parallel extend Chunked allocation on serial file", PARATESTFILE); AddTest("fltread", test_filter_read, NULL, - "parallel read of dataset written serially with filters", PARATESTFILE); + "parallel read of dataset written serially with filters", PARATESTFILE); #ifdef H5_HAVE_FILTER_DEFLATE AddTest("cmpdsetr", compress_readAll, NULL, - "compressed dataset collective read", PARATESTFILE); + "compressed dataset collective read", PARATESTFILE); #endif /* H5_HAVE_FILTER_DEFLATE */ AddTest("zerodsetr", zero_dim_dset, NULL, - "zero dim dset", PARATESTFILE); + "zero dim dset", PARATESTFILE); ndsets_params.name = PARATESTFILE; ndsets_params.count = ndatasets; AddTest("ndsetw", multiple_dset_write, NULL, - "multiple datasets write", &ndsets_params); + "multiple datasets write", &ndsets_params); ngroups_params.name = PARATESTFILE; ngroups_params.count = ngroups; AddTest("ngrpw", multiple_group_write, NULL, - "multiple groups write", &ngroups_params); + "multiple groups write", &ngroups_params); AddTest("ngrpr", multiple_group_read, NULL, - "multiple groups read", &ngroups_params); + "multiple groups read", &ngroups_params); AddTest("compact", compact_dataset, NULL, - "compact dataset test", PARATESTFILE); + "compact dataset test", PARATESTFILE); collngroups_params.name = PARATESTFILE; collngroups_params.count = ngroups; @@ -417,79 +417,79 @@ int main(int argc, char **argv) AddTest("bigdset", big_dataset, NULL, "big dataset test", PARATESTFILE); #else - printf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); + HDprintf("big dataset test will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif AddTest("fill", dataset_fillvalue, NULL, - "dataset fill value", PARATESTFILE); + "dataset fill value", PARATESTFILE); AddTest("cchunk1", - coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); + coll_chunk1,NULL, "simple collective chunk io",PARATESTFILE); AddTest("cchunk2", - coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); + coll_chunk2,NULL, "noncontiguous collective chunk io",PARATESTFILE); AddTest("cchunk3", - coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); + coll_chunk3,NULL, "multi-chunk collective chunk io",PARATESTFILE); AddTest("cchunk4", - coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); + coll_chunk4,NULL, "collective chunk io with partial non-selection ",PARATESTFILE); if((mpi_size < 3)&& MAINPROCESS ) { - printf("Collective chunk IO optimization APIs "); - printf("needs at least 3 processes to participate\n"); - printf("Collective chunk IO API tests will be skipped \n"); + HDprintf("Collective chunk IO optimization APIs "); + HDprintf("needs at least 3 processes to participate\n"); + HDprintf("Collective chunk IO API tests will be skipped \n"); } AddTest((mpi_size <3)? "-cchunk5":"cchunk5" , - coll_chunk5,NULL, - "linked chunk collective IO without optimization",PARATESTFILE); + coll_chunk5,NULL, + "linked chunk collective IO without optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk6" : "cchunk6", - coll_chunk6,NULL, - "multi-chunk collective IO with direct request",PARATESTFILE); + coll_chunk6,NULL, + "multi-chunk collective IO with direct request",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk7" : "cchunk7", - coll_chunk7,NULL, - "linked chunk collective IO with optimization",PARATESTFILE); + coll_chunk7,NULL, + "linked chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk8" : "cchunk8", - coll_chunk8,NULL, - "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); + coll_chunk8,NULL, + "linked chunk collective IO transferring to multi-chunk",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk9" : "cchunk9", - coll_chunk9,NULL, - "multiple chunk collective IO with optimization",PARATESTFILE); + coll_chunk9,NULL, + "multiple chunk collective IO with optimization",PARATESTFILE); AddTest((mpi_size < 3)? "-cchunk10" : "cchunk10", - coll_chunk10,NULL, - "multiple chunk collective IO transferring to independent IO",PARATESTFILE); + coll_chunk10,NULL, + "multiple chunk collective IO transferring to independent IO",PARATESTFILE); -/* irregular collective IO tests*/ + /* irregular collective IO tests*/ AddTest("ccontw", - coll_irregular_cont_write,NULL, - "collective irregular contiguous write",PARATESTFILE); + coll_irregular_cont_write,NULL, + "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr", - coll_irregular_cont_read,NULL, - "collective irregular contiguous read",PARATESTFILE); + coll_irregular_cont_read,NULL, + "collective irregular contiguous read",PARATESTFILE); AddTest("cschunkw", - coll_irregular_simple_chunk_write,NULL, - "collective irregular simple chunk write",PARATESTFILE); + coll_irregular_simple_chunk_write,NULL, + "collective irregular simple chunk write",PARATESTFILE); AddTest("cschunkr", - coll_irregular_simple_chunk_read,NULL, - "collective irregular simple chunk read",PARATESTFILE); + coll_irregular_simple_chunk_read,NULL, + "collective irregular simple chunk read",PARATESTFILE); AddTest("ccchunkw", - coll_irregular_complex_chunk_write,NULL, - "collective irregular complex chunk write",PARATESTFILE); + coll_irregular_complex_chunk_write,NULL, + "collective irregular complex chunk write",PARATESTFILE); AddTest("ccchunkr", - coll_irregular_complex_chunk_read,NULL, - "collective irregular complex chunk read",PARATESTFILE); + coll_irregular_complex_chunk_read,NULL, + "collective irregular complex chunk read",PARATESTFILE); AddTest("null", null_dataset, NULL, - "null dataset test", PARATESTFILE); + "null dataset test", PARATESTFILE); io_mode_confusion_params.name = PARATESTFILE; io_mode_confusion_params.count = 0; /* value not used */ AddTest("I/Omodeconf", io_mode_confusion, NULL, - "I/O mode confusion test -- hangs quickly on failure", + "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); if((mpi_size < 3) && MAINPROCESS) { - printf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n"); - printf("rr_obj_hdr_flush_confusion test will be skipped \n"); + HDprintf("rr_obj_hdr_flush_confusion test needs at least 3 processes.\n"); + HDprintf("rr_obj_hdr_flush_confusion test will be skipped \n"); } if(mpi_size > 2) { rr_obj_flush_confusion_params.name = PARATESTFILE; @@ -523,21 +523,21 @@ int main(int argc, char **argv) PARATESTFILE); AddTest("edpl", test_plist_ed, NULL, - "encode/decode Property Lists", NULL); + "encode/decode Property Lists", NULL); if((mpi_size < 2) && MAINPROCESS) { - printf("File Image Ops daisy chain test needs at least 2 processes.\n"); - printf("File Image Ops daisy chain test will be skipped \n"); + HDprintf("File Image Ops daisy chain test needs at least 2 processes.\n"); + HDprintf("File Image Ops daisy chain test will be skipped \n"); } AddTest((mpi_size < 2)? "-fiodc" : "fiodc", file_image_daisy_chain_test, NULL, "file image ops daisy chain", NULL); if((mpi_size < 2)&& MAINPROCESS ) { - printf("Atomicity tests need at least 2 processes to participate\n"); - printf("8 is more recommended.. Atomicity tests will be skipped \n"); + HDprintf("Atomicity tests need at least 2 processes to participate\n"); + HDprintf("8 is more recommended.. Atomicity tests will be skipped \n"); } else if (facc_type != FACC_MPIO && MAINPROCESS) { - printf("Atomicity tests will not work with a non MPIO VFD\n"); + HDprintf("Atomicity tests will not work with a non MPIO VFD\n"); } else if(mpi_size >= 2 && facc_type == FACC_MPIO){ AddTest("atomicity", dataset_atomicity, NULL, @@ -545,7 +545,7 @@ int main(int argc, char **argv) } AddTest("denseattr", test_dense_attr, NULL, - "Store Dense Attributes", PARATESTFILE); + "Store Dense Attributes", PARATESTFILE); AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL, "Collective Metadata read with some ranks having no selection", PARATESTFILE); @@ -565,9 +565,9 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" - " Using Independent I/O with file set view to replace collective I/O \n" - "===================================\n"); + HDprintf("===================================\n" + " Using Independent I/O with file set view to replace collective I/O \n" + "===================================\n"); } @@ -575,8 +575,8 @@ int main(int argc, char **argv) PerformTests(); /* make sure all processes are finished before final report, cleanup - * and exit. - */ + * and exit. + */ MPI_Barrier(MPI_COMM_WORLD); /* Display test summary, if requested */ @@ -592,16 +592,16 @@ int main(int argc, char **argv) { int temp; MPI_Allreduce(&nerrors, &temp, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); - nerrors=temp; + nerrors=temp; } if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); - if (nerrors) - printf("***PHDF5 tests detected %d errors***\n", nerrors); - else - printf("PHDF5 tests finished with no errors\n"); - printf("===================================\n"); + HDprintf("===================================\n"); + if (nerrors) + HDprintf("***PHDF5 tests detected %d errors***\n", nerrors); + else + HDprintf("PHDF5 tests finished with no errors\n"); + HDprintf("===================================\n"); } /* close HDF5 library */ -- cgit v0.12 From 8ef09e5ce9f191c2a7af301f1aec9254f4458a50 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Aug 2019 11:07:24 -0500 Subject: Correct name of folder --- test/testlinks_env.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testlinks_env.sh.in b/test/testlinks_env.sh.in index 7f2302d..3d6b3ce 100644 --- a/test/testlinks_env.sh.in +++ b/test/testlinks_env.sh.in @@ -27,7 +27,7 @@ nerrors=0 echo "Testing external link with HDF5_EXT_PREFIX" TEST_NAME=links_env # The test name TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary -ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links" # The environment variable & value +ENVCMD="env HDF5_EXT_PREFIX=.:tmp_links_env" # The environment variable & value # # Run the test echo "$ENVCMD $RUNSERIAL $TEST_BIN" -- cgit v0.12 From 64e6665b5442fc3f46cc7e2b00fe0a1b59f03b22 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 15 Aug 2019 16:46:00 -0500 Subject: Add HD prefix to tests --- hl/c++/test/ptableTest.cpp | 122 +- hl/c++/test/ptableTest.h | 2 +- hl/test/h5hltest.h | 4 +- hl/test/test_table.c | 110 +- test/btree2.c | 1208 +- test/cache.c | 14962 +++++++++++------------ test/cache_api.c | 80 +- test/cache_common.c | 1824 +-- test/cache_image.c | 3032 ++--- test/cache_tagging.c | 262 +- test/cmpd_dset.c | 968 +- test/cork.c | 206 +- test/cross_read.c | 12 +- test/direct_chunk.c | 26 +- test/dtransform.c | 408 +- test/dtypes.c | 1824 +-- test/earray.c | 516 +- test/enc_dec_plist.c | 44 +- test/enum.c | 26 +- test/err_compat.c | 34 +- test/extend.c | 18 +- test/external.c | 14 +- test/external_env.c | 42 +- test/fillval.c | 874 +- test/filter_fail.c | 26 +- test/h5test.c | 134 +- test/h5test.h | 20 +- test/hyperslab.c | 146 +- test/istore.c | 118 +- test/lheap.c | 8 +- test/mf.c | 2470 ++-- test/mtime.c | 56 +- test/ntypes.c | 84 +- test/objcopy.c | 14 +- test/reserved.c | 86 +- test/ros3.c | 2 +- test/s3comms.c | 34 +- test/stab.c | 236 +- test/swmr_addrem_writer.c | 28 +- test/swmr_common.c | 20 +- test/swmr_generator.c | 34 +- test/swmr_reader.c | 26 +- test/swmr_remove_reader.c | 22 +- test/swmr_remove_writer.c | 24 +- test/swmr_sparse_reader.c | 24 +- test/swmr_sparse_writer.c | 32 +- test/swmr_start_write.c | 40 +- test/swmr_writer.c | 28 +- test/tarray.c | 30 +- test/tattr.c | 272 +- test/tcheck_version.c | 82 +- test/testframe.c | 14 +- test/tfile.c | 30 +- test/tgenprop.c | 12 +- test/th5o.c | 32 +- test/th5s.c | 32 +- test/titerate.c | 6 +- test/tmisc.c | 34 +- test/tselect.c | 2394 ++-- test/tunicode.c | 8 +- test/unlink.c | 370 +- test/use_common.c | 500 +- test/use_disable_mdc_flushes.c | 374 +- tools/lib/h5diff.c | 10 +- tools/lib/h5tools_filters.c | 2 +- tools/lib/h5trav.c | 40 +- tools/libtest/h5tools_test_utils.c | 121 +- tools/src/h5copy/h5copy.c | 8 +- tools/src/h5diff/h5diff_common.c | 28 +- tools/src/h5diff/ph5diff_main.c | 26 +- tools/src/h5dump/h5dump_ddl.c | 4 +- tools/src/h5dump/h5dump_xml.c | 10 +- tools/src/h5repack/h5repack.c | 52 +- tools/src/h5repack/h5repack_copy.c | 38 +- tools/src/h5repack/h5repack_refs.c | 28 +- tools/src/h5stat/h5stat.c | 218 +- tools/src/misc/h5debug.c | 496 +- tools/src/misc/h5mkgrp.c | 6 +- tools/src/misc/h5repart.c | 601 +- tools/test/h5copy/h5copygentest.c | 110 +- tools/test/h5diff/h5diffgentest.c | 446 +- tools/test/h5dump/h5dumpgentest.c | 46 +- tools/test/h5import/h5importtest.c | 168 +- tools/test/h5jam/h5jamgentest.c | 6 +- tools/test/h5repack/h5repacktst.c | 120 +- tools/test/h5repack/testh5repack_detect_szip.c | 4 +- tools/test/h5stat/h5stat_gentest.c | 14 +- tools/test/misc/h5clear_gentest.c | 138 +- tools/test/misc/talign.c | 26 +- 89 files changed, 18654 insertions(+), 18632 deletions(-) diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 340912e..f41dbb3 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -31,33 +31,33 @@ int main(void) fileID = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(fileID <0) { - fprintf(stderr, "Couldn't create file.\n"); + HDfprintf(stderr, "Couldn't create file.\n"); num_errors = 1; } else { - num_errors += BasicTest(); + num_errors += BasicTest(); - num_errors += TestCompoundDatatype(); + num_errors += TestCompoundDatatype(); - num_errors += TestGetPacket(); + num_errors += TestGetPacket(); - num_errors += TestGetNext(); + num_errors += TestGetNext(); - num_errors += TestCompress(); + num_errors += TestCompress(); - num_errors += TestErrors(); + num_errors += TestErrors(); - num_errors += SystemTest(); + num_errors += SystemTest(); - /* Test data corruption in packed structs */ - num_errors += TestHDFFV_9758(); + /* Test data corruption in packed structs */ + num_errors += TestHDFFV_9758(); /* Terminate access to the file. */ err = H5Fclose(fileID); if( err < 0 ) { - fprintf(stderr, "Failed to close file.\n"); + HDfprintf(stderr, "Failed to close file.\n"); num_errors++; } @@ -81,7 +81,7 @@ int BasicTest() hsize_t count; int error; - TESTING("basic functionality") + TESTING2("basic functionality") FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) @@ -137,7 +137,7 @@ int TestCompoundDatatype() hsize_t count; int error; - TESTING("compound datatypes") + TESTING2("compound datatypes") /* Create compound datatype */ typedef struct compoundType @@ -206,7 +206,7 @@ int TestGetNext() int records[2]; int i; - TESTING("GetNextPacket") + TESTING2("GetNextPacket") /* Create a dataset */ FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); @@ -268,20 +268,20 @@ int TestCompress() unsigned int config = 0; size_t cd_nelemts = 0; - TESTING("compression") + TESTING2("compression") #ifdef H5_HAVE_FILTER_DEFLATE try { - /* Prepare property list to set compression, randomly use deflate */ - DSetCreatPropList dscreatplist; - dscreatplist.setDeflate(6); + /* Prepare property list to set compression, randomly use deflate */ + DSetCreatPropList dscreatplist; + dscreatplist.setDeflate(6); /* Create packet table with compression. */ FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId()); - /* Close the property list */ - dscreatplist.close(); + /* Close the property list */ + dscreatplist.close(); - /* Verify that the deflate filter is set */ + /* Verify that the deflate filter is set */ /* Create an HDF5 C++ file object */ H5File file; @@ -293,10 +293,10 @@ int TestCompress() DSetCreatPropList dcpl = dset.getCreatePlist(); - char filter_name[8]; + char filter_name[8]; dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config); - if (HDstrncmp(filter_name, "deflate", 7) != 0) - H5_FAILED() + if (HDstrncmp(filter_name, "deflate", 7) != 0) + H5_FAILED() } catch (Exception e) { H5_FAILED(); return 1; @@ -304,7 +304,7 @@ int TestCompress() PASSED(); #else SKIPPED(); - puts(" deflate filter not enabled"); + HDputs(" deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ return 0; } @@ -315,7 +315,7 @@ int TestGetPacket() int record; int theRecs[3]; int i; - TESTING("GetPacket") + TESTING2("GetPacket") /* Create a dataset. Does not need to specify property list because there is no compression. */ @@ -353,7 +353,7 @@ const char* PT_TESTERROR = "/TestErrors"; int TestErrors() { - TESTING("error conditions") + TESTING2("error conditions") /* Create a dataset */ FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1); @@ -464,7 +464,7 @@ const char* PT_SYSTEMTST1 = "/SystemTest1"; const char* PT_SYSTEMTST2 = "/SystemTest2"; int SystemTest() { - TESTING("multiple datatypes") + TESTING2("multiple datatypes") hid_t dtypeID1, dtypeID2; hsize_t count; @@ -560,16 +560,16 @@ error: /*------------------------------------------------------------------------- * TestHDFFV_9758(): Test that a packet table with compound datatype which - * contains string type can be created and written correctly. (HDFFV-9758) + * contains string type can be created and written correctly. (HDFFV-9758) * * Notes: - * Previously, data of the field that follows the string was read back - * as garbage when #pragma pack(1) is used. + * Previously, data of the field that follows the string was read back + * as garbage when #pragma pack(1) is used. * 2016/10/20 -BMR * Updated: - * #pragma pack(1) caused failure on Emu because Sparc cannot - * access misaligned data. Changed it to pack() to do the - * default alignment. + * #pragma pack(1) caused failure on Emu because Sparc cannot + * access misaligned data. Changed it to pack() to do the + * default alignment. * 2016/10/25 -BMR *------------------------------------------------------------------------- */ @@ -592,57 +592,57 @@ int TestHDFFV_9758() }; s1_t s1[NUM_PACKETS]; - + for (hsize_t i = 0; i < NUM_PACKETS; i++) { s1[i].a = i; s1[i].b = 1.f * static_cast(i * i); s1[i].c = 1. / (i + 1); - sprintf(s1[i].d, "string%d", (int)i); + HDsprintf(s1[i].d, "string%d", (int)i); s1[i].e = 100+i; } - TESTING("data corruption in packed structs (HDFFV-9758)") + TESTING2("data corruption in packed structs (HDFFV-9758)") // Build a compound datatype compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); if (compound_type < 0) - goto error; - + goto error; + err = H5Tinsert(compound_type, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); if (err < 0) - goto error; + goto error; strtype = H5Tcopy (H5T_C_S1); if (compound_type < 0) - goto error; + goto error; err = H5Tset_size (strtype, STRING_LENGTH); /* create string */ if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "d_name", HOFFSET(s1_t, d), strtype); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "e_name", HOFFSET(s1_t, e), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; { // so ptable will go out of scope before PASSED // Create a packet table FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1); if (!ptable.IsValid()) - goto error; + goto error; // Add packets to the table for (size_t i = 0; i < NUM_PACKETS; i++) { - /* Appends one packet at the current position */ + /* Appends one packet at the current position */ err = ptable.AppendPacket(s1 + i); if (err < 0) goto error; } @@ -650,11 +650,11 @@ int TestHDFFV_9758() // Check packet count const hsize_t count = ptable.GetPacketCount(err); if (err < 0) - goto error; - + goto error; + if (count != NUM_PACKETS) { - std::cerr + std::cerr << "Number of packets in packet table should be " << NUM_PACKETS << " but is " << count << endl; } @@ -663,16 +663,16 @@ int TestHDFFV_9758() ptable.ResetIndex(); for (size_t i = 0; i < NUM_PACKETS; i++) { - s1_t s2; - memset(&s2, 0, sizeof(s1_t)); - err = ptable.GetNextPacket(&s2); - if (err < 0) - goto error; - - if (s2.a != s1[i].a || s2.e != s1[i].e) - goto error; - else if (HDstrcmp(s2.d, s1[i].d)) - goto error; + s1_t s2; + HDmemset(&s2, 0, sizeof(s1_t)); + err = ptable.GetNextPacket(&s2); + if (err < 0) + goto error; + + if (s2.a != s1[i].a || s2.e != s1[i].e) + goto error; + else if (HDstrcmp(s2.d, s1[i].d)) + goto error; } } // end of ptable block diff --git a/hl/c++/test/ptableTest.h b/hl/c++/test/ptableTest.h index 8af7bff..e1ba950 100644 --- a/hl/c++/test/ptableTest.h +++ b/hl/c++/test/ptableTest.h @@ -21,9 +21,9 @@ #ifndef PTABLETEST #define PTABLETEST +#include "h5hltest.h" #include "H5PacketTable.h" #include "H5Cpp.h" -#include "h5hltest.h" static hid_t fileID; diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index f368b8e..5dd3c20 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -28,8 +28,8 @@ #include "H5HLprivate2.h" /* Macros used in HL tests */ -#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} -#define TESTING3(WHAT) {printf("%-70s", "" WHAT); fflush(stdout);} +#define HL_TESTING2(WHAT) {HDprintf("%-70s", "Testing " WHAT); HDfflush(stdout);} +#define HL_TESTING3(WHAT) {HDprintf("%-70s", "" WHAT); HDfflush(stdout);} /* Implements verbose 'assert' with 'goto error' exit */ #define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0) diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 0215697..e849175 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -51,8 +51,6 @@ #define NRECORDS 8 #define NRECORDS_ADD 3 -#define TESTING2(WHAT) {printf("%-70s", "Testing " WHAT); fflush(stdout);} - /*------------------------------------------------------------------------- * structure used for all tests, a particle with properties *------------------------------------------------------------------------- @@ -117,7 +115,7 @@ typedef struct particle3_t *------------------------------------------------------------------------- */ -/* Push current alignment rule forcing 4-byte alignment boundary +/* Push current alignment rule forcing 4-byte alignment boundary * to the internal stack ... */ #pragma pack(push,4) @@ -129,7 +127,7 @@ typedef struct particle3_t float aty[3]; float rro[2]; } particle4_t; -/* +/* * ... and restore original alignment rules from stack */ #pragma pack(pop) @@ -164,14 +162,14 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || - !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) || - !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) || + !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) { HDfprintf(stderr,"read and write buffers have differences\n"); HDfprintf(stderr,"%s %ld %f %f %d\n", - rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); + rbuf[i].name,rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); HDfprintf(stderr,"%s %ld %f %f %d\n", - wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); + wbuf[j].name,wbuf[j].longi,(double)wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); return -1; } return 0; @@ -424,7 +422,7 @@ static int test_table(hid_t fid, int do_write) sizeof( rbuf[0].lati) }; - const char *field_names4[NFIELDS+1] = + const char *field_names4[NFIELDS+1] = { "F1", "F2", "F3", "F4", "F5", "F6"}; hid_t field_type4[NFIELDS+1]; particle4_t fill_data[1] = { {9999999, -9999999, 999999, {999,999,999},{999,999,999}, {999,999}} }; @@ -883,7 +881,7 @@ static int test_table(hid_t fid, int do_write) /*------------------------------------------------------------------------ * Functions tested: * - * H5TBdelete_record -- With differing memory layout from machine memory + * H5TBdelete_record -- With differing memory layout from machine memory * layout. HDFFV-8055 * *------------------------------------------------------------------------- @@ -892,45 +890,45 @@ static int test_table(hid_t fid, int do_write) { TESTING2("deleting records (differing memory layout)"); - dims = 3; - arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + dims = 3; + arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); - dims = 2; - arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); + dims = 2; + arry2_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); - /* Initialize the field field_type */ - field_type4[0] = H5T_NATIVE_UINT32; - field_type4[1] = H5T_NATIVE_DOUBLE; - field_type4[2] = H5T_NATIVE_DOUBLE; - field_type4[3] = arry3_32f; - field_type4[4] = arry3_32f; - field_type4[5] = arry2_32f; + /* Initialize the field field_type */ + field_type4[0] = H5T_NATIVE_UINT32; + field_type4[1] = H5T_NATIVE_DOUBLE; + field_type4[2] = H5T_NATIVE_DOUBLE; + field_type4[3] = arry3_32f; + field_type4[4] = arry3_32f; + field_type4[5] = arry2_32f; - /* Make the table */ - if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS, + /* Make the table */ + if (H5TBmake_table("Table Title",fid,"table",NFIELDS+1,(hsize_t)NRECORDS, tbl_size, field_names4, tbl_offset, field_type4, chunk_size, fill_data, compress, p_data)<0) - goto out; - /* Delete records */ - start = 3; - nrecords = 3; - if (H5TBdelete_record(fid, "table", start, nrecords)<0) - goto out;; - /* Get table info */ - if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0) - goto out; - /* check */ - if( (int)nfields_out != (int)NFIELDS+1) - goto out; - - if( (int)nrecords_out != (int)NRECORDS-3) - goto out; - - /* close type */ - H5Tclose(arry3_32f); - H5Tclose(arry2_32f); - - PASSED(); + goto out; + /* Delete records */ + start = 3; + nrecords = 3; + if (H5TBdelete_record(fid, "table", start, nrecords)<0) + goto out;; + /* Get table info */ + if (H5TBget_table_info(fid,"table", &nfields_out, &nrecords_out)<0) + goto out; + /* check */ + if( (int)nfields_out != (int)NFIELDS+1) + goto out; + + if( (int)nrecords_out != (int)NRECORDS-3) + goto out; + + /* close type */ + H5Tclose(arry3_32f); + H5Tclose(arry2_32f); + + PASSED(); } /*------------------------------------------------------------------------- @@ -1138,10 +1136,10 @@ static int test_table(hid_t fid, int do_write) { if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) { HDfprintf(stderr,"%ld %f %d\n", - rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati); + rbuf[i].longi,(double)rbuf[i].pressure,rbuf[i].lati); HDfprintf(stderr,"%ld %f %d\n", position_in[i].longi,(double)pressure_in[i],position_in[i].lati); goto out; @@ -1191,7 +1189,7 @@ static int test_table(hid_t fid, int do_write) if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out) >=0) goto out; - + /* read the "Pressure" field */ if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out)<0) @@ -1263,7 +1261,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < NRECORDS; i++ ) { if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { goto out; } } @@ -1292,7 +1290,7 @@ static int test_table(hid_t fid, int do_write) { hsize_t iistart = start; if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || - !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, namepre_in[iistart+i].pressure) ) { goto out; } } @@ -1351,7 +1349,7 @@ static int test_table(hid_t fid, int do_write) { if ( rbuf[i].lati != position_in[i-NRECORDS_ADD+1].lati || rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || - !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) + !H5_FLT_ABS_EQUAL(rbuf[i].pressure,pressure_in[i-NRECORDS_ADD+1]) ) goto out; } } @@ -1470,8 +1468,8 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < NRECORDS; i++ ) { if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || - !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { - goto out; + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure,namepre_in[i].pressure) ) { + goto out; } } @@ -1501,7 +1499,7 @@ static int test_table(hid_t fid, int do_write) { int iistart = (int) start; if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+(int)i].name ) != 0 ) || - !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) { + !H5_FLT_ABS_EQUAL(namepre_out[i].pressure, wbuf[iistart+(int)i].pressure) ) { goto out; } } @@ -1544,8 +1542,8 @@ static int test_table(hid_t fid, int do_write) if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || rbuf2[i].lati != wbuf[i].lati || rbuf2[i].longi != wbuf[i].longi || - !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) || - !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) || + !H5_FLT_ABS_EQUAL(rbuf2[i].pressure,wbuf[i].pressure) || + !H5_DBL_ABS_EQUAL(rbuf2[i].temperature,wbuf[i].temperature) || rbuf2[i].new_field != buf_new[i] ) { goto out; } @@ -1585,7 +1583,7 @@ static int test_table(hid_t fid, int do_write) if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || rbuf3[i].lati != wbuf[i].lati || rbuf3[i].longi != wbuf[i].longi || - !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) { + !H5_DBL_ABS_EQUAL(rbuf3[i].temperature,wbuf[i].temperature) ) { goto out; } } diff --git a/test/btree2.c b/test/btree2.c index 8d77438..c4c5530 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -20,7 +20,7 @@ * This file needs to access private datatypes from the H5B2 package. * This file also needs to access the v2 B-tree testing code. */ -#define H5B2_FRIEND /*suppress error about including H5B2pkg */ +#define H5B2_FRIEND /*suppress error about including H5B2pkg */ #define H5B2_TESTING #include "H5B2pkg.h" @@ -50,16 +50,16 @@ typedef struct bt2_test_param_t { hbool_t reopen_btree; /* Whether to re-open the B-tree during the test */ } bt2_test_param_t; - + /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize v2 B-tree creation parameter structure + * Purpose: Initialize v2 B-tree creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 29, 2009 * *------------------------------------------------------------------------- @@ -90,16 +90,16 @@ init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2) return(0); } /* init_cparam() */ - + /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Perform common "creation" operations on file + * Purpose: Perform common "creation" operations on file * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 5, 2009 * *------------------------------------------------------------------------- @@ -107,7 +107,7 @@ init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2) static int create_file(hid_t *file, H5F_t **f, hid_t fapl) { - char filename[1024]; /* Filename to use */ + char filename[1024]; /* Filename to use */ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -131,16 +131,16 @@ error: return(-1); } /* end create_file() */ - + /*------------------------------------------------------------------------- - * Function: create_btree + * Function: create_btree * - * Purpose: Perform common "create" operations on B-tree for testing + * Purpose: Perform common "create" operations on B-tree for testing * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 5, 2009 * *------------------------------------------------------------------------- @@ -164,16 +164,16 @@ error: return(-1); } /* end create_btree() */ - + /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Re-open the file + * Purpose: Re-open the file * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, December 28, 2015 * *------------------------------------------------------------------------- @@ -181,7 +181,7 @@ error: static int reopen_file(hid_t *file, H5F_t **f, hid_t fapl) { - char filename[1024]; /* Filename to use */ + char filename[1024]; /* Filename to use */ /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -205,16 +205,16 @@ error: return(-1); } /* end create_file() */ - + /*------------------------------------------------------------------------- - * Function: reopen_btree + * Function: reopen_btree * - * Purpose: Perform common "re-open" operations on B-tree for testing + * Purpose: Perform common "re-open" operations on B-tree for testing * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 5, 2009 * *------------------------------------------------------------------------- @@ -241,16 +241,16 @@ error: return(-1); } /* end reopen_btree() */ - + /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Check statistics about v1 B-tree + * Purpose: Check statistics about v1 B-tree * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 5, 2009 * *------------------------------------------------------------------------- @@ -275,16 +275,16 @@ error: return(-1); } /* end check_stats() */ - + /*------------------------------------------------------------------------- - * Function: check_node_depth + * Function: check_node_depth * - * Purpose: Check the depth of the node containing a record + * Purpose: Check the depth of the node containing a record * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 5, 2009 * *------------------------------------------------------------------------- @@ -306,16 +306,16 @@ error: return(-1); } /* end check_node_depth() */ - + /*------------------------------------------------------------------------- - * Function: check_node_info + * Function: check_node_info * - * Purpose: Check the info of the node containing a record + * Purpose: Check the info of the node containing a record * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, November 6, 2009 * *------------------------------------------------------------------------- @@ -340,16 +340,16 @@ error: return(-1); } /* end check_node_info() */ - + /*------------------------------------------------------------------------- - * Function: iter_cb + * Function: iter_cb * - * Purpose: v2 B-tree iterator callback + * Purpose: v2 B-tree iterator callback * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, February 16, 2005 * *------------------------------------------------------------------------- @@ -367,16 +367,16 @@ iter_cb(const void *_record, void *_op_data) return(H5_ITER_CONT); } /* end iter_cb() */ - + /*------------------------------------------------------------------------- - * Function: iter_rec_cb + * Function: iter_rec_cb * - * Purpose: v2 B-tree iterator callback for H5B2_test_rec_t records + * Purpose: v2 B-tree iterator callback for H5B2_test_rec_t records * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 25, 2015 * *------------------------------------------------------------------------- @@ -397,16 +397,16 @@ iter_rec_cb(const void *_record, void *_op_data) return(H5_ITER_CONT); } /* end iter_rec_cb() */ - + /*------------------------------------------------------------------------- - * Function: find_cb + * Function: find_cb * - * Purpose: v2 B-tree find callback + * Purpose: v2 B-tree find callback * - * Return: Success: TRUE/FALSE - * Failure: FAIL + * Return: Success: TRUE/FALSE + * Failure: FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 24, 2005 * *------------------------------------------------------------------------- @@ -423,16 +423,16 @@ find_cb(const void *_record, void *_op_data) return(TRUE); } /* end find_cb() */ - + /*------------------------------------------------------------------------- - * Function: find_rec_cb + * Function: find_rec_cb * - * Purpose: v2 B-tree find callback for H5B2_test_rec_t records + * Purpose: v2 B-tree find callback for H5B2_test_rec_t records * - * Return: Success: TRUE/FALSE - * Failure: FAIL + * Return: Success: TRUE/FALSE + * Failure: FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 25, 2015 * *------------------------------------------------------------------------- @@ -450,18 +450,18 @@ find_rec_cb(const void *_record, void *_op_data) return(TRUE); } /* end find_rec_cb() */ - + /*------------------------------------------------------------------------- - * Function: find_dec_cb + * Function: find_dec_cb * - * Purpose: v2 B-tree find callback for indexing in decreasing order + * Purpose: v2 B-tree find callback for indexing in decreasing order * - * Note: Currently hard-wired to "insert_lots" test + * Note: Currently hard-wired to "insert_lots" test * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 7, 2006 * *------------------------------------------------------------------------- @@ -478,16 +478,16 @@ find_dec_cb(const void *_record, void *_op_data) return(0); } /* end find_dec_cb() */ - + /*------------------------------------------------------------------------- - * Function: index_rec_cb + * Function: index_rec_cb * - * Purpose: v2 B-tree index callback for H5B2_test_rec_t records + * Purpose: v2 B-tree index callback for H5B2_test_rec_t records * - * Return: Success: TRUE/FALSE - * Failure: FAIL + * Return: Success: TRUE/FALSE + * Failure: FAIL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 25, 2015 * *------------------------------------------------------------------------- @@ -506,17 +506,17 @@ index_rec_cb(const void *_record, void *_op_data) return(TRUE); } /* end index_rec_cb() */ - + /*------------------------------------------------------------------------- - * Function: neighbor_cb + * Function: neighbor_cb * - * Purpose: v2 B-tree neighbor callback + * Purpose: v2 B-tree neighbor callback * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -532,17 +532,17 @@ neighbor_cb(const void *_record, void *_op_data) return(0); } /* end neighbor_cb() */ - + /*------------------------------------------------------------------------- - * Function: modify_cb + * Function: modify_cb * - * Purpose: v2 B-tree modify callback + * Purpose: v2 B-tree modify callback * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 10, 2005 * *------------------------------------------------------------------------- @@ -559,16 +559,16 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed) return(0); } /* end modify_cb() */ - + /*------------------------------------------------------------------------- - * Function: modify_rec_cb + * Function: modify_rec_cb * - * Purpose: v2 B-tree modify callback for H5B2_test_rec_t records + * Purpose: v2 B-tree modify callback for H5B2_test_rec_t records * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 25, 2015 * *------------------------------------------------------------------------- @@ -586,17 +586,17 @@ modify_rec_cb(void *_record, void *_op_data, hbool_t *changed) return(0); } /* end modify_rec_cb() */ - + /*------------------------------------------------------------------------- - * Function: no_modify_cb + * Function: no_modify_cb * - * Purpose: v2 B-tree modify callback for updates which shouldn't change - * the record (ie. inserting not modifying) + * Purpose: v2 B-tree modify callback for updates which shouldn't change + * the record (ie. inserting not modifying) * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 23, 2015 * *------------------------------------------------------------------------- @@ -610,17 +610,17 @@ no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data, return(1); } /* end no_modify_cb() */ - + /*------------------------------------------------------------------------- - * Function: remove_cb + * Function: remove_cb * - * Purpose: v2 B-tree remove callback + * Purpose: v2 B-tree remove callback * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, August 8, 2006 * *------------------------------------------------------------------------- @@ -636,16 +636,16 @@ remove_cb(const void *_record, void *_op_data) return(0); } /* end remove_cb() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_basic + * Function: test_insert_basic * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 3, 2005 * *------------------------------------------------------------------------- @@ -654,8 +654,8 @@ static unsigned test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -702,7 +702,7 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index record in B-tree with no records */ idx = 0; H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)0, find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -746,7 +746,7 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with 1 record */ idx = 0; H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -803,7 +803,7 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with several records */ idx = 0; H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -841,24 +841,24 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_insert_basic() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_split_root + * Function: test_insert_split_root * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It also continues to add a few more records to each of the * left and right leaf nodes after the split * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 3, 2005 * *------------------------------------------------------------------------- @@ -867,8 +867,8 @@ static unsigned test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -979,7 +979,7 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-1 B-tree */ idx = 0; H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC+2), find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC+2), find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -1016,25 +1016,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_split_root() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level1_2leaf_redistrib + * Function: test_insert_level1_2leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * redistribution * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, February 8, 2005 * *------------------------------------------------------------------------- @@ -1043,8 +1043,8 @@ static unsigned test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1170,25 +1170,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level1_2leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level1_side_split + * Function: test_insert_level1_side_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, February 9, 2005 * *------------------------------------------------------------------------- @@ -1197,8 +1197,8 @@ static unsigned test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1329,27 +1329,27 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level1_side_split() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level1_3leaf_redistrib + * Function: test_insert_level1_3leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree, then continues to * add records until a 3 node redistribution occurs * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 10, 2005 * *------------------------------------------------------------------------- @@ -1358,8 +1358,8 @@ static unsigned test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1472,26 +1472,26 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level1_3leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level1_middle_split + * Function: test_insert_level1_middle_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree, then continues to * add records until a 3 node split occurs * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 10, 2005 * *------------------------------------------------------------------------- @@ -1500,8 +1500,8 @@ static unsigned test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1594,22 +1594,22 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level1_middle_split() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_make_level2 + * Function: test_insert_make_level2 * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 11, 2005 * *------------------------------------------------------------------------- @@ -1618,8 +1618,8 @@ static unsigned test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1735,7 +1735,7 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-2 B-tree */ idx = 0; H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC * 30), find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -1773,24 +1773,24 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_make_level2() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_leaf_redistrib + * Function: test_insert_level2_leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force the leaves to redistribute * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 17, 2005 * *------------------------------------------------------------------------- @@ -1799,8 +1799,8 @@ static unsigned test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2001,24 +2001,24 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_leaf_split + * Function: test_insert_level2_leaf_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force leaves to split. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, February 17, 2005 * *------------------------------------------------------------------------- @@ -2027,8 +2027,8 @@ static unsigned test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2233,25 +2233,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_leaf_split() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_2internal_redistrib + * Function: test_insert_level2_2internal_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force the left-most and right-most internal nodes to * redistribute. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 18, 2005 * *------------------------------------------------------------------------- @@ -2260,8 +2260,8 @@ static unsigned test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2404,25 +2404,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_2internal_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_2internal_split + * Function: test_insert_level2_2internal_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force the left-most and right-most internal nodes to * split. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 18, 2005 * *------------------------------------------------------------------------- @@ -2431,8 +2431,8 @@ static unsigned test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2581,26 +2581,26 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_2internal_split() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_3internal_redistrib + * Function: test_insert_level2_3internal_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force the left-most and right-most internal nodes to * split and more records to force a 3 node redistribution of the * internal nodes. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 19, 2005 * *------------------------------------------------------------------------- @@ -2609,8 +2609,8 @@ static unsigned test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2758,26 +2758,26 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_3internal_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_level2_3internal_split + * Function: test_insert_level2_3internal_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree and then adds enough more * records to force the left-most and right-most internal nodes to * split and more records to force a 3->4 node split of the * internal nodes. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 19, 2005 * *------------------------------------------------------------------------- @@ -2786,8 +2786,8 @@ static unsigned test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2939,23 +2939,23 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_insert_level2_3internal_split() */ - + /*------------------------------------------------------------------------- - * Function: test_insert_lots + * Function: test_insert_lots * - * Purpose: Basic tests for the B-tree v2 code. This test inserts many + * Purpose: Basic tests for the B-tree v2 code. This test inserts many * records in random order, enough to make at a level 4 B-tree. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, February 19, 2005 * *------------------------------------------------------------------------- @@ -2964,9 +2964,9 @@ static unsigned test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - char filename[1024]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[1024]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -3099,13 +3099,13 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3170,22 +3170,22 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; HDfree(records); return 1; } /* test_insert_lots() */ - + /*------------------------------------------------------------------------- - * Function: test_update_basic + * Function: test_update_basic * - * Purpose: Basic tests for the v2 B-tree update operation + * Purpose: Basic tests for the v2 B-tree update operation * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 23, 2015 * *------------------------------------------------------------------------- @@ -3194,8 +3194,8 @@ static unsigned test_update_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3257,7 +3257,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with 1 record */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3321,7 +3321,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with 1 record */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3391,7 +3391,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with several records */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3478,7 +3478,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in B-tree with several records */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3537,24 +3537,24 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_update_basic() */ - + /*------------------------------------------------------------------------- - * Function: test_update_split_root + * Function: test_update_split_root * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It also continues to add a few more records to each of the * left and right leaf nodes after the split * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 23, 2015 * *------------------------------------------------------------------------- @@ -3563,8 +3563,8 @@ static unsigned test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3736,7 +3736,7 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-1 B-tree */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -3788,25 +3788,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_split_root() */ - + /*------------------------------------------------------------------------- - * Function: test_update_level1_2leaf_redistrib + * Function: test_update_level1_2leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * redistribution * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, December 26, 2015 * *------------------------------------------------------------------------- @@ -3815,8 +3815,8 @@ static unsigned test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3946,25 +3946,25 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_level1_2leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_update_level1_side_split + * Function: test_update_level1_side_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, December 26, 2015 * *------------------------------------------------------------------------- @@ -3973,8 +3973,8 @@ static unsigned test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4109,27 +4109,27 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_level1_side_split() */ - + /*------------------------------------------------------------------------- - * Function: test_update_level1_3leaf_redistrib + * Function: test_update_level1_3leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree, then continues to * add records until a 3 node redistribution occurs * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, December 26, 2015 * *------------------------------------------------------------------------- @@ -4138,8 +4138,8 @@ static unsigned test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4256,26 +4256,26 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_level1_3leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_update_level1_middle_split + * Function: test_update_level1_middle_split * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to split the root node and force the tree to depth 1. * It continues to add a more records to the each of the * left and right leaf nodes after the split to force a 2 node * split, adding another node to the B-tree, then continues to * add records until a 3 node split occurs * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, December 26, 2015 * *------------------------------------------------------------------------- @@ -4284,8 +4284,8 @@ static unsigned test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4381,22 +4381,22 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_level1_middle_split() */ - + /*------------------------------------------------------------------------- - * Function: test_update_make_level2 + * Function: test_update_make_level2 * - * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough * records to make a level 2 B-tree * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Saturday, December 26, 2015 * *------------------------------------------------------------------------- @@ -4405,8 +4405,8 @@ static unsigned test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4541,7 +4541,7 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-2 B-tree */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -4706,7 +4706,7 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-2 B-tree */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -4881,7 +4881,7 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to index non-existant record in level-2 B-tree */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -4934,22 +4934,22 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_update_make_level2() */ - + /*------------------------------------------------------------------------- - * Function: test_update_lots + * Function: test_update_lots * - * Purpose: Basic tests for the B-tree v2 code. This test inserts many + * Purpose: Basic tests for the B-tree v2 code. This test inserts many * records in random order, enough to make at a level 4 B-tree. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Sunday, December 27, 2015 * *------------------------------------------------------------------------- @@ -4958,8 +4958,8 @@ static unsigned test_update_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ time_t curr_time; /* Current time, for seeding random number generator */ @@ -5086,13 +5086,13 @@ HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR H5E_BEGIN_TRY { - ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); + ret = H5B2_index(bt2, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -5174,23 +5174,23 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; HDfree(records); return 1; } /* test_update_lots() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_basic + * Function: test_remove_basic * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 25, 2005 * *------------------------------------------------------------------------- @@ -5199,8 +5199,8 @@ static unsigned test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5231,7 +5231,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to remove a record from a B-tree with no records */ record = 0; H5E_BEGIN_TRY { - ret = H5B2_remove(bt2, &record, NULL, NULL); + ret = H5B2_remove(bt2, &record, NULL, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -5351,7 +5351,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, record = 0; H5E_BEGIN_TRY { - ret = H5B2_remove(bt2, &record, NULL, NULL); + ret = H5B2_remove(bt2, &record, NULL, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -5483,21 +5483,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_basic() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_noredistrib + * Function: test_remove_level1_noredistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, February 25, 2005 * *------------------------------------------------------------------------- @@ -5506,8 +5506,8 @@ static unsigned test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5554,7 +5554,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to remove a non-existant record from a B-tree with 1 record */ record = (INSERT_SPLIT_ROOT_NREC * 2) + 1; H5E_BEGIN_TRY { - ret = H5B2_remove(bt2, &record, NULL, NULL); + ret = H5B2_remove(bt2, &record, NULL, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -5705,21 +5705,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_noredistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_redistrib + * Function: test_remove_level1_redistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -5728,8 +5728,8 @@ static unsigned test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5901,21 +5901,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_2leaf_merge + * Function: test_remove_level1_2leaf_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -5924,8 +5924,8 @@ static unsigned test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6079,21 +6079,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_2leaf_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_3leaf_merge + * Function: test_remove_level1_3leaf_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6102,8 +6102,8 @@ static unsigned test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6204,21 +6204,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_3leaf_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_promote + * Function: test_remove_level1_promote * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6227,8 +6227,8 @@ static unsigned test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6430,21 +6430,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_promote() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_promote_2leaf_redistrib + * Function: test_remove_level1_promote_2leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6453,8 +6453,8 @@ static unsigned test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6577,21 +6577,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_promote_2leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_promote_3leaf_redistrib + * Function: test_remove_level1_promote_3leaf_redistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6600,8 +6600,8 @@ static unsigned test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6724,21 +6724,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_promote_3leaf_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_promote_2leaf_merge + * Function: test_remove_level1_promote_2leaf_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6747,8 +6747,8 @@ static unsigned test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6868,21 +6868,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_promote_2leaf_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_promote_3leaf_merge + * Function: test_remove_level1_promote_3leaf_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -6891,8 +6891,8 @@ static unsigned test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7012,21 +7012,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_promote_3leaf_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level1_collapse + * Function: test_remove_level1_collapse * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -7035,8 +7035,8 @@ static unsigned test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7150,21 +7150,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level1_collapse() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_promote + * Function: test_remove_level2_promote * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 4, 2005 * *------------------------------------------------------------------------- @@ -7173,8 +7173,8 @@ static unsigned test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7435,21 +7435,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_promote() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_promote_2internal_redistrib + * Function: test_remove_level2_promote_2internal_redistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 7, 2005 * *------------------------------------------------------------------------- @@ -7458,8 +7458,8 @@ static unsigned test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7584,21 +7584,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_promote_2internal_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_3promote_internal_redistrib + * Function: test_remove_level2_3promote_internal_redistrib * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 7, 2005 * *------------------------------------------------------------------------- @@ -7607,8 +7607,8 @@ static unsigned test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7733,21 +7733,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_promote_3internal_redistrib() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_promote_2internal_merge + * Function: test_remove_level2_promote_2internal_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 7, 2005 * *------------------------------------------------------------------------- @@ -7756,8 +7756,8 @@ static unsigned test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7883,21 +7883,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_promote_2internal_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_3promote_internal_merge + * Function: test_remove_level2_3promote_internal_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, March 7, 2005 * *------------------------------------------------------------------------- @@ -7906,8 +7906,8 @@ static unsigned test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8033,21 +8033,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_promote_3internal_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_2internal_merge_left + * Function: test_remove_level2_2internal_merge_left * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -8056,8 +8056,8 @@ static unsigned test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8158,21 +8158,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_2internal_merge_left() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_2internal_merge_right + * Function: test_remove_level2_2internal_merge_right * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -8181,8 +8181,8 @@ static unsigned test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8283,21 +8283,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_2internal_merge_right() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_3internal_merge + * Function: test_remove_level2_3internal_merge * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -8306,8 +8306,8 @@ static unsigned test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8408,21 +8408,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_3internal_merge() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_level2_collapse_right + * Function: test_remove_level2_collapse_right * - * Purpose: Basic tests for the B-tree v2 code + * Purpose: Basic tests for the B-tree v2 code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -8431,8 +8431,8 @@ static unsigned test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8533,21 +8533,21 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_remove_level2_collapse_right() */ - + /*------------------------------------------------------------------------- - * Function: gen_l4_btree2 + * Function: gen_l4_btree2 * - * Purpose: Generate a level-4 v2 B-tree for testing. + * Purpose: Generate a level-4 v2 B-tree for testing. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, October 14, 2008 * *------------------------------------------------------------------------- @@ -8556,8 +8556,8 @@ static unsigned gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, haddr_t *bt2_addr, const hsize_t *records) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ hsize_t record; /* Record to insert into tree */ unsigned u; /* Local index variable */ @@ -8607,24 +8607,24 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* gen_l4_btree2() */ - + /*------------------------------------------------------------------------- - * Function: test_remove_lots + * Function: test_remove_lots * - * Purpose: Basic tests for the B-tree v2 code. This test inserts many + * Purpose: Basic tests for the B-tree v2 code. This test inserts many * records in random order, enough to make at a level 4 B-tree * and then removes them all, by record and by index. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -8632,11 +8632,11 @@ error: static unsigned test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cparam) { - hid_t file = -1; /* File ID */ - char filename[1024]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[1024]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ int fd = -1; /* File descriptor */ - h5_stat_t sb; /* Stat buffer for file */ + h5_stat_t sb; /* Stat buffer for file */ void *file_data = NULL; /* Copy of file data */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ @@ -9051,7 +9051,7 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; if(fd > 0) @@ -9064,17 +9064,17 @@ error: return 1; } /* test_remove_lots() */ - + /*------------------------------------------------------------------------- - * Function: test_find_neighbor + * Function: test_find_neighbor * - * Purpose: Basic tests for the B-tree v2 code. This test exercises + * Purpose: Basic tests for the B-tree v2 code. This test exercises * code to find nearest neighbors to a given value in a B-tree. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, March 8, 2005 * *------------------------------------------------------------------------- @@ -9083,8 +9083,8 @@ static unsigned test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9125,7 +9125,7 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to find record B-tree less than a value */ search = 0; H5E_BEGIN_TRY { - ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record); + ret = H5B2_neighbor(bt2, H5B2_COMPARE_LESS, &search, neighbor_cb, &record); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9203,7 +9203,7 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, /* Attempt to find record B-tree less than a value */ search = (FIND_NEIGHBOR * 2) + 1; H5E_BEGIN_TRY { - ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record); + ret = H5B2_neighbor(bt2, H5B2_COMPARE_GREATER, &search, neighbor_cb, &record); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9279,23 +9279,23 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; HDfree(records); return 1; } /* test_find_neighbor() */ - + /*------------------------------------------------------------------------- - * Function: test_delete + * Function: test_delete * - * Purpose: Basic tests for the B-tree v2 code. This test exercises + * Purpose: Basic tests for the B-tree v2 code. This test exercises * code to delete a B-tree from a file * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, March 9, 2005 * *------------------------------------------------------------------------- @@ -9303,9 +9303,9 @@ error: static unsigned test_delete(hid_t fapl, const H5B2_create_t *cparam) { - hid_t file = -1; /* File ID */ - char filename[1024]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[1024]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ @@ -9551,22 +9551,22 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_delete() */ - + /*------------------------------------------------------------------------- - * Function: test_modify + * Function: test_modify * - * Purpose: Basic tests for the B-tree v2 code. This test exercises + * Purpose: Basic tests for the B-tree v2 code. This test exercises * code to modify an existing record in the B-tree * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, March 10, 2005 * *------------------------------------------------------------------------- @@ -9575,8 +9575,8 @@ static unsigned test_modify(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9617,7 +9617,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, record = 3; modify = 4; H5E_BEGIN_TRY { - ret = H5B2_modify(bt2, &record, modify_cb, &modify); + ret = H5B2_modify(bt2, &record, modify_cb, &modify); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9663,7 +9663,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, record = 4330; found = HSIZET_MAX; H5E_BEGIN_TRY { - ret = H5B2_modify(bt2, &record, modify_cb, &modify); + ret = H5B2_modify(bt2, &record, modify_cb, &modify); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9709,7 +9709,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, record = 5350; found = 5350; H5E_BEGIN_TRY { - ret = H5B2_modify(bt2, &record, modify_cb, &modify); + ret = H5B2_modify(bt2, &record, modify_cb, &modify); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9755,7 +9755,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, record = 9445; found = 9445; H5E_BEGIN_TRY { - ret = H5B2_modify(bt2, &record, modify_cb, &modify); + ret = H5B2_modify(bt2, &record, modify_cb, &modify); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) @@ -9778,23 +9778,23 @@ error: H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_modify() */ - + /*------------------------------------------------------------------------- - * Function: test_open_twice_diff + * Function: test_open_twice_diff * - * Purpose: Open a v2 B-tree twice, through different "top" file + * Purpose: Open a v2 B-tree twice, through different "top" file * handles, with an intermediate file open that takes the "shared" * file handle from the first B-tree's file pointer. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 18, 2015 * *------------------------------------------------------------------------- @@ -9802,14 +9802,14 @@ error: static unsigned test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) { - char filename[1024]; /* Filename to use */ + char filename[1024]; /* Filename to use */ char filename_tmp[1024]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + hid_t file0 = -1; /* File ID */ + hid_t file00 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ @@ -9914,25 +9914,25 @@ error: H5B2_close(bt2); if(bt2) H5B2_close(bt2_2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(file); + H5Fclose(file2); + H5Fclose(file0); + H5Fclose(file00); } H5E_END_TRY; return(1); } /* test_open_twice_diff() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test the B-tree v2 code + * Purpose: Test the B-tree v2 code * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, February 1, 2005 * *------------------------------------------------------------------------- @@ -9942,10 +9942,10 @@ main(void) { H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */ bt2_test_param_t tparam; /* Test parameters for v2 B-tree */ - hid_t fapl = -1; /* File access property list for data files */ - unsigned nerrors = 0; /* Cumulative error count */ + hid_t fapl = -1; /* File access property list for data files */ + unsigned nerrors = 0; /* Cumulative error count */ unsigned reopen; /* Whether to reopen B-tree during tests */ - int ExpressMode; + int ExpressMode; const char *envval = NULL; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ @@ -9958,7 +9958,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Initialize v2 B-tree creation parameters */ init_cparam(&cparam, &cparam2); @@ -9970,11 +9970,11 @@ main(void) /* Loop over re-opening B-tree during tests */ for(reopen = FALSE; reopen <= TRUE; reopen++) { if(reopen) { - fprintf(stdout, "Testing with reopening B-tree:\n"); + HDfprintf(stdout, "Testing with reopening B-tree:\n"); tparam.reopen_btree = TRUE; } /* end if */ else { - fprintf(stdout, "Testing without reopening B-tree:\n"); + HDfprintf(stdout, "Testing without reopening B-tree:\n"); tparam.reopen_btree = FALSE; } /* end else */ @@ -9994,7 +9994,7 @@ main(void) nerrors += test_insert_level2_3internal_redistrib(fapl, &cparam, &tparam); nerrors += test_insert_level2_3internal_split(fapl, &cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. test_insert_lots skipped\n"); + HDprintf("***Express test mode on. test_insert_lots skipped\n"); else nerrors += test_insert_lots(fapl, &cparam, &tparam); @@ -10008,7 +10008,7 @@ main(void) nerrors += test_update_level1_middle_split(fapl, &cparam2, &tparam); nerrors += test_update_make_level2(fapl, &cparam2, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. test_update_lots skipped\n"); + HDprintf("***Express test mode on. test_update_lots skipped\n"); else nerrors += test_update_lots(fapl, &cparam2, &tparam); @@ -10035,7 +10035,7 @@ main(void) nerrors += test_remove_level2_3internal_merge(fapl, &cparam, &tparam); nerrors += test_remove_level2_collapse_right(fapl, &cparam, &tparam); if(ExpressMode > 1) - printf("***Express test mode on. test_remove_lots skipped\n"); + HDprintf("***Express test mode on. test_remove_lots skipped\n"); else nerrors += test_remove_lots(envval, fapl, &cparam); diff --git a/test/cache.c b/test/cache.c index d5e3c6c..1a726fa 100644 --- a/test/cache.c +++ b/test/cache.c @@ -14,85 +14,85 @@ /* Programmer: John Mainzer * 6/9/04 * - * This file contains tests for the cache implemented in - * H5C.c + * This file contains tests for the cache implemented in + * H5C.c */ #include "cache_common.h" - + /* private typedef declarations: */ struct flush_cache_test_spec { - int entry_num; - int entry_type; - int entry_index; - hbool_t insert_flag; - unsigned int flags; - hbool_t expected_deserialized; - hbool_t expected_serialized; - hbool_t expected_destroyed; + int entry_num; + int entry_type; + int entry_index; + hbool_t insert_flag; + unsigned int flags; + hbool_t expected_deserialized; + hbool_t expected_serialized; + hbool_t expected_destroyed; }; struct pe_flush_cache_test_spec { - int entry_num; - int entry_type; - int entry_index; - hbool_t insert_flag; - unsigned int flags; - int num_pins; - int pin_type[MAX_PINS]; - int pin_idx[MAX_PINS]; - hbool_t expected_deserialized; - hbool_t expected_serialized; - hbool_t expected_destroyed; + int entry_num; + int entry_type; + int entry_index; + hbool_t insert_flag; + unsigned int flags; + int num_pins; + int pin_type[MAX_PINS]; + int pin_idx[MAX_PINS]; + hbool_t expected_deserialized; + hbool_t expected_serialized; + hbool_t expected_destroyed; }; struct fo_flush_entry_check { - int entry_num; - int entry_type; - int entry_index; - size_t expected_size; - hbool_t in_cache; - hbool_t at_main_addr; - hbool_t is_dirty; - hbool_t is_protected; - hbool_t is_pinned; - hbool_t expected_deserialized; - hbool_t expected_serialized; - hbool_t expected_destroyed; + int entry_num; + int entry_type; + int entry_index; + size_t expected_size; + hbool_t in_cache; + hbool_t at_main_addr; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + hbool_t expected_deserialized; + hbool_t expected_serialized; + hbool_t expected_destroyed; }; struct fo_flush_cache_test_spec { - int entry_num; - int entry_type; - int entry_index; - hbool_t insert_flag; - unsigned int flags; - hbool_t resize_flag; - size_t new_size; - int num_pins; - int pin_type[MAX_PINS]; - int pin_idx[MAX_PINS]; - int num_flush_ops; - struct flush_op flush_ops[MAX_FLUSH_OPS]; - hbool_t expected_deserialized; - hbool_t expected_serialized; - hbool_t expected_destroyed; + int entry_num; + int entry_type; + int entry_index; + hbool_t insert_flag; + unsigned int flags; + hbool_t resize_flag; + size_t new_size; + int num_pins; + int pin_type[MAX_PINS]; + int pin_idx[MAX_PINS]; + int num_flush_ops; + struct flush_op flush_ops[MAX_FLUSH_OPS]; + hbool_t expected_deserialized; + hbool_t expected_serialized; + hbool_t expected_destroyed; }; struct move_entry_test_spec { - int entry_type; - int entry_index; - hbool_t is_pinned; + int entry_type; + int entry_index; + hbool_t is_pinned; hbool_t is_protected; }; - + /* private function declarations: */ static unsigned smoke_check_1(int express_test, unsigned paged); @@ -136,7 +136,7 @@ static void check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, int entry_type, int entry_idx, hbool_t unprot_dirty_flag, - hbool_t mark_dirty, + hbool_t mark_dirty, hbool_t pop_mark_dirty_prot, hbool_t pop_mark_dirty_pinned, hbool_t unprotect_unpin, @@ -150,11 +150,11 @@ static void check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - unsigned init_expected_index_len, - size_t init_expected_index_size, - unsigned expected_index_len, - size_t expected_index_size, - int check_size, + unsigned init_expected_index_len, + size_t init_expected_index_size, + unsigned expected_index_len, + size_t expected_index_size, + int check_size, struct fo_flush_entry_check check[]); static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr); static unsigned check_get_entry_status(unsigned paged); @@ -204,7 +204,7 @@ static unsigned check_stats(unsigned paged); static void check_stats__smoke_check_1(H5F_t * file_ptr); #endif /* H5C_COLLECT_CACHE_STATS */ - + /**************************************************************************/ /**************************************************************************/ /********************************* tests: *********************************/ @@ -212,15 +212,15 @@ static void check_stats__smoke_check_1(H5F_t * file_ptr); /**************************************************************************/ /*------------------------------------------------------------------------- - * Function: smoke_check_1() + * Function: smoke_check_1() * - * Purpose: A basic functional test, inserts, destroys, and moves in + * Purpose: A basic functional test, inserts, destroys, and moves in * the mix, along with repeated protects and unprotects. - * All entries are marked as clean. + * All entries are marked as clean. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/16/04 * *------------------------------------------------------------------------- @@ -251,23 +251,23 @@ smoke_check_1(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -289,7 +289,7 @@ smoke_check_1(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -299,7 +299,7 @@ smoke_check_1(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -318,7 +318,7 @@ smoke_check_1(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -327,7 +327,7 @@ smoke_check_1(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -337,7 +337,7 @@ smoke_check_1(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -357,7 +357,7 @@ smoke_check_1(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -382,7 +382,7 @@ smoke_check_1(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -416,18 +416,18 @@ smoke_check_1(int express_test, unsigned paged) } /* smoke_check_1() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_2() + * Function: smoke_check_2() * - * Purpose: A basic functional test, with inserts, destroys, and - * moves in the mix, along with some repeated protects - * and unprotects. About half the entries are marked as - * dirty. + * Purpose: A basic functional test, with inserts, destroys, and + * moves in the mix, along with some repeated protects + * and unprotects. About half the entries are marked as + * dirty. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * *------------------------------------------------------------------------- @@ -458,23 +458,23 @@ smoke_check_2(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -496,7 +496,7 @@ smoke_check_2(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -506,7 +506,7 @@ smoke_check_2(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -525,7 +525,7 @@ smoke_check_2(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -534,7 +534,7 @@ smoke_check_2(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -544,7 +544,7 @@ smoke_check_2(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -564,7 +564,7 @@ smoke_check_2(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -589,7 +589,7 @@ smoke_check_2(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -623,17 +623,17 @@ smoke_check_2(int express_test, unsigned paged) } /* smoke_check_2() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_3() + * Function: smoke_check_3() * - * Purpose: A basic functional test on a tiny cache, with inserts, - * destroys, and moves in the mix, along with repeated - * protects and unprotects. All entries are marked as clean. + * Purpose: A basic functional test on a tiny cache, with inserts, + * destroys, and moves in the mix, along with repeated + * protects and unprotects. All entries are marked as clean. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/16/04 * *------------------------------------------------------------------------- @@ -664,23 +664,23 @@ smoke_check_3(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -702,7 +702,7 @@ smoke_check_3(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -712,7 +712,7 @@ smoke_check_3(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -731,7 +731,7 @@ smoke_check_3(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -740,7 +740,7 @@ smoke_check_3(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -750,7 +750,7 @@ smoke_check_3(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -770,7 +770,7 @@ smoke_check_3(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -795,7 +795,7 @@ smoke_check_3(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -829,18 +829,18 @@ smoke_check_3(int express_test, unsigned paged) } /* smoke_check_3() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_4() + * Function: smoke_check_4() * - * Purpose: A basic functional test on a tiny cache, with inserts, - * destroys, and moves in the mix, along with repeated - * protects and unprotects. About half the entries are - * marked as dirty. + * Purpose: A basic functional test on a tiny cache, with inserts, + * destroys, and moves in the mix, along with repeated + * protects and unprotects. About half the entries are + * marked as dirty. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * *------------------------------------------------------------------------- @@ -871,23 +871,23 @@ smoke_check_4(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -909,7 +909,7 @@ smoke_check_4(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -919,7 +919,7 @@ smoke_check_4(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -938,7 +938,7 @@ smoke_check_4(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -947,7 +947,7 @@ smoke_check_4(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -957,7 +957,7 @@ smoke_check_4(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -977,7 +977,7 @@ smoke_check_4(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1002,7 +1002,7 @@ smoke_check_4(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -1036,18 +1036,18 @@ smoke_check_4(int express_test, unsigned paged) } /* smoke_check_4() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_5() + * Function: smoke_check_5() * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. All entries are marked - * as clean. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. All entries are marked + * as clean. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/14/04 * *------------------------------------------------------------------------- @@ -1093,9 +1093,9 @@ smoke_check_5(int express_test, unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1126,23 +1126,23 @@ smoke_check_5(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -1280,18 +1280,18 @@ smoke_check_5(int express_test, unsigned paged) } /* smoke_check_5() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_6() + * Function: smoke_check_6() * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with * repeated protects and unprotects. About one half of all - * entries are marked as dirty. + * entries are marked as dirty. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/25/04 * *------------------------------------------------------------------------- @@ -1337,9 +1337,9 @@ smoke_check_6(int express_test, unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -1372,23 +1372,23 @@ smoke_check_6(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } if(show_progress) /* 1 */ @@ -1524,18 +1524,18 @@ smoke_check_6(int express_test, unsigned paged) } /* smoke_check_6() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_7() + * Function: smoke_check_7() * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with - * repeated protects and unprotects. All entries are marked - * as clean. + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with + * repeated protects and unprotects. All entries are marked + * as clean. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 12/2/04 * *------------------------------------------------------------------------- @@ -1581,9 +1581,9 @@ smoke_check_7(int express_test, unsigned paged) /* size_t max_increment = */ (8 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ @@ -1615,23 +1615,23 @@ smoke_check_7(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -1769,18 +1769,18 @@ smoke_check_7(int express_test, unsigned paged) } /* smoke_check_7() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_8() + * Function: smoke_check_8() * - * Purpose: A basic functional test on a cache with automatic cache - * resizing enabled, with inserts in the mix, along with + * Purpose: A basic functional test on a cache with automatic cache + * resizing enabled, with inserts in the mix, along with * repeated protects and unprotects. About one half of all - * entries are marked as dirty. + * entries are marked as dirty. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/25/04 * *------------------------------------------------------------------------- @@ -1826,9 +1826,9 @@ smoke_check_8(int express_test, unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ @@ -1860,23 +1860,23 @@ smoke_check_8(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -2014,26 +2014,26 @@ smoke_check_8(int express_test, unsigned paged) } /* smoke_check_8() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_9() + * Function: smoke_check_9() * - * Purpose: A repeat of smoke check 1, only with the cache corked - * part of the time. + * Purpose: A repeat of smoke check 1, only with the cache corked + * part of the time. * - * Recall that smoke check 1 is a basic functional test, - * with inserts, destroys, and moves in the mix, along - * with repeated protects and unprotects. All entries are - * marked as clean. + * Recall that smoke check 1 is a basic functional test, + * with inserts, destroys, and moves in the mix, along + * with repeated protects and unprotects. All entries are + * marked as clean. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/1/07 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -2066,23 +2066,23 @@ smoke_check_9(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -2113,8 +2113,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 1.\n"; - } + failure_mssg = "can't disable evictions 1.\n"; + } } if(show_progress) /* 4 */ @@ -2122,7 +2122,7 @@ smoke_check_9(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2132,7 +2132,7 @@ smoke_check_9(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2149,8 +2149,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 1.\n"; - } + failure_mssg = "can't enable evictions 1.\n"; + } } if(show_progress) /* 6 */ @@ -2168,7 +2168,7 @@ smoke_check_9(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2183,8 +2183,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 2.\n"; - } + failure_mssg = "can't disable evictions 2.\n"; + } } if(show_progress) /* 8 */ @@ -2192,7 +2192,7 @@ smoke_check_9(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2202,7 +2202,7 @@ smoke_check_9(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2217,8 +2217,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 2.\n"; - } + failure_mssg = "can't enable evictions 2.\n"; + } } if(show_progress) /* 10 */ @@ -2243,8 +2243,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 3.\n"; - } + failure_mssg = "can't disable evictions 3.\n"; + } } if(show_progress) /* 12 */ @@ -2252,7 +2252,7 @@ smoke_check_9(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2283,8 +2283,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 3.\n"; - } + failure_mssg = "can't enable evictions 3.\n"; + } } if(show_progress) /* 15 */ @@ -2292,7 +2292,7 @@ smoke_check_9(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2312,8 +2312,8 @@ smoke_check_9(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 4.\n"; - } + failure_mssg = "can't disable evictions 4.\n"; + } } @@ -2342,26 +2342,26 @@ smoke_check_9(int express_test, unsigned paged) } /* smoke_check_9() */ - + /*------------------------------------------------------------------------- - * Function: smoke_check_10() + * Function: smoke_check_10() * - * Purpose: A repeat of smoke check 2, only with the cache corked - * part of the time. + * Purpose: A repeat of smoke check 2, only with the cache corked + * part of the time. * - * Recall that smoke check 2 is a basic functional test, - * with inserts, destroys, and moves in the mix, along - * with some repeated protects and unprotects. About half - * the entries are marked as dirty. + * Recall that smoke check 2 is a basic functional test, + * with inserts, destroys, and moves in the mix, along + * with some repeated protects and unprotects. About half + * the entries are marked as dirty. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/1/07 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -2394,23 +2394,23 @@ smoke_check_10(int express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -2433,7 +2433,7 @@ smoke_check_10(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2443,7 +2443,7 @@ smoke_check_10(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2458,8 +2458,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 1.\n"; - } + failure_mssg = "can't disable evictions 1.\n"; + } } if(show_progress) /* 5 */ @@ -2477,7 +2477,7 @@ smoke_check_10(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2492,8 +2492,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 1.\n"; - } + failure_mssg = "can't enable evictions 1.\n"; + } } if(show_progress) /* 7 */ @@ -2501,7 +2501,7 @@ smoke_check_10(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2511,7 +2511,7 @@ smoke_check_10(int express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ dirty_destroys, /* dirty_unprotects */ dirty_unprotects); @@ -2526,8 +2526,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 2.\n"; - } + failure_mssg = "can't disable evictions 2.\n"; + } } if(show_progress) /* 9 */ @@ -2552,8 +2552,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 2.\n"; - } + failure_mssg = "can't enable evictions 2.\n"; + } } if(show_progress) /* 11 */ @@ -2561,7 +2561,7 @@ smoke_check_10(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2581,8 +2581,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 3.\n"; - } + failure_mssg = "can't disable evictions 3.\n"; + } } if(show_progress) /* 13 */ @@ -2607,8 +2607,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't enable evictions 3.\n"; - } + failure_mssg = "can't enable evictions 3.\n"; + } } if(show_progress) /* 15 */ @@ -2616,7 +2616,7 @@ smoke_check_10(int express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2636,8 +2636,8 @@ smoke_check_10(int express_test, unsigned paged) if(result < 0) { pass = FALSE; - failure_mssg = "can't disable evictions 4.\n"; - } + failure_mssg = "can't disable evictions 4.\n"; + } } if(show_progress) /* 17 */ @@ -2665,19 +2665,19 @@ smoke_check_10(int express_test, unsigned paged) } /* smoke_check_10() */ - + /*------------------------------------------------------------------------- - * Function: write_permitted_check() + * Function: write_permitted_check() * - * Purpose: A basic test of the write permitted function. In essence, - * we load the cache up with dirty entryies, set - * write_permitted to FALSE, and then protect a bunch of - * entries. If there are any writes while write_permitted is - * FALSE, the test will fail. + * Purpose: A basic test of the write permitted function. In essence, + * we load the cache up with dirty entryies, set + * write_permitted to FALSE, and then protect a bunch of + * entries. If there are any writes while write_permitted is + * FALSE, the test will fail. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -2712,23 +2712,23 @@ express_test, unsigned paged) switch (express_test) { - case 0: - max_index = (10 * 1024) - 1; - break; + case 0: + max_index = (10 * 1024) - 1; + break; - case 1: - max_index = (1 * 1024) - 1; - break; + case 1: + max_index = (1 * 1024) - 1; + break; - case 2: - max_index = (512) - 1; - break; + case 2: + max_index = (512) - 1; + break; - default: + default: SKIPPED(); - HDfprintf(stdout, " Long tests disabled.\n"); - return 0; /* <========== note return */ - break; + HDfprintf(stdout, " Long tests disabled.\n"); + return 0; /* <========== note return */ + break; } pass = TRUE; @@ -2750,7 +2750,7 @@ express_test, unsigned paged) FUNC, mile_stone++, (int)pass); row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2760,7 +2760,7 @@ express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ TRUE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ TRUE, /* dirty_unprotects */ TRUE); @@ -2781,7 +2781,7 @@ express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ TRUE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ FALSE, /* dirty_unprotects */ NO_CHANGE); @@ -2792,7 +2792,7 @@ express_test, unsigned paged) write_permitted = TRUE; row_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2802,7 +2802,7 @@ express_test, unsigned paged) /* do_moves */ TRUE, /* move_to_main_addr */ FALSE, /* do_destroys */ FALSE, - /* do_mult_ro_protects */ TRUE, + /* do_mult_ro_protects */ TRUE, /* dirty_destroys */ TRUE, /* dirty_unprotects */ TRUE); @@ -2822,7 +2822,7 @@ express_test, unsigned paged) FUNC, mile_stone++, (int)pass); col_major_scan_forward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2838,7 +2838,7 @@ express_test, unsigned paged) write_permitted = FALSE; col_major_scan_backward(/* file_ptr */ file_ptr, - /* max_index */ max_index, + /* max_index */ max_index, /* lag */ lag, /* verbose */ FALSE, /* reset_stats */ TRUE, @@ -2874,7 +2874,7 @@ express_test, unsigned paged) SKIPPED(); - HDfprintf(stdout, " Clean and dirty LRU lists disabled.\n"); + HDfprintf(stdout, " Clean and dirty LRU lists disabled.\n"); #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ @@ -2882,21 +2882,21 @@ express_test, unsigned paged) } /* write_permitted_check() */ - + /*------------------------------------------------------------------------- - * Function: check_insert_entry() + * Function: check_insert_entry() * - * Purpose: Verify that H5C_insert_entry behaves as expected. - * Test the behaviour with different flags. + * Purpose: Verify that H5C_insert_entry behaves as expected. + * Test the behaviour with different flags. * - * This test was added primarily to test basic insert - * pinned entry functionallity, but I through in explicit - * tests for other functionallity that is tested implicitly - * elsewhere. + * This test was added primarily to test basic insert + * pinned entry functionallity, but I through in explicit + * tests for other functionallity that is tested implicitly + * elsewhere. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/10/06 * * Modifications: @@ -2960,13 +2960,13 @@ check_insert_entry(unsigned paged) base_addr = entries[0]; while(pass && (i < 4)) { - entry_ptr = &(base_addr[i]); + entry_ptr = &(base_addr[i]); - /* Start by checking everything we can via H5C_get_entry_status() */ + /* Start by checking everything we can via H5C_get_entry_status() */ - result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, + &in_cache, &is_dirty, &is_protected, + &is_pinned, NULL, NULL, NULL, NULL); if(result < 0) { @@ -2974,129 +2974,129 @@ check_insert_entry(unsigned paged) failure_mssg = "H5C_get_entry_status() reports failure."; } - if(pass) { + if(pass) { - /* check the universals */ - if((!in_cache) || (!is_dirty) || (is_protected) || + /* check the universals */ + if((!in_cache) || (!is_dirty) || (is_protected) || (entry_size != entry_sizes[entry_type])) { pass = FALSE; failure_mssg = "Unexpected insert results 1."; } - } + } - if(pass) { + if(pass) { /* verify that the pinned flag got set correctly */ - if((i == 2) || (i == 3)) { + if((i == 2) || (i == 3)) { - if(!is_pinned) { + if(!is_pinned) { pass = FALSE; failure_mssg = "Unexpected insert results 2."; - } - } else if(is_pinned) { + } + } else if(is_pinned) { pass = FALSE; failure_mssg = "Unexpected insert results 3."; - } else if(is_pinned != ((entry_ptr->header).is_pinned)) { + } else if(is_pinned != ((entry_ptr->header).is_pinned)) { pass = FALSE; failure_mssg = "Unexpected insert results 4."; } - } + } - /* Thats all we can get from H5C_get_entry_status(). - * Now start looking at the cache data structures directly. - */ + /* Thats all we can get from H5C_get_entry_status(). + * Now start looking at the cache data structures directly. + */ - if(pass) { + if(pass) { /* Verify that the flush marker got set correctly */ - if((i == 1) || (i == 3)) { + if((i == 1) || (i == 3)) { - if(!((entry_ptr->header).flush_marker)) { + if(!((entry_ptr->header).flush_marker)) { pass = FALSE; failure_mssg = "Unexpected insert results 5."; - } - } else if((entry_ptr->header).flush_marker) { + } + } else if((entry_ptr->header).flush_marker) { pass = FALSE; failure_mssg = "Unexpected insert results 6."; - } - } + } + } - if(pass) { + if(pass) { - /* Verify that pinned entries are in the pinned entry list */ - if((entry_ptr->header).is_pinned) { + /* Verify that pinned entries are in the pinned entry list */ + if((entry_ptr->header).is_pinned) { - search_ptr = cache_ptr->pel_head_ptr; + search_ptr = cache_ptr->pel_head_ptr; - while((search_ptr != NULL) && - (search_ptr != - (struct H5C_cache_entry_t *)entry_ptr)) - { - search_ptr = search_ptr->next; - } + while((search_ptr != NULL) && + (search_ptr != + (struct H5C_cache_entry_t *)entry_ptr)) + { + search_ptr = search_ptr->next; + } - if(search_ptr == NULL) { + if(search_ptr == NULL) { pass = FALSE; failure_mssg = "Unexpected insert results 7."; - } - } - } + } + } + } - if(pass) { + if(pass) { - /* Verify that unpinned entries are in the LRU list */ - if(!((entry_ptr->header).is_pinned)) { + /* Verify that unpinned entries are in the LRU list */ + if(!((entry_ptr->header).is_pinned)) { - search_ptr = cache_ptr->LRU_head_ptr; + search_ptr = cache_ptr->LRU_head_ptr; - while((search_ptr != NULL) && - (search_ptr != - (struct H5C_cache_entry_t *)entry_ptr)) - { - search_ptr = search_ptr->next; - } + while((search_ptr != NULL) && + (search_ptr != + (struct H5C_cache_entry_t *)entry_ptr)) + { + search_ptr = search_ptr->next; + } - if(search_ptr == NULL) { + if(search_ptr == NULL) { pass = FALSE; failure_mssg = "Unexpected insert results 8."; - } - } - } + } + } + } #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - if(pass) { + if(pass) { - /* Verify that unpinned entries are in the dirty LRU list */ - if(!((entry_ptr->header).is_pinned)) { + /* Verify that unpinned entries are in the dirty LRU list */ + if(!((entry_ptr->header).is_pinned)) { - search_ptr = cache_ptr->dLRU_head_ptr; + search_ptr = cache_ptr->dLRU_head_ptr; - while((search_ptr != NULL) && - (search_ptr != - (struct H5C_cache_entry_t *)entry_ptr)) - { - search_ptr = search_ptr->aux_next; - } + while((search_ptr != NULL) && + (search_ptr != + (struct H5C_cache_entry_t *)entry_ptr)) + { + search_ptr = search_ptr->aux_next; + } - if(search_ptr == NULL) { + if(search_ptr == NULL) { pass = FALSE; failure_mssg = "Unexpected insert results 9."; - } - } - } + } + } + } #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - i++; + i++; } /* while */ @@ -3107,27 +3107,27 @@ check_insert_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->slist_len != 4) || - (cache_ptr->slist_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->pl_len != 0) || - (cache_ptr->pl_size != (size_t)0) || - (cache_ptr->pel_len != 2) || - (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || - (cache_ptr->LRU_list_len != 2) || - (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != 4 * entry_sizes[entry_type]) || + (cache_ptr->slist_len != 4) || + (cache_ptr->slist_size != 4 * entry_sizes[entry_type]) || + (cache_ptr->pl_len != 0) || + (cache_ptr->pl_size != (size_t)0) || + (cache_ptr->pel_len != 2) || + (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || + (cache_ptr->LRU_list_len != 2) || + (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - || (cache_ptr->dLRU_list_len != 2) || - (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || - (cache_ptr->cLRU_list_len != 0) || - (cache_ptr->cLRU_list_size != (size_t)0) + || (cache_ptr->dLRU_list_len != 2) || + (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || + (cache_ptr->cLRU_list_len != 0) || + (cache_ptr->cLRU_list_size != (size_t)0) #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ ) { pass = FALSE; failure_mssg = "Unexpected insert results 10."; - } + } } /* Finally, if stats collection is enabled, verify that the expected @@ -3136,23 +3136,23 @@ check_insert_entry(unsigned paged) #if H5C_COLLECT_CACHE_STATS if(pass) { - if((cache_ptr->insertions[entry_type] != 4) || - (cache_ptr->pinned_insertions[entry_type] != 2) || - (cache_ptr->pins[entry_type] != 2) || - (cache_ptr->unpins[entry_type] != 0) || + if((cache_ptr->insertions[entry_type] != 4) || + (cache_ptr->pinned_insertions[entry_type] != 2) || + (cache_ptr->pins[entry_type] != 2) || + (cache_ptr->unpins[entry_type] != 0) || (cache_ptr->dirty_pins[entry_type] != 0) || - (cache_ptr->max_index_len != 4) || - (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->max_slist_len != 4) || - (cache_ptr->max_slist_size != 4 * entry_sizes[entry_type]) || - (cache_ptr->max_pl_len != 0) || - (cache_ptr->max_pl_size != (size_t)0) || - (cache_ptr->max_pel_len != 2) || - (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { + (cache_ptr->max_index_len != 4) || + (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) || + (cache_ptr->max_slist_len != 4) || + (cache_ptr->max_slist_size != 4 * entry_sizes[entry_type]) || + (cache_ptr->max_pl_len != 0) || + (cache_ptr->max_pl_size != (size_t)0) || + (cache_ptr->max_pel_len != 2) || + (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) { pass = FALSE; failure_mssg = "Unexpected insert results 11."; - } + } } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -3161,7 +3161,7 @@ check_insert_entry(unsigned paged) if(pass) { unpin_entry(entry_type, 2); - unpin_entry(entry_type, 3); + unpin_entry(entry_type, 3); } if(pass) { @@ -3181,16 +3181,16 @@ check_insert_entry(unsigned paged) } /* check_insert_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache() + * Function: check_flush_cache() * - * Purpose: Verify that flush_cache behaves as expected. In particular, - * test the behaviour with different flags. + * Purpose: Verify that flush_cache behaves as expected. In particular, + * test the behaviour with different flags. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/10/05 * * Modifications: @@ -3247,7 +3247,7 @@ check_flush_cache(unsigned paged) if(pass) { - check_flush_cache__flush_ops(file_ptr); + check_flush_cache__flush_ops(file_ptr); } if(pass) { @@ -3267,16 +3267,16 @@ check_flush_cache(unsigned paged) } /* check_flush_cache() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__empty_cache() + * Function: check_flush_cache__empty_cache() * - * Purpose: Verify that flush_cache behaves as expected with an empty + * Purpose: Verify that flush_cache behaves as expected with an empty * cache. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -3288,7 +3288,7 @@ static void check_flush_cache__empty_cache(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - herr_t result; + herr_t result; if(cache_ptr == NULL) { @@ -3354,22 +3354,22 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) } /* check_flush_cache__empty_cache() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__multi_entry() + * Function: check_flush_cache__multi_entry() * - * Purpose: Verify that flush_cache behaves as expected when the cache - * contains multiple elements. + * Purpose: Verify that flush_cache behaves as expected when the cache + * contains multiple elements. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/14/05 * * Modifications: * - * JRM -- 4/5/06 - * Added pinned entry tests. + * JRM -- 4/5/06 + * Added pinned entry tests. * *------------------------------------------------------------------------- */ @@ -4264,9 +4264,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 100, /* insert_flag = */ FALSE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ FALSE @@ -4277,10 +4277,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 75, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4291,11 +4291,11 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 25, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4306,12 +4306,12 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 50, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4322,13 +4322,13 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 10, /* insert_flag = */ FALSE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 4, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, + PICO_ENTRY_TYPE, + -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ FALSE @@ -4339,14 +4339,14 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 20, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 5, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 5, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1}, + PICO_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4357,15 +4357,15 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 30, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 6, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 6, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1}, + PICO_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4376,16 +4376,16 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 40, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 7, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 7, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1}, + PICO_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, 10, 20, 30, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ FALSE @@ -4410,9 +4410,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 100, /* insert_flag = */ FALSE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4423,10 +4423,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 75, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4437,11 +4437,11 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 25, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4452,12 +4452,12 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 50, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4468,9 +4468,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 10, /* insert_flag = */ FALSE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4481,10 +4481,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 20, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, - -1, -1, -1, -1 -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, + -1, -1, -1, -1 -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, -1, -1, -1 -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4495,11 +4495,11 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 30, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 2, - /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 2, + /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, 20, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4510,12 +4510,12 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 40, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 3, - /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - MONSTER_ENTRY_TYPE, - -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1}, + /* num_pins = */ 3, + /* pin_type[MAX_PINS] = */ {MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + MONSTER_ENTRY_TYPE, + -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {10, 20, 30, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4540,9 +4540,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 100, /* insert_flag = */ FALSE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4553,10 +4553,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 75, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4567,10 +4567,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 25, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4581,10 +4581,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 50, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4595,9 +4595,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 10, /* insert_flag = */ FALSE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4608,9 +4608,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 20, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4621,9 +4621,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 30, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4634,9 +4634,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 40, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4662,9 +4662,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 100, /* insert_flag = */ FALSE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4675,10 +4675,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 75, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4689,10 +4689,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 25, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4703,10 +4703,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 50, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4717,9 +4717,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 10, /* insert_flag = */ FALSE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4730,13 +4730,13 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 20, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 4, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, + PICO_ENTRY_TYPE, + -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4747,13 +4747,13 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 30, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 4, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + /* num_pins = */ 4, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, PICO_ENTRY_TYPE, - PICO_ENTRY_TYPE, - -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, + PICO_ENTRY_TYPE, + -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, 75, 25, 50, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4764,9 +4764,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 40, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ TRUE, /* expected_destroyed = */ TRUE @@ -4793,9 +4793,9 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 100, /* insert_flag = */ FALSE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 0, - /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 0, + /* pin_type[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {-1, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4806,10 +4806,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 75, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4820,10 +4820,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 25, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4834,10 +4834,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 50, /* insert_flag = */ TRUE, /* flags = */ H5C__NO_FLAGS_SET, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4848,10 +4848,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 10, /* insert_flag = */ FALSE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4862,10 +4862,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 20, /* insert_flag = */ FALSE, /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ TRUE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4876,10 +4876,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 30, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4890,10 +4890,10 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) /* entry_index = */ 40, /* insert_flag = */ TRUE, /* flags = */ H5C__SET_FLUSH_MARKER_FLAG, - /* num_pins = */ 1, - /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, - -1, -1, -1, -1, -1, -1, -1}, - /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, + /* num_pins = */ 1, + /* pin_type[MAX_PINS] = */ {PICO_ENTRY_TYPE, + -1, -1, -1, -1, -1, -1, -1}, + /* pin_idx[MAX_PINS] = */ {100, -1, -1, -1, -1, -1, -1, -1}, /* expected_deserialized = */ FALSE, /* expected_serialized = */ FALSE, /* expected_destroyed = */ TRUE @@ -4908,15 +4908,15 @@ check_flush_cache__multi_entry(H5F_t * file_ptr) } /* check_flush_cache__multi_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__multi_entry_test() + * Function: check_flush_cache__multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose: Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/13/05 * * Modifications: @@ -4933,9 +4933,9 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; + herr_t result; unsigned u; - size_t total_entry_size = 0; + size_t total_entry_size = 0; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -4943,7 +4943,7 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, /* This gets used a lot, so lets leave it in. */ HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n", - test_num); + test_num); #endif /* JRM */ if(cache_ptr == NULL) { @@ -5127,15 +5127,15 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, } /* check_flush_cache__multi_entry_test() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__pe_multi_entry_test() + * Function: check_flush_cache__pe_multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose: Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/5/06 * * Modifications: @@ -5152,10 +5152,10 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, { H5C_t *cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; + herr_t result; unsigned u; int j; - size_t total_entry_size = 0; + size_t total_entry_size = 0; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -5163,7 +5163,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, /* This is useful debugging code. Leave it in for now. */ HDfprintf(stdout, "check_flush_cache__pe_multi_entry_test: test %d\n", - test_num); + test_num); #endif /* JRM */ if(cache_ptr == NULL) { @@ -5201,8 +5201,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || (spec[u].entry_index > max_indices[spec[u].entry_type]) || - (spec[u].num_pins < 0) || - (spec[u].num_pins > MAX_PINS)) { + (spec[u].num_pins < 0) || + (spec[u].num_pins > MAX_PINS)) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -5231,14 +5231,14 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, total_entry_size += entry_sizes[spec[u].entry_type]; - for (j = 0; j < spec[u].num_pins; j++) - { + for (j = 0; j < spec[u].num_pins; j++) + { create_pinned_entry_dependency(file_ptr, - spec[u].entry_type, - spec[u].entry_index, - spec[u].pin_type[j], - spec[u].pin_idx[j]); - } + spec[u].entry_type, + spec[u].entry_index, + spec[u].pin_type[j], + spec[u].pin_idx[j]); + } u++; } @@ -5358,21 +5358,21 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, } /* check_flush_cache__pe_multi_entry_test() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_ops() + * Function: check_flush_cache__flush_ops() * - * Purpose: Run the flush ops cache tests. + * Purpose: Run the flush ops cache tests. * - * These are tests that test the cache's ability to handle - * the case in which the flush callback dirties, resizes, - * and/or moves entries. + * These are tests that test the cache's ability to handle + * the case in which the flush callback dirties, resizes, + * and/or moves entries. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/3/06 * * Modifications: @@ -5399,468 +5399,468 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) if(pass) /* test #1 */ { - /* start with a very simple test, in which there are two entries - * resident in cache, and the second entry dirties the first in - * the flush callback. No size changes, and no flush flags. - */ - int test_num = 1; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 2; - unsigned init_expected_index_len = 2; - size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 2; - size_t expected_index_size = 2 * PICO_ENTRY_SIZE; - struct fo_flush_cache_test_spec spec[2] = - { + /* start with a very simple test, in which there are two entries + * resident in cache, and the second entry dirties the first in + * the flush callback. No size changes, and no flush flags. + */ + int test_num = 1; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 2; + unsigned init_expected_index_len = 2; + size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 2; + size_t expected_index_size = 2 * PICO_ENTRY_SIZE; + struct fo_flush_cache_test_spec spec[2] = + { { /* entry_num = */ 0, /* entry_type = */ 0, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, { /* entry_num = */ 1, /* entry_type = */ 0, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #2 */ { - /* Same as test 1, only this time set the flush invalidate flag. - * Note that we must repeat all tests with the flush invalidate flag - * as this triggers a different set of code to execute the flush. - * - * Create two entries resident in cache, and have the second entry - * dirty the first in the flush callback. - */ - int test_num = 2; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 2; - unsigned init_expected_index_len = 2; - size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = 0; - struct fo_flush_cache_test_spec spec[2] = - { + /* Same as test 1, only this time set the flush invalidate flag. + * Note that we must repeat all tests with the flush invalidate flag + * as this triggers a different set of code to execute the flush. + * + * Create two entries resident in cache, and have the second entry + * dirty the first in the flush callback. + */ + int test_num = 2; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 2; + unsigned init_expected_index_len = 2; + size_t init_expected_index_size = 2 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = 0; + struct fo_flush_cache_test_spec spec[2] = + { { /* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, { /* entry_num = */ 1, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr*/ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr*/ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #3 */ { - /* Single entry test verifying that the cache can handle the case in - * which the call back function resizes the entry for which it has - * been called. - */ - int test_num = 3; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - unsigned expected_index_len = 1; - size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; - struct fo_flush_cache_test_spec spec[1] = - { + /* Single entry test verifying that the cache can handle the case in + * which the call back function resizes the entry for which it has + * been called. + */ + int test_num = 3; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; + unsigned expected_index_len = 1; + size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr:*/ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr:*/ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #4 */ { - /* Repeat test #4 with the flush invalidate flag. - * - * Single entry test verifying that the cache can handle the case in - * which the call back function resizes the entry for which it has - * been called. - */ - int test_num = 4; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; - unsigned expected_index_len = 0; - size_t expected_index_size = 0; - struct fo_flush_cache_test_spec spec[1] = - { + /* Repeat test #4 with the flush invalidate flag. + * + * Single entry test verifying that the cache can handle the case in + * which the call back function resizes the entry for which it has + * been called. + */ + int test_num = 4; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 4; + unsigned expected_index_len = 0; + size_t expected_index_size = 0; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #5 & #6 */ { - /* Single entry test verifying that the cache can handle the case in - * which the call back function first resizes and then moves the - * entry for which it has been called. - * - * Run this entry twice, as the first run moves the entry to its - * alternate address, and the second moves it back. + /* Single entry test verifying that the cache can handle the case in + * which the call back function first resizes and then moves the + * entry for which it has been called. + * + * Run this entry twice, as the first run moves the entry to its + * alternate address, and the second moves it back. * * 10/8/07 -- JRM * Added a resize operation to this test to satisfy the new * requiremnt that any resize of an entry on flush will always * be accompanied by a resize. Note that as a result, this * test becomes redundant with later tests. - */ - int test_num = 5; /* and 6 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 1; - size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; - struct fo_flush_cache_test_spec spec[1] = - { + */ + int test_num = 5; /* and 6 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 1; + size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the move to move the target entry back to its - * main address. The first test moved it to its alternate address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entry is moved forward in the slist. In the second - * it is moved backwards. - * - * Since there is only one entry in the cache, this doesn't really - * matter in this case. But we will do similar tests later with - * other entries in the cache. - */ - if(pass) { - - spec[0].flush_ops[1].flag = TRUE; - test_num = 6; + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the move to move the target entry back to its + * main address. The first test moved it to its alternate address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entry is moved forward in the slist. In the second + * it is moved backwards. + * + * Since there is only one entry in the cache, this doesn't really + * matter in this case. But we will do similar tests later with + * other entries in the cache. + */ + if(pass) { + + spec[0].flush_ops[1].flag = TRUE; + test_num = 6; check_flush_cache__flush_op_test(file_ptr, test_num, @@ -5871,118 +5871,118 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #7 & #8 */ { - /* Run tests 5 & 6 again, using the flush invalidate flag on the - * second test. - * - * Single entry test verifying that the cache can handle the case in - * which the call back function moves the entry for which it has - * been called. - * - * Run this entry twice, as the first run moves the entry to its - * alternate address, and the second moves it back. + /* Run tests 5 & 6 again, using the flush invalidate flag on the + * second test. + * + * Single entry test verifying that the cache can handle the case in + * which the call back function moves the entry for which it has + * been called. + * + * Run this entry twice, as the first run moves the entry to its + * alternate address, and the second moves it back. * * 10/8/07 -- JRM * Added a resize operation to this test to satisfy the new * requiremnt that any resize of an entry on flush will always * be accompanied by a resize. Note that as a result, this * test becomes redundant with later tests. - */ - int test_num = 7; /* and 8 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 1; - size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; - struct fo_flush_cache_test_spec spec[1] = - { + */ + int test_num = 7; /* and 8 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 1; + size_t expected_index_size = VARIABLE_ENTRY_SIZE / 2; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the move to move the target entry back to its - * main address. The first test moved it to its alternate address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entry is moved forward in the slist. In the second - * it is moved backwards. - * - * Since there is only one entry in the cache, this doesn't really - * matter in this case. But we will do similar tests later with - * other entries in the cache. - */ - - if(pass) { + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the move to move the target entry back to its + * main address. The first test moved it to its alternate address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entry is moved forward in the slist. In the second + * it is moved backwards. + * + * Since there is only one entry in the cache, this doesn't really + * matter in this case. But we will do similar tests later with + * other entries in the cache. + */ + + if(pass) { test_num = 8; - flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - expected_index_len = 0; - expected_index_size = 0; - spec[0].flush_ops[1].flag = TRUE; - spec[0].expected_destroyed = TRUE; + flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + expected_index_len = 0; + expected_index_size = 0; + spec[0].flush_ops[1].flag = TRUE; + spec[0].expected_destroyed = TRUE; check_flush_cache__flush_op_test(file_ptr, test_num, @@ -5993,104 +5993,104 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #9 & #10 */ { - /* Single entry test verifying that the cache can handle the case in - * which the call back function both resizes and moves the entry - * for which it has been called. - * - * Again, we run this entry twice, as the first run moves the entry + /* Single entry test verifying that the cache can handle the case in + * which the call back function both resizes and moves the entry + * for which it has been called. + * + * Again, we run this entry twice, as the first run moves the entry * to its alternate address, and the second moves it back. - */ - int test_num = 9; /* and 10 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - unsigned expected_index_len = 1; - size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; - struct fo_flush_cache_test_spec spec[1] = - { + */ + int test_num = 9; /* and 10 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; + unsigned expected_index_len = 1; + size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the move to move the target entry back to its - * main address. The first test moved it to its alternate address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entry is moved forward in the slist. In the second - * it is moved backwards. - * - * Since there is only one entry in the cache, this doesn't really - * matter in this case. But we will do similar tests later with - * other entries in the cache. - */ - if(pass) { - - spec[0].flush_ops[1].flag = TRUE; - test_num = 10; + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the move to move the target entry back to its + * main address. The first test moved it to its alternate address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entry is moved forward in the slist. In the second + * it is moved backwards. + * + * Since there is only one entry in the cache, this doesn't really + * matter in this case. But we will do similar tests later with + * other entries in the cache. + */ + if(pass) { + + spec[0].flush_ops[1].flag = TRUE; + test_num = 10; check_flush_cache__flush_op_test(file_ptr, test_num, @@ -6101,111 +6101,111 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #11 & #12 */ { - /* Repeat the previous test with the flush invalidate flag on the - * second test. - * - * Single entry test verifying that the cache can handle the case in - * which the call back function both resizes and moves the entry - * for which it has been called. - * - * Again, we run this entry twice, as the first run moves the entry to its - * alternate address, and the second moves it back. - */ - int test_num = 11; /* and 12 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; - unsigned expected_index_len = 1; - size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; - struct fo_flush_cache_test_spec spec[1] = - { + /* Repeat the previous test with the flush invalidate flag on the + * second test. + * + * Single entry test verifying that the cache can handle the case in + * which the call back function both resizes and moves the entry + * for which it has been called. + * + * Again, we run this entry twice, as the first run moves the entry to its + * alternate address, and the second moves it back. + */ + int test_num = 11; /* and 12 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = VARIABLE_ENTRY_SIZE / 2; + unsigned expected_index_len = 1; + size_t expected_index_size = VARIABLE_ENTRY_SIZE / 4; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the move to move the target entry back to its - * main address. The first test moved it to its alternate address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entry is moved forward in the slist. In the second - * it is moved backwards. - * - * Since there is only one entry in the cache, this doesn't really - * matter in this case. But we will do similar tests later with - * other entries in the cache. - */ - if(pass) { + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the move to move the target entry back to its + * main address. The first test moved it to its alternate address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entry is moved forward in the slist. In the second + * it is moved backwards. + * + * Since there is only one entry in the cache, this doesn't really + * matter in this case. But we will do similar tests later with + * other entries in the cache. + */ + if(pass) { test_num = 12; - flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - expected_index_len = 0; - expected_index_size = 0; - spec[0].flush_ops[1].flag = TRUE; - spec[0].expected_destroyed = TRUE; + flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + expected_index_len = 0; + expected_index_size = 0; + spec[0].flush_ops[1].flag = TRUE; + spec[0].expected_destroyed = TRUE; check_flush_cache__flush_op_test(file_ptr, @@ -6217,500 +6217,500 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #13 */ { - /* Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * dirties two entries that are not in cache. No size - * changes. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 13; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 3; - size_t expected_index_size = 3 * PICO_ENTRY_SIZE; - struct fo_flush_cache_test_spec spec[1] = - { + /* Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * dirties two entries that are not in cache. No size + * changes. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 13; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 3; + size_t expected_index_size = 3 * PICO_ENTRY_SIZE; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ 0, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ PICO_ENTRY_SIZE, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ PICO_ENTRY_SIZE, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ PICO_ENTRY_SIZE, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ PICO_ENTRY_SIZE, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #14 */ { - /* Repeat previous test with the flush invalidate flag. - * - * Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * dirties two entries that are not in cache. No size - * changes. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 14; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = (size_t)0; - struct fo_flush_cache_test_spec spec[1] = - { + /* Repeat previous test with the flush invalidate flag. + * + * Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * dirties two entries that are not in cache. No size + * changes. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 14; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = (size_t)0; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ 0, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 2, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 2, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, 0, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ PICO_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ PICO_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ PICO_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ PICO_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ PICO_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #15 */ { - /* Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * resizes and dirties two entries that are not in cache. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 15; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 3; - size_t expected_index_size = VARIABLE_ENTRY_SIZE + - (VARIABLE_ENTRY_SIZE / 4) + - (VARIABLE_ENTRY_SIZE / 2); - struct fo_flush_cache_test_spec spec[1] = - { + /* Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * resizes and dirties two entries that are not in cache. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 15; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 3; + size_t expected_index_size = VARIABLE_ENTRY_SIZE + + (VARIABLE_ENTRY_SIZE / 4) + + (VARIABLE_ENTRY_SIZE / 2); + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #16 */ { - /* Repeat previous test with the flush invalidate flag. - * - * Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * resizes and dirties two entries that are not in cache. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 16; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = (size_t)0; - struct fo_flush_cache_test_spec spec[1] = - { + /* Repeat previous test with the flush invalidate flag. + * + * Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * resizes and dirties two entries that are not in cache. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 16; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = (size_t)0; + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #17 & #18 */ { - /* Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * resizes, dirties, and moves two entries that are not in cache. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 17; /* and 18 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 3; - size_t expected_index_size = VARIABLE_ENTRY_SIZE + - (VARIABLE_ENTRY_SIZE / 4) + - (VARIABLE_ENTRY_SIZE / 2); - struct fo_flush_cache_test_spec spec[1] = - { + /* Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * resizes, dirties, and moves two entries that are not in cache. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 17; /* and 18 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 3; + size_t expected_index_size = VARIABLE_ENTRY_SIZE + + (VARIABLE_ENTRY_SIZE / 4) + + (VARIABLE_ENTRY_SIZE / 2); + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the moves to move the target entries back to - * their main address. The first test moved them to their alternate - * address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entries are moved forward in the slist. In the second - * they are moved backwards. - */ - if(pass) { - - test_num = 18; - spec[0].flush_ops[2].flag = TRUE; - spec[0].flush_ops[5].flag = TRUE; - checks[0].at_main_addr = TRUE; - checks[1].at_main_addr = TRUE; + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the moves to move the target entries back to + * their main address. The first test moved them to their alternate + * address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entries are moved forward in the slist. In the second + * they are moved backwards. + */ + if(pass) { + + test_num = 18; + spec[0].flush_ops[2].flag = TRUE; + spec[0].flush_ops[5].flag = TRUE; + checks[0].at_main_addr = TRUE; + checks[1].at_main_addr = TRUE; check_flush_cache__flush_op_test(file_ptr, test_num, @@ -6721,131 +6721,131 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #19 & #20 */ { - /* Repeat the above test with the flush invalidate flag on the - * second test. - * - * Test the ability of the cache to handle the case in which - * the flush function of an entry that is resident in cache - * resizes, dirties, and moves two entries that are not in cache. - * - * At present, I am assured that this case will never occur, but - * lets make sure we can handle it regardless. - */ - int test_num = 19; /* and 20 */ - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 1; - unsigned init_expected_index_len = 1; - size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 3; - size_t expected_index_size = VARIABLE_ENTRY_SIZE + - (VARIABLE_ENTRY_SIZE / 4) + - (VARIABLE_ENTRY_SIZE / 2); - struct fo_flush_cache_test_spec spec[1] = - { + /* Repeat the above test with the flush invalidate flag on the + * second test. + * + * Test the ability of the cache to handle the case in which + * the flush function of an entry that is resident in cache + * resizes, dirties, and moves two entries that are not in cache. + * + * At present, I am assured that this case will never occur, but + * lets make sure we can handle it regardless. + */ + int test_num = 19; /* and 20 */ + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 1; + unsigned init_expected_index_len = 1; + size_t init_expected_index_size = 1 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 3; + size_t expected_index_size = VARIABLE_ENTRY_SIZE + + (VARIABLE_ENTRY_SIZE / 4) + + (VARIABLE_ENTRY_SIZE / 2); + struct fo_flush_cache_test_spec spec[1] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 2; - struct fo_flush_entry_check checks[2] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 2; + struct fo_flush_entry_check checks[2] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - - /* this change forces the moves to move the target entries back to - * their main address. The first test moved them to their alternate - * address. - * - * Note that these two tests are not the same, as in the first test, - * the moved entries are moved forward in the slist. In the second - * they are moved backwards. - */ - if(pass) { - - test_num = 20; - flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - expected_index_len = 0; - expected_index_size = (size_t)0; + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + + /* this change forces the moves to move the target entries back to + * their main address. The first test moved them to their alternate + * address. + * + * Note that these two tests are not the same, as in the first test, + * the moved entries are moved forward in the slist. In the second + * they are moved backwards. + */ + if(pass) { + + test_num = 20; + flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + expected_index_len = 0; + expected_index_size = (size_t)0; spec[0].expected_destroyed = TRUE; - spec[0].flush_ops[2].flag = TRUE; - spec[0].flush_ops[5].flag = TRUE; - checks[0].at_main_addr = TRUE; - checks[0].in_cache = FALSE; - checks[0].expected_destroyed = TRUE; - checks[1].at_main_addr = TRUE; - checks[1].in_cache = FALSE; - checks[1].expected_destroyed = TRUE; + spec[0].flush_ops[2].flag = TRUE; + spec[0].flush_ops[5].flag = TRUE; + checks[0].at_main_addr = TRUE; + checks[0].in_cache = FALSE; + checks[0].expected_destroyed = TRUE; + checks[1].at_main_addr = TRUE; + checks[1].in_cache = FALSE; + checks[1].expected_destroyed = TRUE; check_flush_cache__flush_op_test(file_ptr, test_num, @@ -6856,757 +6856,757 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) init_expected_index_size, expected_index_len, expected_index_size, - check_size, - checks); - } + check_size, + checks); + } } if(pass) /* test #21 */ { - /* Now mix things up a bit. - * - * Load several entries, two of which have flush functions that - * resize, dirty, and move two entries that are not in the - * cache. Mark only one of these entries, and then flush the - * cache with the flush marked entries flag. - * - * This is the only test in which we test the - * H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since - * we test the two features extensively by themselves, so - * it should be sufficient to verify that they play together - * as expected. - */ - int test_num = 21; - unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; - int spec_size = 4; - unsigned init_expected_index_len = 4; - size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE); - unsigned expected_index_len = 6; - size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + - (VARIABLE_ENTRY_SIZE / 4) + - (VARIABLE_ENTRY_SIZE / 2) + - (2 * PICO_ENTRY_SIZE); - struct fo_flush_cache_test_spec spec[4] = - { + /* Now mix things up a bit. + * + * Load several entries, two of which have flush functions that + * resize, dirty, and move two entries that are not in the + * cache. Mark only one of these entries, and then flush the + * cache with the flush marked entries flag. + * + * This is the only test in which we test the + * H5C__FLUSH_MARKED_ENTRIES_FLAG. The hope is that since + * we test the two features extensively by themselves, so + * it should be sufficient to verify that they play together + * as expected. + */ + int test_num = 21; + unsigned int flush_flags = H5C__FLUSH_MARKED_ENTRIES_FLAG; + int spec_size = 4; + unsigned init_expected_index_len = 4; + size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (2 * PICO_ENTRY_SIZE); + unsigned expected_index_len = 6; + size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + + (VARIABLE_ENTRY_SIZE / 4) + + (VARIABLE_ENTRY_SIZE / 2) + + (2 * PICO_ENTRY_SIZE); + struct fo_flush_cache_test_spec spec[4] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 11, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 11, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG | H5C__SET_FLUSH_MARKER_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 3, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 4; - struct fo_flush_entry_check checks[4] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ TRUE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ TRUE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 10, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 12, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 4; + struct fo_flush_entry_check checks[4] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ TRUE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ TRUE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 10, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 12, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - reset_entries(); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + reset_entries(); } if(pass) /* test #22 */ { - /* Mix things up some more. - * - * Load lots of entries, some of which have flush functions that - * resize, dirty, and move two entries that are not in the - * cache. - * - * Also load entries that have flush ops on entries that are in - * cache. - */ - int test_num = 22; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 6; - unsigned init_expected_index_len = 6; - size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - unsigned expected_index_len = 10; - size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + - (2 * (VARIABLE_ENTRY_SIZE / 4)) + - (2 * (VARIABLE_ENTRY_SIZE / 2)) + - (4 * PICO_ENTRY_SIZE); - struct fo_flush_cache_test_spec spec[6] = - { + /* Mix things up some more. + * + * Load lots of entries, some of which have flush functions that + * resize, dirty, and move two entries that are not in the + * cache. + * + * Also load entries that have flush ops on entries that are in + * cache. + */ + int test_num = 22; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 6; + unsigned init_expected_index_len = 6; + size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); + unsigned expected_index_len = 10; + size_t expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + + (2 * (VARIABLE_ENTRY_SIZE / 4)) + + (2 * (VARIABLE_ENTRY_SIZE / 2)) + + (4 * PICO_ENTRY_SIZE); + struct fo_flush_cache_test_spec spec[6] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 11, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 11, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 3, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 4, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, { /* entry_num = */ 5, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 4; - struct fo_flush_entry_check checks[4] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 10, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 12, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 4; + struct fo_flush_entry_check checks[4] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 10, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 3, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 12, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - reset_entries(); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + reset_entries(); } if(pass) /* test #23 */ { - /* Repeat test #23 with the flush invalidate flag set. - * - * Mix things up some more. - * - * Load lots of entries, some of which have flush functions that - * resize, dirty, and move two entries that are not in the - * cache. - * - * Also load entries that have flush ops on entries that are in - * cache. - */ - int test_num = 23; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 6; - unsigned init_expected_index_len = 6; - size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); - unsigned expected_index_len = 0; - size_t expected_index_size = 0; - struct fo_flush_cache_test_spec spec[6] = - { + /* Repeat test #23 with the flush invalidate flag set. + * + * Mix things up some more. + * + * Load lots of entries, some of which have flush functions that + * resize, dirty, and move two entries that are not in the + * cache. + * + * Also load entries that have flush ops on entries that are in + * cache. + */ + int test_num = 23; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 6; + unsigned init_expected_index_len = 6; + size_t init_expected_index_size = (2 * VARIABLE_ENTRY_SIZE) + (4 * PICO_ENTRY_SIZE); + unsigned expected_index_len = 0; + size_t expected_index_size = 0; + struct fo_flush_cache_test_spec spec[6] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 0, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 11, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 6, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 11, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 6, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 10, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 10, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 12, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 12, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, { /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 0, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 0, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, { /* entry_num = */ 3, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 1, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ TRUE }, { /* entry_num = */ 4, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 10, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 10, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, { /* entry_num = */ 5, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 20, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 20, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,0,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 4; - struct fo_flush_entry_check checks[4] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 0, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 10, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 3, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 12, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - } - }; + }; + int check_size = 4; + struct fo_flush_entry_check checks[4] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 0, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 10, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 4, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 3, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 12, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); - reset_entries(); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); + reset_entries(); } /* So much for tests involving only flush operations. @@ -7615,1512 +7615,1512 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) */ if(pass) /* test #24 */ { - /* Pico entries 50 and 150 pin pico entry 100, and also dirty - * pico entry 100 on flush. - */ - int test_num = 24; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 3; - unsigned init_expected_index_len = 3; - size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 3; - size_t expected_index_size = 3 * PICO_ENTRY_SIZE; - struct fo_flush_cache_test_spec spec[3] = - { + /* Pico entries 50 and 150 pin pico entry 100, and also dirty + * pico entry 100 on flush. + */ + int test_num = 24; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 3; + unsigned init_expected_index_len = 3; + size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 3; + size_t expected_index_size = 3 * PICO_ENTRY_SIZE; + struct fo_flush_cache_test_spec spec[3] = + { { /* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 1, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 1, - /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 50, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 1, + /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 150, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 1, - /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, - { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 150, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 1, + /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, + { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #25 */ { - /* Repeat the previous test with the flush invalidate flag. - * - * Pico entries 50 and 150 pin pico entry 100, and also dirty - * pico entry 100 on flush. - */ - int test_num = 25; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 3; - unsigned init_expected_index_len = 3; - size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = (size_t)0; - struct fo_flush_cache_test_spec spec[3] = - { + /* Repeat the previous test with the flush invalidate flag. + * + * Pico entries 50 and 150 pin pico entry 100, and also dirty + * pico entry 100 on flush. + */ + int test_num = 25; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 3; + unsigned init_expected_index_len = 3; + size_t init_expected_index_size = 3 * PICO_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = (size_t)0; + struct fo_flush_cache_test_spec spec[3] = + { { /* entry_num = */ 0, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 1, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 50, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 1, - /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 50, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 1, + /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 2, /* entry_type = */ PICO_ENTRY_TYPE, - /* entry_index = */ 150, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 1, - /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 1, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, - { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 150, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 1, + /* pin_type = */ {PICO_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 1, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, PICO_ENTRY_TYPE,100,FALSE,0, NULL }, + { FLUSH_OP__DIRTY, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ (size_t)0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ (size_t)0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); } if(pass) /* test #26 */ { - /* This one is complex. - * - * In the following overvies table, VET stands for - * VARIABLE_ENTRY_TYPE. - * - * In trying to follow what happens when we flush the - * set of entries constructed below, recall that each - * flush operation is executed the first time the - * entry is flushed, and then not executed again. - * This may be a weakness in the tests, but that - * is the way it is for now. - * - * After thinking about it for a while, I'm not sure that - * the interaction between pins and flush operations needs - * all that much testing, as the two are essentially - * orthoginal. Thus this is a bit of a smoke check to - * verify that we get the expected results. - * - * (VET, 100) initially not resident in cache - * - * (VET, 200) initially clean and resident in cache - * - * (VET, 300) initially not resident in cache - * - * (VET, 2100) initially clean and resident in cache - * - * (VET, 2200) initially not resident in cache - * - * (VET, 2300) initially clean and resident in cache - * - * (VET, 1000) initially clean, and in cache - * dirties (VET, 100) - * resizes (VET, 200) - * dirty (VET, 300) -- dirty first to bring into cache. - * moves (VET, 300) - * - * (VET, 2000) initially clean, and in cache - * dirties (VET, 2100) - * resizes (VET, 2200) - * moves (VET, 2300) - * - * (VET, 350) initially clean, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 350) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 450) initially dirty, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * moves (VET, 450) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 650) initially clean, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 650) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 750) initially dirty, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 750) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 500) initially dirty, and in cache - * dirties (VET, 350) - * dirties (VET, 450) - * dirties (VET, 650) - * dirties (VET, 750) - */ - int test_num = 26; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 10; - unsigned init_expected_index_len = 10; - size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 13; - size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE; - struct fo_flush_cache_test_spec spec[10] = - { + /* This one is complex. + * + * In the following overvies table, VET stands for + * VARIABLE_ENTRY_TYPE. + * + * In trying to follow what happens when we flush the + * set of entries constructed below, recall that each + * flush operation is executed the first time the + * entry is flushed, and then not executed again. + * This may be a weakness in the tests, but that + * is the way it is for now. + * + * After thinking about it for a while, I'm not sure that + * the interaction between pins and flush operations needs + * all that much testing, as the two are essentially + * orthoginal. Thus this is a bit of a smoke check to + * verify that we get the expected results. + * + * (VET, 100) initially not resident in cache + * + * (VET, 200) initially clean and resident in cache + * + * (VET, 300) initially not resident in cache + * + * (VET, 2100) initially clean and resident in cache + * + * (VET, 2200) initially not resident in cache + * + * (VET, 2300) initially clean and resident in cache + * + * (VET, 1000) initially clean, and in cache + * dirties (VET, 100) + * resizes (VET, 200) + * dirty (VET, 300) -- dirty first to bring into cache. + * moves (VET, 300) + * + * (VET, 2000) initially clean, and in cache + * dirties (VET, 2100) + * resizes (VET, 2200) + * moves (VET, 2300) + * + * (VET, 350) initially clean, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 350) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 450) initially dirty, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * moves (VET, 450) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 650) initially clean, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 650) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 750) initially dirty, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 750) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 500) initially dirty, and in cache + * dirties (VET, 350) + * dirties (VET, 450) + * dirties (VET, 650) + * dirties (VET, 750) + */ + int test_num = 26; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 10; + unsigned init_expected_index_len = 10; + size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 13; + size_t expected_index_size = 9 * VARIABLE_ENTRY_SIZE; + struct fo_flush_cache_test_spec spec[10] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 200, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 2100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 2, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2300, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 2300, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 3, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1000, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 1000, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 4, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2000, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 2000, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 5, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 350, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 350, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 6, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 450, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 450, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 7, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 650, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 650, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 8, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 750, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 750, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 9, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 500, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 3; - struct fo_flush_entry_check checks[3] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ TRUE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - }, - { - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2200, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ TRUE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE - } - - }; + }; + int check_size = 3; + struct fo_flush_entry_check checks[3] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 100, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 300, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ TRUE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + }, + { + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2200, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ TRUE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE + } + + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); - reset_entries(); + reset_entries(); } if(pass) /* test #27 */ { - /* Repeat test #26 with the flush invalidate flag. - * - * In the following overview table, VET stands for - * VARIABLE_ENTRY_TYPE. - * - * In trying to follow what happens when we flush the - * set of entries constructed below, recall that each - * flush operation is executed the first time the - * entry is flushed, and then not executed again. - * This may be a weakness in the tests, but that - * is the way it is for now. - * - * After thinking about it for a while, I'm not sure that - * the interaction between pins and flush operations needs - * all that much testing, as the two are essentially - * orthoginal. The big thing is to verify that flushes of - * pinned entries with flush ops result in the expected - * updates of the cache. - * - * Thus this is a bit of a smoke check to * verify that we - * get the expected results. - * - * (VET, 100) initially not resident in cache - * - * (VET, 200) initially clean and resident in cache - * - * (VET, 300) initially not resident in cache - * - * (VET, 2100) initially clean and resident in cache - * - * (VET, 2200) initially not resident in cache - * - * (VET, 2300) initially clean and resident in cache - * - * (VET, 1000) initially clean, and in cache - * dirties (VET, 100) - * resizes (VET, 200) - * dirty (VET, 300) -- dirty first to bring into cache. - * moves (VET, 300) - * - * (VET, 2000) initially clean, and in cache - * dirties (VET, 2100) - * resizes (VET, 2200) - * moves (VET, 2300) - * - * (VET, 350) initially clean, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 350) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 450) initially dirty, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * moves (VET, 450) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 650) initially clean, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 650) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 750) initially dirty, and in cache - * pins (VET, 1000) - * dirties (VET, 1000) - * resizes (VET, 750) - * pins (VET, 2000) - * dirties (VET, 2000) - * - * (VET, 500) initially dirty, and in cache - * dirties (VET, 350) - * dirties (VET, 450) - * dirties (VET, 650) - * dirties (VET, 750) - */ - int test_num = 27; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 10; - unsigned init_expected_index_len = 10; - size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = (size_t)0; - struct fo_flush_cache_test_spec spec[10] = - { + /* Repeat test #26 with the flush invalidate flag. + * + * In the following overview table, VET stands for + * VARIABLE_ENTRY_TYPE. + * + * In trying to follow what happens when we flush the + * set of entries constructed below, recall that each + * flush operation is executed the first time the + * entry is flushed, and then not executed again. + * This may be a weakness in the tests, but that + * is the way it is for now. + * + * After thinking about it for a while, I'm not sure that + * the interaction between pins and flush operations needs + * all that much testing, as the two are essentially + * orthoginal. The big thing is to verify that flushes of + * pinned entries with flush ops result in the expected + * updates of the cache. + * + * Thus this is a bit of a smoke check to * verify that we + * get the expected results. + * + * (VET, 100) initially not resident in cache + * + * (VET, 200) initially clean and resident in cache + * + * (VET, 300) initially not resident in cache + * + * (VET, 2100) initially clean and resident in cache + * + * (VET, 2200) initially not resident in cache + * + * (VET, 2300) initially clean and resident in cache + * + * (VET, 1000) initially clean, and in cache + * dirties (VET, 100) + * resizes (VET, 200) + * dirty (VET, 300) -- dirty first to bring into cache. + * moves (VET, 300) + * + * (VET, 2000) initially clean, and in cache + * dirties (VET, 2100) + * resizes (VET, 2200) + * moves (VET, 2300) + * + * (VET, 350) initially clean, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 350) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 450) initially dirty, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * moves (VET, 450) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 650) initially clean, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 650) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 750) initially dirty, and in cache + * pins (VET, 1000) + * dirties (VET, 1000) + * resizes (VET, 750) + * pins (VET, 2000) + * dirties (VET, 2000) + * + * (VET, 500) initially dirty, and in cache + * dirties (VET, 350) + * dirties (VET, 450) + * dirties (VET, 650) + * dirties (VET, 750) + */ + int test_num = 27; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 10; + unsigned init_expected_index_len = 10; + size_t init_expected_index_size = 10 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = (size_t)0; + struct fo_flush_cache_test_spec spec[10] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 200, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 2100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 2, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2300, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 2300, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 3, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 1000, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 1000, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 4, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2000, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 2000, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 2200, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 2300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 5, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 350, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 350, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 350, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 6, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 450, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 450, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 450, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 7, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 650, - /* insert_flag = */ TRUE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 650, + /* insert_flag = */ TRUE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 650, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 8, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 750, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 2, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 750, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 2, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {1000, 2000, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 1000, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 2000, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 750, FALSE, VARIABLE_ENTRY_SIZE / 4, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 9, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 4, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, - { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 500, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 4, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 350, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 450, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 650, FALSE, 0, NULL }, + { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 750, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 3; - struct fo_flush_entry_check checks[3] = - { - { - /* entry_num = */ 0, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 1, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* expected_size = */ VARIABLE_ENTRY_SIZE, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - }, - { - /* entry_num = */ 2, - /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 2200, - /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, - /* in_cache = */ FALSE, - /* at_main_addr = */ TRUE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE - } - - }; + }; + int check_size = 3; + struct fo_flush_entry_check checks[3] = + { + { + /* entry_num = */ 0, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 100, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 1, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 300, + /* expected_size = */ VARIABLE_ENTRY_SIZE, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + }, + { + /* entry_num = */ 2, + /* entry_type = */ VARIABLE_ENTRY_TYPE, + /* entry_index = */ 2200, + /* expected_size = */ VARIABLE_ENTRY_SIZE / 2, + /* in_cache = */ FALSE, + /* at_main_addr = */ TRUE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE + } + + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); - reset_entries(); + reset_entries(); } if(pass) /* test #28 */ { - /* Test the expected fheap case, in which an entry dirties - * and resizes itself, and dirties an entry which it has - * pinned. - */ - int test_num = 28; - unsigned int flush_flags = H5C__NO_FLAGS_SET; - int spec_size = 5; - unsigned init_expected_index_len = 5; - size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 5; - size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; - struct fo_flush_cache_test_spec spec[5] = - { + /* Test the expected fheap case, in which an entry dirties + * and resizes itself, and dirties an entry which it has + * pinned. + */ + int test_num = 28; + unsigned int flush_flags = H5C__NO_FLAGS_SET; + int spec_size = 5; + unsigned init_expected_index_len = 5; + size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 5; + size_t expected_index_size = 4 * VARIABLE_ENTRY_SIZE; + struct fo_flush_cache_test_spec spec[5] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 200, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 2, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 300, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 3, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 400, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 400, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE }, - { + { /* entry_num = */ 4, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ FALSE + /* entry_index = */ 500, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ FALSE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ 0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ 0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); - reset_entries(); + reset_entries(); } if(pass) /* test #29 */ { - /* Repeat test #28 with the flush invalidate flag. - * - * Test the expected fheap case, in which an entry dirties - * and resizes itself, and dirties an entry which it has - * pinned. - */ - int test_num = 29; - unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; - int spec_size = 5; - unsigned init_expected_index_len = 5; - size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; - unsigned expected_index_len = 0; - size_t expected_index_size = 0; - struct fo_flush_cache_test_spec spec[5] = - { + /* Repeat test #28 with the flush invalidate flag. + * + * Test the expected fheap case, in which an entry dirties + * and resizes itself, and dirties an entry which it has + * pinned. + */ + int test_num = 29; + unsigned int flush_flags = H5C__FLUSH_INVALIDATE_FLAG; + int spec_size = 5; + unsigned init_expected_index_len = 5; + size_t init_expected_index_size = 3 * VARIABLE_ENTRY_SIZE; + unsigned expected_index_len = 0; + size_t expected_index_size = 0; + struct fo_flush_cache_test_spec spec[5] = + { { /* entry_num = */ 0, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 100, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 100, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 1, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 200, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 2, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 200, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 2, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 200, FALSE, VARIABLE_ENTRY_SIZE, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 200, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 2, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 300, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 300, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {400, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 400, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 300, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 300, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 3, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 400, - /* insert_flag = */ FALSE, - /* flags = */ H5C__NO_FLAGS_SET, - /* resize_flag = */ FALSE, - /* new_size = */ 0, - /* num_pins = */ 0, - /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 0, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 400, + /* insert_flag = */ FALSE, + /* flags = */ H5C__NO_FLAGS_SET, + /* resize_flag = */ FALSE, + /* new_size = */ 0, + /* num_pins = */ 0, + /* pin_type = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {0, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 0, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE }, - { + { /* entry_num = */ 4, /* entry_type = */ VARIABLE_ENTRY_TYPE, - /* entry_index = */ 500, - /* insert_flag = */ FALSE, - /* flags = */ H5C__DIRTIED_FLAG, - /* resize_flag = */ TRUE, - /* new_size = */ VARIABLE_ENTRY_SIZE / 4, - /* num_pins = */ 1, - /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, - /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, - /* num_flush_ops = */ 3, - /* flush_ops = */ - /* op_code: type: idx: flag: size: order_ptr: */ - { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, - { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, - { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, - { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, - /* expected_deserialized = */ TRUE, - /* expected_serialized = */ TRUE, - /* expected_destroyed = */ TRUE + /* entry_index = */ 500, + /* insert_flag = */ FALSE, + /* flags = */ H5C__DIRTIED_FLAG, + /* resize_flag = */ TRUE, + /* new_size = */ VARIABLE_ENTRY_SIZE / 4, + /* num_pins = */ 1, + /* pin_type = */ {VARIABLE_ENTRY_TYPE, 0, 0, 0, 0, 0, 0, 0}, + /* pin_idx = */ {100, 0, 0, 0, 0, 0, 0, 0}, + /* num_flush_ops = */ 3, + /* flush_ops = */ + /* op_code: type: idx: flag: size: order_ptr: */ + { { FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 100, FALSE, 0, NULL }, + { FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 500, FALSE, VARIABLE_ENTRY_SIZE / 2, NULL }, + { FLUSH_OP__MOVE, VARIABLE_ENTRY_TYPE, 500, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL }, + { FLUSH_OP__NO_OP, 0, 0, FALSE, 0, NULL } }, + /* expected_deserialized = */ TRUE, + /* expected_serialized = */ TRUE, + /* expected_destroyed = */ TRUE } - }; - int check_size = 0; - struct fo_flush_entry_check checks[1] = - { - { - /* entry_num = */ 0, - /* entry_type = */ 0, - /* entry_index = */ 0, - /* expected_size = */ 0, - /* in_cache = */ FALSE, - /* at_main_addr = */ FALSE, - /* is_dirty = */ FALSE, - /* is_protected = */ FALSE, - /* is_pinned = */ FALSE, - /* expected_deserialized = */ FALSE, - /* expected_serialized = */ FALSE, - /* expected_destroyed = */ FALSE - } - }; + }; + int check_size = 0; + struct fo_flush_entry_check checks[1] = + { + { + /* entry_num = */ 0, + /* entry_type = */ 0, + /* entry_index = */ 0, + /* expected_size = */ 0, + /* in_cache = */ FALSE, + /* at_main_addr = */ FALSE, + /* is_dirty = */ FALSE, + /* is_protected = */ FALSE, + /* is_pinned = */ FALSE, + /* expected_deserialized = */ FALSE, + /* expected_serialized = */ FALSE, + /* expected_destroyed = */ FALSE + } + }; check_flush_cache__flush_op_test(file_ptr, test_num, flush_flags, spec_size, spec, - init_expected_index_len, - init_expected_index_size, - expected_index_len, - expected_index_size, - check_size, - checks); + init_expected_index_len, + init_expected_index_size, + expected_index_len, + expected_index_size, + check_size, + checks); - reset_entries(); + reset_entries(); } /* finally finish up with the flush ops eviction test */ @@ -9130,16 +9130,16 @@ check_flush_cache__flush_ops(H5F_t * file_ptr) } /* check_flush_cache__flush_ops() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_op_test() + * Function: check_flush_cache__flush_op_test() * - * Purpose: Run a flush op flush cache test. Of the nature of - * flush operations, this is a multi-entry test. + * Purpose: Run a flush op flush cache test. Of the nature of + * flush operations, this is a multi-entry test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/3/06 * * Modifications: @@ -9153,16 +9153,16 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, unsigned int flush_flags, int spec_size, const struct fo_flush_cache_test_spec spec[], - unsigned init_expected_index_len, - size_t init_expected_index_size, - unsigned expected_index_len, - size_t expected_index_size, - int check_size, - struct fo_flush_entry_check check[]) + unsigned init_expected_index_len, + size_t init_expected_index_size, + unsigned expected_index_len, + size_t expected_index_size, + int check_size, + struct fo_flush_entry_check check[]) { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; + herr_t result; int i; int j; test_entry_t * base_addr; @@ -9170,7 +9170,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, #if 0 /* This is useful debugging code -- lets keep it around. */ HDfprintf(stdout, "check_flush_cache__flush_op_test: test %d\n", - test_num); + test_num); #endif if(cache_ptr == NULL) { @@ -9208,10 +9208,10 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) || (spec[i].entry_index > max_indices[spec[i].entry_type]) || - (spec[i].num_pins < 0) || - (spec[i].num_pins > MAX_PINS) || - (spec[i].num_flush_ops < 0) || - (spec[i].num_flush_ops > MAX_FLUSH_OPS)) { + (spec[i].num_pins < 0) || + (spec[i].num_pins > MAX_PINS) || + (spec[i].num_flush_ops < 0) || + (spec[i].num_flush_ops > MAX_FLUSH_OPS)) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9234,22 +9234,22 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, /* Check for nonsense values if hbool_t is an integral * type instead of a real Boolean. */ - ((check[i].in_cache != TRUE) && - (check[i].in_cache != FALSE)) || - ((check[i].at_main_addr != TRUE) && - (check[i].at_main_addr != FALSE)) || - ((check[i].is_dirty != TRUE) && - (check[i].is_dirty != FALSE)) || - ((check[i].is_protected != TRUE) && - (check[i].is_protected != FALSE)) || - ((check[i].is_pinned != TRUE) && - (check[i].is_pinned != FALSE)) || - ((check[i].expected_deserialized != TRUE) && - (check[i].expected_deserialized != FALSE)) || - ((check[i].expected_serialized != TRUE) && - (check[i].expected_serialized != FALSE)) || - ((check[i].expected_destroyed != TRUE) && - (check[i].expected_destroyed != FALSE)) || + ((check[i].in_cache != TRUE) && + (check[i].in_cache != FALSE)) || + ((check[i].at_main_addr != TRUE) && + (check[i].at_main_addr != FALSE)) || + ((check[i].is_dirty != TRUE) && + (check[i].is_dirty != FALSE)) || + ((check[i].is_protected != TRUE) && + (check[i].is_protected != FALSE)) || + ((check[i].is_pinned != TRUE) && + (check[i].is_pinned != FALSE)) || + ((check[i].expected_deserialized != TRUE) && + (check[i].expected_deserialized != FALSE)) || + ((check[i].expected_serialized != TRUE) && + (check[i].expected_serialized != FALSE)) || + ((check[i].expected_destroyed != TRUE) && + (check[i].expected_destroyed != FALSE)) || #endif /* H5_HAVE_STDBOOL_H */ (check[i].expected_size <= (size_t)0) ) { @@ -9277,32 +9277,32 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, if(spec[i].resize_flag) resize_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].new_size, TRUE); + spec[i].new_size, TRUE); unprotect_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, - spec[i].flags); + spec[i].flags); } - for (j = 0; j < spec[i].num_pins; j++) - { + for (j = 0; j < spec[i].num_pins; j++) + { create_pinned_entry_dependency(file_ptr, - spec[i].entry_type, - spec[i].entry_index, - spec[i].pin_type[j], - spec[i].pin_idx[j]); - } - - for (j = 0; j < spec[i].num_flush_ops; j++) - { - add_flush_op(spec[i].entry_type, - spec[i].entry_index, - spec[i].flush_ops[j].op_code, - spec[i].flush_ops[j].type, - spec[i].flush_ops[j].idx, - spec[i].flush_ops[j].flag, - spec[i].flush_ops[j].size, + spec[i].entry_type, + spec[i].entry_index, + spec[i].pin_type[j], + spec[i].pin_idx[j]); + } + + for (j = 0; j < spec[i].num_flush_ops; j++) + { + add_flush_op(spec[i].entry_type, + spec[i].entry_index, + spec[i].flush_ops[j].op_code, + spec[i].flush_ops[j].type, + spec[i].flush_ops[j].idx, + spec[i].flush_ops[j].flag, + spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); - } + } i++; } @@ -9356,8 +9356,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, (int)(entry_ptr->destroyed), (int)(spec[i].expected_destroyed)); - HDfprintf(stdout, "entry_ptr->header.is_dirty = %d\n", - (int)(entry_ptr->header.is_dirty)); + HDfprintf(stdout, "entry_ptr->header.is_dirty = %d\n", + (int)(entry_ptr->header.is_dirty)); #endif pass = FALSE; @@ -9374,113 +9374,113 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, i = 0; while(pass && (i < check_size)) { - if(check[i].in_cache != entry_in_cache(cache_ptr, - check[i].entry_type, - check[i].entry_index)) { + if(check[i].in_cache != entry_in_cache(cache_ptr, + check[i].entry_type, + check[i].entry_index)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Check1 failed on entry %d after flush op test #%d.", i, test_num); failure_mssg = msg; - } + } base_addr = entries[check[i].entry_type]; entry_ptr = &(base_addr[check[i].entry_index]); - if((entry_ptr->size != check[i].expected_size) || - ((!entry_ptr->header.destroy_in_progress) && - (check[i].in_cache) && - (entry_ptr->header.size != check[i].expected_size)) || - (entry_ptr->at_main_addr != check[i].at_main_addr) || - (entry_ptr->is_dirty != check[i].is_dirty) || - (entry_ptr->header.is_dirty != check[i].is_dirty) || - (entry_ptr->is_protected != check[i].is_protected) || - (entry_ptr->header.is_protected != check[i].is_protected) || + if((entry_ptr->size != check[i].expected_size) || + ((!entry_ptr->header.destroy_in_progress) && + (check[i].in_cache) && + (entry_ptr->header.size != check[i].expected_size)) || + (entry_ptr->at_main_addr != check[i].at_main_addr) || + (entry_ptr->is_dirty != check[i].is_dirty) || + (entry_ptr->header.is_dirty != check[i].is_dirty) || + (entry_ptr->is_protected != check[i].is_protected) || + (entry_ptr->header.is_protected != check[i].is_protected) || (entry_ptr->is_pinned != check[i].is_pinned) || (entry_ptr->header.is_pinned != check[i].is_pinned) || - (entry_ptr->deserialized != check[i].expected_deserialized) || - (entry_ptr->serialized != check[i].expected_serialized) || - (entry_ptr->destroyed != check[i].expected_destroyed)) { + (entry_ptr->deserialized != check[i].expected_deserialized) || + (entry_ptr->serialized != check[i].expected_serialized) || + (entry_ptr->destroyed != check[i].expected_destroyed)) { #if 0 /* This is useful debugging code. Lets keep it around for a while. */ - if(entry_ptr->size != check[i].expected_size) { - HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", - (int)(entry_ptr->size), - (int)(check[i].expected_size)); - } - if((!entry_ptr->header.destroy_in_progress) && - (check[i].in_cache) && + if(entry_ptr->size != check[i].expected_size) { + HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n", + (int)(entry_ptr->size), + (int)(check[i].expected_size)); + } + if((!entry_ptr->header.destroy_in_progress) && + (check[i].in_cache) && (entry_ptr->header.size != check[i].expected_size)) { HDfprintf(stdout, "(!destroy in progress and in cache and size (expected) = %d (%d).\n", (int)(entry_ptr->header.size), - (int)(check[i].expected_size)); - } - if(entry_ptr->at_main_addr != check[i].at_main_addr) { - HDfprintf(stdout, "(%d,%d) at main addr (expected) = %d (%d).\n", - (int)(check[i].entry_type), - (int)(check[i].entry_index), + (int)(check[i].expected_size)); + } + if(entry_ptr->at_main_addr != check[i].at_main_addr) { + HDfprintf(stdout, "(%d,%d) at main addr (expected) = %d (%d).\n", + (int)(check[i].entry_type), + (int)(check[i].entry_index), (int)(entry_ptr->at_main_addr), - (int)(check[i].at_main_addr)); + (int)(check[i].at_main_addr)); } - if(entry_ptr->is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->header.is_dirty != check[i].is_dirty) { - HDfprintf(stdout, "entry_ptr->header.is_dirty (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_dirty), - (int)(check[i].is_dirty)); - } - if(entry_ptr->is_protected != check[i].is_protected) { + if(entry_ptr->is_dirty != check[i].is_dirty) { + HDfprintf(stdout, "entry_ptr->is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->is_dirty), + (int)(check[i].is_dirty)); + } + if(entry_ptr->header.is_dirty != check[i].is_dirty) { + HDfprintf(stdout, "entry_ptr->header.is_dirty (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_dirty), + (int)(check[i].is_dirty)); + } + if(entry_ptr->is_protected != check[i].is_protected) { HDfprintf(stdout, "entry_ptr->is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->header.is_protected != check[i].is_protected) { + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + if(entry_ptr->header.is_protected != check[i].is_protected) { HDfprintf(stdout, "entry_ptr->header.is_protected (expected) = %d (%d).\n", - (int)(entry_ptr->is_protected), - (int)(check[i].is_protected)); - } - if(entry_ptr->is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->header.is_pinned != check[i].is_pinned) { - HDfprintf(stdout, "entry_ptr->header.is_pinned (expected) = %d (%d).\n", - (int)(entry_ptr->header.is_pinned), - (int)(check[i].is_pinned)); - } - if(entry_ptr->deserialized != - check[i].expected_deserialized) { - HDfprintf(stdout, - "entry_ptr->deserialized (expected) = %d (%d).\n", - (int)(entry_ptr->deserialized), - (int)(check[i].expected_deserialized)); - } - if(entry_ptr->serialized != check[i].expected_serialized) { - HDfprintf(stdout, - "entry_ptr->serialized (expected) = %d (%d).\n", - (int)(entry_ptr->serialized), - (int)(check[i].expected_serialized)); - } - if(entry_ptr->destroyed != check[i].expected_destroyed) { - HDfprintf(stdout, "entry_ptr->destroyed (expected) = %d (%d).\n", - (int)(entry_ptr->destroyed), - (int)(check[i].expected_destroyed)); - } + (int)(entry_ptr->is_protected), + (int)(check[i].is_protected)); + } + if(entry_ptr->is_pinned != check[i].is_pinned) { + HDfprintf(stdout, "entry_ptr->is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->is_pinned), + (int)(check[i].is_pinned)); + } + if(entry_ptr->header.is_pinned != check[i].is_pinned) { + HDfprintf(stdout, "entry_ptr->header.is_pinned (expected) = %d (%d).\n", + (int)(entry_ptr->header.is_pinned), + (int)(check[i].is_pinned)); + } + if(entry_ptr->deserialized != + check[i].expected_deserialized) { + HDfprintf(stdout, + "entry_ptr->deserialized (expected) = %d (%d).\n", + (int)(entry_ptr->deserialized), + (int)(check[i].expected_deserialized)); + } + if(entry_ptr->serialized != check[i].expected_serialized) { + HDfprintf(stdout, + "entry_ptr->serialized (expected) = %d (%d).\n", + (int)(entry_ptr->serialized), + (int)(check[i].expected_serialized)); + } + if(entry_ptr->destroyed != check[i].expected_destroyed) { + HDfprintf(stdout, "entry_ptr->destroyed (expected) = %d (%d).\n", + (int)(entry_ptr->destroyed), + (int)(check[i].expected_destroyed)); + } #endif pass = FALSE; HDsnprintf(msg, (size_t)128, "Check2 failed on entry %d after flush op test #%d.", i, test_num); failure_mssg = msg; - } - i++; + } + i++; } } @@ -9526,8 +9526,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } else if((cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->clean_index_size != 0) || - (cache_ptr->dirty_index_size != 0)) { + (cache_ptr->clean_index_size != 0) || + (cache_ptr->dirty_index_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -9544,7 +9544,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); - entry_ptr->size = entry_sizes[spec[i].entry_type]; + entry_ptr->size = entry_sizes[spec[i].entry_type]; entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; @@ -9559,7 +9559,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, base_addr = entries[check[i].entry_type]; entry_ptr = &(base_addr[check[i].entry_index]); - entry_ptr->size = entry_sizes[check[i].entry_type]; + entry_ptr->size = entry_sizes[check[i].entry_type]; entry_ptr->deserialized = FALSE; entry_ptr->serialized = FALSE; @@ -9572,26 +9572,26 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, } /* check_flush_cache__flush_op_test() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__flush_op_eviction_test() + * Function: check_flush_cache__flush_op_eviction_test() * - * Purpose: Verify that flush operations work as expected when an + * Purpose: Verify that flush operations work as expected when an * entry is evicted. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/3/06 * * Modifications: * - * Updated test for minor changes in the behaviour - * of H5C__flush_single_entry(). + * Updated test for minor changes in the behaviour + * of H5C__flush_single_entry(). * - * JRM -- 2/16/15 + * JRM -- 2/16/15 * *------------------------------------------------------------------------- */ @@ -9600,11 +9600,11 @@ static void check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - int num_variable_entries = 10; - int num_monster_entries = 31; - int num_large_entries = 0; - herr_t result; + int i; + int num_variable_entries = 10; + int num_monster_entries = 31; + int num_large_entries = 0; + herr_t result; test_entry_t * entry_ptr; test_entry_t * base_addr; struct expected_entry_status expected[10 + 31 + 14] = @@ -9614,63 +9614,63 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { VARIABLE_ENTRY_TYPE, 0, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 4, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 6, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 8, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { VARIABLE_ENTRY_TYPE, 9, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 0, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 1, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 2, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 3, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 4, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 5, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 6, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 7, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 8, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 9, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 10, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 11, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 12, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { VARIABLE_ENTRY_TYPE, 0, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 1, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 2, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 3, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 4, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 5, VARIABLE_ENTRY_SIZE/4, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 6, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 7, VARIABLE_ENTRY_SIZE/2, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 8, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { VARIABLE_ENTRY_TYPE, 9, VARIABLE_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 0, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 1, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 2, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 3, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 4, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 5, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 6, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 7, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 8, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 9, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 10, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 11, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 12, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { LARGE_ENTRY_TYPE, 13, LARGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; if(pass) { @@ -9689,15 +9689,15 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = - "unexpected cache config at start of flush op eviction test."; + pass = FALSE; + failure_mssg = + "unexpected cache config at start of flush op eviction test."; } else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } @@ -9710,112 +9710,112 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) * other entries into the cache until the cache is full. At * that point, load yet more entries into the cache, and see * if the flush operations are performed as expected. - * - * To make things a bit more interesting, we also include a - * couple of pins. + * + * To make things a bit more interesting, we also include a + * couple of pins. */ - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ - H5C_stats__reset(cache_ptr); + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ + H5C_stats__reset(cache_ptr); - /* load a few entries with pin relationships and flush ops. - * Start by just loading the entries. - */ + /* load a few entries with pin relationships and flush ops. + * Start by just loading the entries. + */ - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, (VARIABLE_ENTRY_SIZE / 4), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, (VARIABLE_ENTRY_SIZE / 4), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, (VARIABLE_ENTRY_SIZE / 4), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, (VARIABLE_ENTRY_SIZE / 4), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 5, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, (VARIABLE_ENTRY_SIZE / 2), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 6, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, (VARIABLE_ENTRY_SIZE / 2), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 7, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 8, H5C__NO_FLAGS_SET); - protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); - if((cache_ptr->index_len != 10) || + if((cache_ptr->index_len != 10) || (cache_ptr->index_size != (4 * (VARIABLE_ENTRY_SIZE / 4)) + - (2 * (VARIABLE_ENTRY_SIZE / 2)) + - (4 * VARIABLE_ENTRY_SIZE))) { - - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 1."; - } - } - - if(pass) { - - /* Now set up the pinning relationships: - * - * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5) - * (VET, 9) is pinned by (VET, 5), and (VET, 7) - */ - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, - VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, - VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, - VARIABLE_ENTRY_TYPE, 0); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, - VARIABLE_ENTRY_TYPE, 9); - create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7, - VARIABLE_ENTRY_TYPE, 9); - - /* Next, set up the flush operations: - * - * Briefly, (VET, 1) dirties (VET, 0) - * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE - * - * (VET, 3) dirties (VET, 0) - * resizes (VET, 0) to VARIABLE_ENTRY_SIZE - * moves (VET, 0) to its alternate address - * - * (VET, 5) dirties (VET, 0) - * resizes itself to VARIABLE_ENTRY_SIZE / 2 + (2 * (VARIABLE_ENTRY_SIZE / 2)) + + (4 * VARIABLE_ENTRY_SIZE))) { + + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 1."; + } + } + + if(pass) { + + /* Now set up the pinning relationships: + * + * Briefly, (VET, 0) is pinned by (VET, 1), (VET, 3), and (VET, 5) + * (VET, 9) is pinned by (VET, 5), and (VET, 7) + */ + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 1, + VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 3, + VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, + VARIABLE_ENTRY_TYPE, 0); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 5, + VARIABLE_ENTRY_TYPE, 9); + create_pinned_entry_dependency(file_ptr, VARIABLE_ENTRY_TYPE, 7, + VARIABLE_ENTRY_TYPE, 9); + + /* Next, set up the flush operations: + * + * Briefly, (VET, 1) dirties (VET, 0) + * resizes (VET, 0) to 3/4 VARIABLE_ENTRY_SIZE + * + * (VET, 3) dirties (VET, 0) + * resizes (VET, 0) to VARIABLE_ENTRY_SIZE + * moves (VET, 0) to its alternate address + * + * (VET, 5) dirties (VET, 0) + * resizes itself to VARIABLE_ENTRY_SIZE / 2 * * (VET, 7) dirties (VET, 9) - * - * (VET, 9) dirties (VET, 8) - */ + * + * (VET, 9) dirties (VET, 8) + */ add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL); add_flush_op(VARIABLE_ENTRY_TYPE, 1, FLUSH_OP__RESIZE, VARIABLE_ENTRY_TYPE, 0, TRUE, - 3 * VARIABLE_ENTRY_SIZE / 4, NULL); + 3 * VARIABLE_ENTRY_SIZE / 4, NULL); add_flush_op(VARIABLE_ENTRY_TYPE, 3, FLUSH_OP__DIRTY, VARIABLE_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL); @@ -9838,648 +9838,648 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if(pass) { - /* to summarize, at present the following variable size entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 2.5 KB Y Y - - - * - * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0), - * resize (VET, 0) to 7.5 KB - * - * (VET, 2) Y 10 KB N N - - - * - * - * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0) - * resize (VET, 0) to 10 KB - * move (VET, 0) to its alternate address - * - * (VET, 4) Y 10 KB N N - - - * - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N N - dirty (VET, 8) - * - * Recall that in this test bed, flush operations are excuted the - * first time the associated entry is flushed, and are then - * deleted. - */ + /* to summarize, at present the following variable size entries + * are in cache with the following characteristics: + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 2.5 KB Y Y - - + * + * (VET, 1) Y 2.5 KB Y N 0 dirty (VET, 0), + * resize (VET, 0) to 7.5 KB + * + * (VET, 2) Y 10 KB N N - - + * + * + * (VET, 3) Y 2.5 KB N N 0 dirty (VET, 0) + * resize (VET, 0) to 10 KB + * move (VET, 0) to its alternate address + * + * (VET, 4) Y 10 KB N N - - + * + * + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB + * + * (VET, 6) Y 5 KB Y N - - + * + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) Y 10 KB N N - dirty (VET, 8) + * + * Recall that in this test bed, flush operations are excuted the + * first time the associated entry is flushed, and are then + * deleted. + */ /* Now fill up the cache with other, unrelated entries */ - for (i = 0; i < 31; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 0; i < 31; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < 1; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 0; i < 1; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - /* The cache should now be exactly full */ - if((cache_ptr->index_len != 42) || + /* The cache should now be exactly full */ + if((cache_ptr->index_len != 42) || (cache_ptr->index_size != 2 * 1024 * 1024) || - (cache_ptr->index_size != ((4 * VARIABLE_ENTRY_SIZE / 4) + - (2 * VARIABLE_ENTRY_SIZE / 2) + - (4 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (1 * LARGE_ENTRY_SIZE)))) { + (cache_ptr->index_size != ((4 * VARIABLE_ENTRY_SIZE / 4) + + (2 * VARIABLE_ENTRY_SIZE / 2) + + (4 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (1 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 2."; + failure_mssg = "unexpected size/len in flush op eviction test 2."; - } else { + } else { - /* verify the expected status of all entries we have loaded to date: */ + /* verify the expected status of all entries we have loaded to date: */ num_large_entries = 1; - verify_entry_status(cache_ptr, - 0, - (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } - } - - if(pass) { - - /* Now load a large entry. This should result in the eviction - * of (VET,2), and the increase in the size of (VET, 0) from .25 - * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE. - * - * The following table illustrates the intended state of affairs - * after the eviction: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 7.5 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0) - * resize (VET, 0) to 10 KB - * move (VET, 0) to its alternate address - * - * (VET, 4) Y 10 KB N N - - - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4; - expected[1].is_dirty = FALSE; - expected[1].serialized = TRUE; - expected[2].in_cache = FALSE; - expected[2].destroyed = TRUE; + verify_entry_status(cache_ptr, + 0, + (num_variable_entries + num_monster_entries + num_large_entries), + expected); + } + } + + if(pass) { + + /* Now load a large entry. This should result in the eviction + * of (VET,2), and the increase in the size of (VET, 0) from .25 + * VARIABLE_ENTRY_SIZE to .75 VARIABLE_ENTRY_SIZE. + * + * The following table illustrates the intended state of affairs + * after the eviction: + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 7.5 KB Y Y - - + * + * (VET, 1) Y 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) Y 2.5 KB Y N 0 dirty (VET, 0) + * resize (VET, 0) to 10 KB + * move (VET, 0) to its alternate address + * + * (VET, 4) Y 10 KB N N - - + * + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB + * + * (VET, 6) Y 5 KB Y N - - + * + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + expected[0].size = 3 * VARIABLE_ENTRY_SIZE / 4; + expected[1].is_dirty = FALSE; + expected[1].serialized = TRUE; + expected[2].in_cache = FALSE; + expected[2].destroyed = TRUE; num_large_entries = 2; - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__DIRTIED_FLAG); - if((cache_ptr->index_len != 42) || + if((cache_ptr->index_len != 42) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (VARIABLE_ENTRY_SIZE) + - (VARIABLE_ENTRY_SIZE / 2) + - (LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) + - (3 * VARIABLE_ENTRY_SIZE / 4) + - (2 * VARIABLE_ENTRY_SIZE / 2) + - (3 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (2 * LARGE_ENTRY_SIZE)))) { - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 3."; - } - - /* verify entry status */ - verify_entry_status(cache_ptr, - 1, + (VARIABLE_ENTRY_SIZE) + + (VARIABLE_ENTRY_SIZE / 2) + + (LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((1 * (3 * VARIABLE_ENTRY_SIZE / 4)) + + (3 * VARIABLE_ENTRY_SIZE / 4) + + (2 * VARIABLE_ENTRY_SIZE / 2) + + (3 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (2 * LARGE_ENTRY_SIZE)))) { + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 3."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, + 1, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } - - if(pass) { - - /* Now load another large entry. This should result in the eviction - * of (VET, 4), the increase in the size of (VET, 0) from .75 - * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming - * of (VET, 0) to its alternate address. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) - * resize (VET, 5) to 5 KB - * - * (VET, 6) Y 5 KB Y N - - - * - * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - expected[0].size = VARIABLE_ENTRY_SIZE; - expected[0].at_main_addr = FALSE; - expected[3].is_dirty = FALSE; - expected[3].serialized = TRUE; - expected[4].in_cache = FALSE; - expected[4].destroyed = TRUE; + expected); + } + + if(pass) { + + /* Now load another large entry. This should result in the eviction + * of (VET, 4), the increase in the size of (VET, 0) from .75 + * VARIABLE_ENTRY_SIZE to 1.0 VARIABLE_ENTRY_SIZE, and the renaming + * of (VET, 0) to its alternate address. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y Y - - + * + * (VET, 1) Y 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) Y 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) Y 2.5 KB Y N 0, 9 dirty (VET, 0) + * resize (VET, 5) to 5 KB + * + * (VET, 6) Y 5 KB Y N - - + * + * (VET, 7) Y 5 KB Y N 9 dirty (VET, 9) + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + expected[0].size = VARIABLE_ENTRY_SIZE; + expected[0].at_main_addr = FALSE; + expected[3].is_dirty = FALSE; + expected[3].serialized = TRUE; + expected[4].in_cache = FALSE; + expected[4].destroyed = TRUE; num_large_entries = 3; - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 2); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 2, H5C__DIRTIED_FLAG); - if((cache_ptr->index_len != 42) || + if((cache_ptr->index_len != 42) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (2 * VARIABLE_ENTRY_SIZE) + - (3 * VARIABLE_ENTRY_SIZE / 4) + - (2 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((3 * VARIABLE_ENTRY_SIZE / 4) + - (2 * VARIABLE_ENTRY_SIZE / 2) + - (3 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (3 * LARGE_ENTRY_SIZE)))) { - - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 4."; - } - - /* verify entry status */ - verify_entry_status(cache_ptr, - 2, + (2 * VARIABLE_ENTRY_SIZE) + + (3 * VARIABLE_ENTRY_SIZE / 4) + + (2 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((3 * VARIABLE_ENTRY_SIZE / 4) + + (2 * VARIABLE_ENTRY_SIZE / 2) + + (3 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (3 * LARGE_ENTRY_SIZE)))) { + + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 4."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, + 2, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { - /* load two more large entries. This should result in (VET, 5) being - * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to - * VARIABLE_ENTRY_SIZE. - * - * As a result of this size increase, the cache will have to look - * for another entry to evict. After flushing (VET, 6) and (VET, 7), - * it should evict (VET, 8), yielding the needed memory and dirtying + /* load two more large entries. This should result in (VET, 5) being + * flushed, and increasing its size from 1/4 VARIABLE_ENTRY_SIZE to + * VARIABLE_ENTRY_SIZE. + * + * As a result of this size increase, the cache will have to look + * for another entry to evict. After flushing (VET, 6) and (VET, 7), + * it should evict (VET, 8), yielding the needed memory and dirtying * (VET, 9). - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y Y - - - * - * (VET, 1) Y 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) Y 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) Y 5 KB N N 0, 9 - - * - * (VET, 6) Y 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - - expected[5].size = VARIABLE_ENTRY_SIZE / 2; - expected[5].is_dirty = FALSE; - expected[5].serialized = TRUE; - expected[6].is_dirty = FALSE; - expected[6].serialized = TRUE; - expected[7].is_dirty = FALSE; - expected[7].serialized = TRUE; - expected[8].in_cache = FALSE; - expected[8].destroyed = TRUE; - expected[9].is_dirty = TRUE; + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y Y - - + * + * (VET, 1) Y 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) Y 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) Y 5 KB N N 0, 9 - + * + * (VET, 6) Y 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + + expected[5].size = VARIABLE_ENTRY_SIZE / 2; + expected[5].is_dirty = FALSE; + expected[5].serialized = TRUE; + expected[6].is_dirty = FALSE; + expected[6].serialized = TRUE; + expected[7].is_dirty = FALSE; + expected[7].serialized = TRUE; + expected[8].in_cache = FALSE; + expected[8].destroyed = TRUE; + expected[9].is_dirty = TRUE; num_large_entries = 5; - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__DIRTIED_FLAG); - protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, LARGE_ENTRY_TYPE, 4); + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 4, H5C__DIRTIED_FLAG); /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (3 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + - (3 * VARIABLE_ENTRY_SIZE / 4) + - (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) + - (3 * VARIABLE_ENTRY_SIZE / 2) + - (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (5 * LARGE_ENTRY_SIZE)))) { - - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 5."; - } - - /* verify entry status */ - verify_entry_status(cache_ptr, - 3, + (3 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + + (3 * VARIABLE_ENTRY_SIZE / 4) + + (4 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) + + (3 * VARIABLE_ENTRY_SIZE / 2) + + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (5 * LARGE_ENTRY_SIZE)))) { + + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 5."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, + 3, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { /* now touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to bring all the VARIABLE_ENTRY_TYPE entries to the - * end of the LRU list. - * - * Note that we don't have to worry about (VET, 0) and (VET, 9) - * as they are pinned and thus not in the LRU list to begin with. - */ - for (i = 0; i < 31; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + * cache to bring all the VARIABLE_ENTRY_TYPE entries to the + * end of the LRU list. + * + * Note that we don't have to worry about (VET, 0) and (VET, 9) + * as they are pinned and thus not in the LRU list to begin with. + */ + for (i = 0; i < 31; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < 5; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 0; i < 5; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (3 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + - (3 * VARIABLE_ENTRY_SIZE / 4) + - (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) + - (3 * VARIABLE_ENTRY_SIZE / 2) + - (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (5 * LARGE_ENTRY_SIZE)))) { - - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 6."; - } - - /* verify entry status */ - verify_entry_status(cache_ptr, - 4, + (3 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + + (3 * VARIABLE_ENTRY_SIZE / 4) + + (4 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 4) + + (3 * VARIABLE_ENTRY_SIZE / 2) + + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (5 * LARGE_ENTRY_SIZE)))) { + + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 6."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, + 4, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { - /* Now load three more large entries. This should result - * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the + /* Now load three more large entries. This should result + * in the evictions of (VET, 1), (VET, 3), and (VET, 5), and the * unpinning of (VET, 0) - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) Y 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - - expected[0].is_pinned = FALSE; - expected[1].in_cache = FALSE; - expected[1].destroyed = TRUE; - expected[3].in_cache = FALSE; - expected[3].destroyed = TRUE; - expected[5].in_cache = FALSE; - expected[5].destroyed = TRUE; + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) Y 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + + expected[0].is_pinned = FALSE; + expected[1].in_cache = FALSE; + expected[1].destroyed = TRUE; + expected[3].in_cache = FALSE; + expected[3].destroyed = TRUE; + expected[5].in_cache = FALSE; + expected[5].destroyed = TRUE; num_large_entries = 8; - for (i = 5; i < 8; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 5; i < 8; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (4 * VARIABLE_ENTRY_SIZE) + - (1 * VARIABLE_ENTRY_SIZE / 4) + - (3 * VARIABLE_ENTRY_SIZE / 4) + - (7 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) + - (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (8 * LARGE_ENTRY_SIZE)))) { - - pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 7."; - } - - /* verify entry status */ - verify_entry_status(cache_ptr, - 5, + (4 * VARIABLE_ENTRY_SIZE) + + (1 * VARIABLE_ENTRY_SIZE / 4) + + (3 * VARIABLE_ENTRY_SIZE / 4) + + (7 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE / 2) + + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (8 * LARGE_ENTRY_SIZE)))) { + + pass = FALSE; + failure_mssg = "unexpected size/len in flush op eviction test 7."; + } + + /* verify entry status */ + verify_entry_status(cache_ptr, + 5, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } - - if(pass) { - - /* load another large entry. (VET, 6) should be evicted. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) Y 5 KB N N 9 - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB N Y - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - - expected[6].in_cache = FALSE; - expected[6].destroyed = TRUE; + expected); + } + + if(pass) { + + /* load another large entry. (VET, 6) should be evicted. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) Y 5 KB N N 9 - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB N Y - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + + expected[6].in_cache = FALSE; + expected[6].destroyed = TRUE; num_large_entries = 9; - for (i = 8; i < 9; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 8; i < 9; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (3 * VARIABLE_ENTRY_SIZE) - - (VARIABLE_ENTRY_SIZE / 2) + - (8 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) + - (2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (9 * LARGE_ENTRY_SIZE)))) { + (3 * VARIABLE_ENTRY_SIZE) - + (VARIABLE_ENTRY_SIZE / 2) + + (8 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE / 2) + + (2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (9 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 8."; - } + failure_mssg = "unexpected size/len in flush op eviction test 8."; + } - /* verify entry status */ - verify_entry_status(cache_ptr, - 6, + /* verify entry status */ + verify_entry_status(cache_ptr, + 6, (num_variable_entries + num_monster_entries + num_large_entries), - expected); - } - - if(pass) { - - /* Load another large entry. - * - * (VET, 7) should be evicted, and (VET, 9) should be unpinned. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) Y 10 KB Y N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) N 5 KB N N - - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) Y 10 KB Y N - dirty (VET, 8) - * - * Start by updating the expected table for the expected changes in entry status: - */ - - expected[7].in_cache = FALSE; - expected[7].destroyed = TRUE; - expected[9].is_pinned = FALSE; + expected); + } + + if(pass) { + + /* Load another large entry. + * + * (VET, 7) should be evicted, and (VET, 9) should be unpinned. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) Y 10 KB Y N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) Y 10 KB Y N - dirty (VET, 8) + * + * Start by updating the expected table for the expected changes in entry status: + */ + + expected[7].in_cache = FALSE; + expected[7].destroyed = TRUE; + expected[9].is_pinned = FALSE; num_large_entries = 10; - for (i = 9; i < 10; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 9; i < 10; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (4 * VARIABLE_ENTRY_SIZE) + - (9 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (10 * LARGE_ENTRY_SIZE)))) { + (4 * VARIABLE_ENTRY_SIZE) + + (9 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (10 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 9."; - } + failure_mssg = "unexpected size/len in flush op eviction test 9."; + } - /* verify entry status */ - verify_entry_status(cache_ptr, - 7, + /* verify entry status */ + verify_entry_status(cache_ptr, + 7, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to bring all the VARIABLE_ENTRY_TYPE entries to the - * end of the LRU list. - * - * Both (VET, 0) and (VET, 7) have been unpinned, so they are - * now in the LRU list. - */ - for (i = 0; i < 31; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + * cache to bring all the VARIABLE_ENTRY_TYPE entries to the + * end of the LRU list. + * + * Both (VET, 0) and (VET, 7) have been unpinned, so they are + * now in the LRU list. + */ + for (i = 0; i < 31; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < 10; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 0; i < 10; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 43) || + if((cache_ptr->index_len != 43) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (4 * VARIABLE_ENTRY_SIZE) + - (9 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (10 * LARGE_ENTRY_SIZE)))) { + (4 * VARIABLE_ENTRY_SIZE) + + (9 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((2 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (10 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 10."; - } + failure_mssg = "unexpected size/len in flush op eviction test 10."; + } - /* verify entry status */ - verify_entry_status(cache_ptr, - 8, + /* verify entry status */ + verify_entry_status(cache_ptr, + 8, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { - /* load two more large entries. Things get a bit complicated here, - * so I'll go through the operation step by step. + /* load two more large entries. Things get a bit complicated here, + * so I'll go through the operation step by step. * * Initially, the cache has 4 KB of empty space, so the first entry - * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect() - * without causing any evictions. + * (LET, 10) is loaded via calls to H5C_protect() H5C_unprotect() + * without causing any evictions. * * However, this is not the case for the call of H5C_protect() on - * (LET, 11). + * (LET, 11). * * Before inserting (LET, 11), H5C_protect(LET, 11) must try to - * free up at least 4 KB of space. To do this, it starts scanning - * up the LRU list to find entries to evict. + * free up at least 4 KB of space. To do this, it starts scanning + * up the LRU list to find entries to evict. * * (VET, 0) is at the bottom of the LRU list, and thus is the first - * entry considered. However, it is dirty, so it flushed to disk, + * entry considered. However, it is dirty, so it flushed to disk, * moved to the top of the LRU list, and marked clean. * * (VET, 9) is the next entry on the bottom of the LRU list. It is - * dirty too, calls its serialize callback function to construct an - * on disk image of the entry, and moves it to the top of the LRU + * dirty too, calls its serialize callback function to construct an + * on disk image of the entry, and moves it to the top of the LRU * list after the serialize callback returns. * - * However, (VET 9)'s serialize function needs to modify (VET, 8), + * However, (VET 9)'s serialize function needs to modify (VET, 8), * which is currently not in cache. Thus it calls H5C_protect(VET, 8) - * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and - * then attempts to evict entries to make space for it. + * to gain access to it. H5C_protect(VET, 8) loads (VET, 8), and + * then attempts to evict entries to make space for it. * * However, H5C_make_space_in_cache() now exits without taking * any action on re-entrant calls. Thus H5C_protect(VET, 8) simply * loads the entry into the cache -- resulting in a cache that is - * 10 KB oversize. The subsequent unprotect puts (VET, 8) at the + * 10 KB oversize. The subsequent unprotect puts (VET, 8) at the * head of the LRU and marks it dirty. * - * After (VET, 9) is serialized, it is flushed, and moved to the + * After (VET, 9) is serialized, it is flushed, and moved to the * head of the LRU. * - * At this point, the H5C_make_space_in_cache() call made by + * At this point, the H5C_make_space_in_cache() call made by * H5C_protect(LET, 11) now has 14 KB of space to make. * * The next entries on the LRU are (MET, 0) thru (MET, 30), - * (LET, 0) thru (LET, 10), and (VET, 8) -- all of which are dirty, + * (LET, 0) thru (LET, 10), and (VET, 8) -- all of which are dirty, * and are therefore flushed and moved to the head of the LRU list. * * The next entry on the bottom of the LRU list is (VET, 0), which - * is clean, and is therefore evicted, leaving H5C_make_space_in_cache() + * is clean, and is therefore evicted, leaving H5C_make_space_in_cache() * with 4 KB of space to create. * - * This space is sufficient, so H5C_protect(VET, 8) inserts - * (VET, 8) into the cache's index, marks it as protected, and - * returns to the serialize function for (VET, 9). + * This space is sufficient, so H5C_protect(VET, 8) inserts + * (VET, 8) into the cache's index, marks it as protected, and + * returns to the serialize function for (VET, 9). * * When the serialize function for (VET, 9) is done with (VET, 8), it * calls H5C_unprotect(VET, 8), which markes (VET, 8) as dirty and @@ -10489,101 +10489,101 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) * evicted -- leaving 6 KB of free space after (LET, 11) is inserted * into the cache. * - * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then - * returns as well. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) N 10 KB N N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) N 5 KB N N - - - * - * (VET, 8) Y 10 KB N N - - - * - * (VET, 9) N 10 KB N N - - - * - * Start by updating the expected table for the expected changes in - * entry status: - * - * Note that we reset the loaded, flushed, and destroyed - * fields of (VET,8) so we can track what is happening. - */ - base_addr = entries[VARIABLE_ENTRY_TYPE]; - entry_ptr = &(base_addr[8]); - entry_ptr->deserialized = FALSE; - entry_ptr->deserialized = FALSE; - entry_ptr->destroyed = FALSE; - - expected[0].in_cache = FALSE; - expected[0].is_dirty = FALSE; - expected[0].serialized = TRUE; - expected[0].destroyed = TRUE; - expected[8].in_cache = TRUE; - expected[8].is_dirty = FALSE; - expected[8].deserialized = TRUE; - expected[8].serialized = TRUE; - expected[8].destroyed = FALSE; - expected[9].in_cache = FALSE; - expected[9].is_dirty = FALSE; - expected[9].serialized = TRUE; - expected[9].destroyed = TRUE; - - expected[10].in_cache = TRUE; - expected[10].is_dirty = FALSE; - expected[10].serialized = TRUE; - expected[10].destroyed = FALSE; + * H5C_unprotect(LET, 11) marks (LET, 11) as unprotected, and then + * returns as well. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) N 10 KB N N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) Y 10 KB N N - - + * + * (VET, 9) N 10 KB N N - - + * + * Start by updating the expected table for the expected changes in + * entry status: + * + * Note that we reset the loaded, flushed, and destroyed + * fields of (VET,8) so we can track what is happening. + */ + base_addr = entries[VARIABLE_ENTRY_TYPE]; + entry_ptr = &(base_addr[8]); + entry_ptr->deserialized = FALSE; + entry_ptr->deserialized = FALSE; + entry_ptr->destroyed = FALSE; + + expected[0].in_cache = FALSE; + expected[0].is_dirty = FALSE; + expected[0].serialized = TRUE; + expected[0].destroyed = TRUE; + expected[8].in_cache = TRUE; + expected[8].is_dirty = FALSE; + expected[8].deserialized = TRUE; + expected[8].serialized = TRUE; + expected[8].destroyed = FALSE; + expected[9].in_cache = FALSE; + expected[9].is_dirty = FALSE; + expected[9].serialized = TRUE; + expected[9].destroyed = TRUE; + + expected[10].in_cache = TRUE; + expected[10].is_dirty = FALSE; + expected[10].serialized = TRUE; + expected[10].destroyed = FALSE; num_large_entries = 12; - for (i = num_variable_entries; - i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) - { + for (i = num_variable_entries; + i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) + { expected[i].is_dirty = FALSE; - expected[i].serialized = TRUE; - } + expected[i].serialized = TRUE; + } - for (i = 10; i < 12; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 10; i < 12; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 44) || + if((cache_ptr->index_len != 44) || (cache_ptr->index_size != (2 * 1024 * 1024) - (2 * 1024) - (1 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (12 * LARGE_ENTRY_SIZE)))) { + (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (12 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 11."; - } + failure_mssg = "unexpected size/len in flush op eviction test 11."; + } - /* verify entry status */ - verify_entry_status(cache_ptr, - 9, - (num_variable_entries + num_monster_entries + + /* verify entry status */ + verify_entry_status(cache_ptr, + 9, + (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { @@ -10592,8 +10592,8 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9); unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 9, H5C__NO_FLAGS_SET); - /* protect and unprotect VET 8 to dirty it and move it to the - * top of the LRU. Since we are dirtying it again, reset its + /* protect and unprotect VET 8 to dirty it and move it to the + * top of the LRU. Since we are dirtying it again, reset its * serialized flag. */ base_addr = entries[VARIABLE_ENTRY_TYPE]; @@ -10605,14 +10605,14 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) /* Again, touch all the non VARIABLE_ENTRY_TYPE entries in the - * cache to evict VET 9 and move VET 8 to the bottom of the LRU. + * cache to evict VET 9 and move VET 8 to the bottom of the LRU. * * Must do this twice to get the desired result. - */ + */ - /* skip MET 0 in first pass so that we evict VET 9 when we - * reload MET 0 + /* skip MET 0 in first pass so that we evict VET 9 when we + * reload MET 0 * * Since we are reloading MET 0, reset its destroyed flag. */ @@ -10620,40 +10620,40 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) entry_ptr = &(base_addr[0]); entry_ptr->destroyed = FALSE; - for (i = 1; i < num_monster_entries; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 1; i < num_monster_entries; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < num_large_entries; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 0; i < num_large_entries; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < num_monster_entries; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 0; i < num_monster_entries; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - for (i = 0; i < num_large_entries; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 0; i < num_large_entries; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - /* update the expected array to mark all these entries dirty again. */ - for (i = num_variable_entries; - i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) - { + /* update the expected array to mark all these entries dirty again. */ + for (i = num_variable_entries; + i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) + { expected[i].is_dirty = TRUE; - } + } - /* update MET 0 to set its in cache flag, and reset - * its destroyed flag + /* update MET 0 to set its in cache flag, and reset + * its destroyed flag */ expected[10].in_cache = TRUE; @@ -10671,118 +10671,118 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) /* verify cache size */ - if((cache_ptr->index_len != 44) || + if((cache_ptr->index_len != 44) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (5 * VARIABLE_ENTRY_SIZE) + - (11 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) + - (31 * MONSTER_ENTRY_SIZE) + - (12 * LARGE_ENTRY_SIZE)))) { + (5 * VARIABLE_ENTRY_SIZE) + + (11 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((1 * VARIABLE_ENTRY_SIZE) + + (31 * MONSTER_ENTRY_SIZE) + + (12 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 12."; - } + failure_mssg = "unexpected size/len in flush op eviction test 12."; + } - /* modifications to the H5C__flush_single_entry() function have - * changed the behavior of the cache slightly, causing - * this test to fail. Comment out for now -- come back and + /* modifications to the H5C__flush_single_entry() function have + * changed the behavior of the cache slightly, causing + * this test to fail. Comment out for now -- come back and * fix if all goes well. */ - /* verify entry status */ - verify_entry_status(cache_ptr, - 10, + /* verify entry status */ + verify_entry_status(cache_ptr, + 10, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } if(pass) { /* Load two more large entries. - * - * Since (VET, 8) is dirty, at first this will just cause (VET, 8) - * to be flushed. - * - * But all other entries in the cache are dirty, so the cache will - * flush them all, and then evict (VET, 8) on the second pass. - * - * The following table shows the expected states of the variable - * size entries after the test. - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (VET, 0) N 10 KB N N - - - * - * (VET, 1) N 2.5 KB N N - - - * - * (VET, 2) N 10 KB N N - - - * - * (VET, 3) N 2.5 KB N N - - - * - * (VET, 4) N 10 KB N N - - - * - * (VET, 5) N 5 KB N N - - - * - * (VET, 6) N 5 KB N N - - - * - * (VET, 7) N 5 KB N N - - - * - * (VET, 8) N 10 KB N N - - - * - * (VET, 9) N 10 KB N N - - - * - * Start by updating the expected table for the expected changes in - * entry status: - */ - - expected[8].in_cache = FALSE; - expected[8].is_dirty = FALSE; - expected[8].serialized = TRUE; - expected[8].destroyed = TRUE; + * + * Since (VET, 8) is dirty, at first this will just cause (VET, 8) + * to be flushed. + * + * But all other entries in the cache are dirty, so the cache will + * flush them all, and then evict (VET, 8) on the second pass. + * + * The following table shows the expected states of the variable + * size entries after the test. + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (VET, 0) N 10 KB N N - - + * + * (VET, 1) N 2.5 KB N N - - + * + * (VET, 2) N 10 KB N N - - + * + * (VET, 3) N 2.5 KB N N - - + * + * (VET, 4) N 10 KB N N - - + * + * (VET, 5) N 5 KB N N - - + * + * (VET, 6) N 5 KB N N - - + * + * (VET, 7) N 5 KB N N - - + * + * (VET, 8) N 10 KB N N - - + * + * (VET, 9) N 10 KB N N - - + * + * Start by updating the expected table for the expected changes in + * entry status: + */ + + expected[8].in_cache = FALSE; + expected[8].is_dirty = FALSE; + expected[8].serialized = TRUE; + expected[8].destroyed = TRUE; num_large_entries = 14; - /* a newly loaded entry is not inserted in the cache until after - * space has been made for it. Thus (LET, 13) will not be flushed. - */ - for (i = num_variable_entries; - i < num_variable_entries + num_monster_entries + num_large_entries - 1; - i++) - { + /* a newly loaded entry is not inserted in the cache until after + * space has been made for it. Thus (LET, 13) will not be flushed. + */ + for (i = num_variable_entries; + i < num_variable_entries + num_monster_entries + num_large_entries - 1; + i++) + { expected[i].is_dirty = FALSE; - expected[i].serialized = TRUE; - } + expected[i].serialized = TRUE; + } - for (i = 12; i < 14; i++) - { - protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); + for (i = 12; i < 14; i++) + { + protect_entry(file_ptr, LARGE_ENTRY_TYPE, i); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } /* verify cache size */ - if((cache_ptr->index_len != 45) || + if((cache_ptr->index_len != 45) || (cache_ptr->index_size != (2 * 1024 * 1024) - - (6 * VARIABLE_ENTRY_SIZE) + - (13 * LARGE_ENTRY_SIZE)) || - (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) + - (14 * LARGE_ENTRY_SIZE)))) { + (6 * VARIABLE_ENTRY_SIZE) + + (13 * LARGE_ENTRY_SIZE)) || + (cache_ptr->index_size != ((31 * MONSTER_ENTRY_SIZE) + + (14 * LARGE_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in flush op eviction test 13."; - } + failure_mssg = "unexpected size/len in flush op eviction test 13."; + } - /* modifications to the H5C__flush_single_entry() function have - * changed the behavior of the cache slightly, causing - * this test to fail. Comment out for now -- come back and + /* modifications to the H5C__flush_single_entry() function have + * changed the behavior of the cache slightly, causing + * this test to fail. Comment out for now -- come back and * fix if all goes well. */ - /* verify entry status */ - verify_entry_status(cache_ptr, - 11, + /* verify entry status */ + verify_entry_status(cache_ptr, + 11, (num_variable_entries + num_monster_entries + num_large_entries), - expected); + expected); } /* at this point we have cycled all the variable size entries through @@ -10820,7 +10820,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) */ if(pass) { - if((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->clears[VARIABLE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[VARIABLE_ENTRY_TYPE] != 9) || @@ -10846,7 +10846,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if(pass) { - if((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->clears[LARGE_ENTRY_TYPE] != 0) || (cache_ptr->flushes[LARGE_ENTRY_TYPE] != 25) || @@ -10872,7 +10872,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if(pass) { - if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 62) || @@ -10899,33 +10899,33 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if(pass) { - reset_entries(); + reset_entries(); } return; } /* check_flush_cache__flush_op_eviction_test() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__single_entry() + * Function: check_flush_cache__single_entry() * - * Purpose: Verify that flush_cache behaves as expected when the cache - * contains only one element. + * Purpose: Verify that flush_cache behaves as expected when the cache + * contains only one element. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: * - * JRM -- 3/29/06 - * Added tests for pinned entries. + * JRM -- 3/29/06 + * Added tests for pinned entries. * - * JRM -- 5/17/06 - * Complete reqrite of pinned entry tests to accomodate - * the new H5C_mark_entry_dirty() call. + * JRM -- 5/17/06 + * Complete reqrite of pinned entry tests to accomodate + * the new H5C_mark_entry_dirty() call. * *------------------------------------------------------------------------- */ @@ -12079,22 +12079,22 @@ check_flush_cache__single_entry(H5F_t * file_ptr) /* Now run single entry tests for pinned entries. Test all combinations * of: * - * 1) Unpin by unprotect vs. unpin by call to H5C_unpin_entry(). + * 1) Unpin by unprotect vs. unpin by call to H5C_unpin_entry(). * - * 2) Marked dirty by unprotect or not. + * 2) Marked dirty by unprotect or not. * - * 3) Marked dirty by call to H5C_mark_entry_dirty() or not. + * 3) Marked dirty by call to H5C_mark_entry_dirty() or not. * * 4) Marked dirty by call to H5C_mark_entry_dirty() while protected * or not. * * 5) Marked dirty by call to H5C_mark_entry_dirty() while pinned or not. * - * 6) Entry marked for flush or not. + * 6) Entry marked for flush or not. * - * 7) Call flush with H5C__FLUSH_MARKED_ENTRIES_FLAG or not. + * 7) Call flush with H5C__FLUSH_MARKED_ENTRIES_FLAG or not. * - * 8) Call flush with H5C__FLUSH_CLEAR_ONLY_FLAG or not. + * 8) Call flush with H5C__FLUSH_CLEAR_ONLY_FLAG or not. * * This yields a total of 256 tests. * @@ -12137,320 +12137,320 @@ check_flush_cache__single_entry(H5F_t * file_ptr) if(pass) { - int i; - struct pinned_single_entry_test_spec - { - int test_num; - int entry_type; - int entry_idx; - hbool_t dirty_flag; - hbool_t mark_dirty; - hbool_t pop_mark_dirty_prot; - hbool_t pop_mark_dirty_pinned; - hbool_t unprotect_unpin; - unsigned int flags; - unsigned int flush_flags; - hbool_t expected_serialized; - hbool_t expected_destroyed; - } spec[256] = - /* pop pop - * ent unprot mark mark - * test entry -ry dirty mark dirty dirty unprot flush expect expect + int i; + struct pinned_single_entry_test_spec + { + int test_num; + int entry_type; + int entry_idx; + hbool_t dirty_flag; + hbool_t mark_dirty; + hbool_t pop_mark_dirty_prot; + hbool_t pop_mark_dirty_pinned; + hbool_t unprotect_unpin; + unsigned int flags; + unsigned int flush_flags; + hbool_t expected_serialized; + hbool_t expected_destroyed; + } spec[256] = + /* pop pop + * ent unprot mark mark + * test entry -ry dirty mark dirty dirty unprot flush expect expect * num type idx flag dirty prot pinned unpin flags flags srlzd destroy - */ - { { 1, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE }, - { 2, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE }, - { 3, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 4, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 5, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 6, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 7, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 8, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 9, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 10, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 11, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 12, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 13, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 14, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 15, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 16, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 17, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 18, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 19, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 20, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 21, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 22, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 23, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 24, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 25, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 26, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 27, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 28, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 29, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 30, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 31, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 32, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 33, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE }, - { 34, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE }, - { 35, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 36, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 37, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 38, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 39, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 40, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 41, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 42, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 43, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 44, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 45, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 46, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 47, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 48, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 49, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 50, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 51, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 52, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 53, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 54, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 55, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 56, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 57, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 58, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 59, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 60, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 61, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 62, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 63, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 64, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, - { 65, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 66, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 67, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 68, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 69, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 70, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 71, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 72, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 73, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 74, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 75, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 76, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 77, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 78, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 79, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 80, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 81, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 82, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 83, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 84, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 85, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 86, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 87, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 88, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 89, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 90, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 91, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 92, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 93, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 94, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 95, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 96, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 97, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 98, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 99, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 100, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 101, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 102, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 103, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 104, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 105, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 106, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 107, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 108, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, - { 109, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 110, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 111, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 112, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 113, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 114, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 115, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 116, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 117, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 118, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 119, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 120, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 121, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 122, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 123, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 124, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 125, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 126, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 127, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 128, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, - { 129, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 130, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 131, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 132, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 133, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 134, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 135, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 136, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 137, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 138, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 139, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 140, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 141, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 142, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 143, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 144, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 145, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 146, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 147, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 148, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 149, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 150, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 151, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 152, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 153, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 154, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 155, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 156, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 157, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 158, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 159, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 160, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 161, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 162, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 163, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 164, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 165, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 166, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 167, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 168, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 169, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 170, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 171, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 172, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 173, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 174, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 175, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 176, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 177, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 178, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 179, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 180, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 181, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 182, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 183, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 184, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 185, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 186, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 187, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 188, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 189, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 190, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 191, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 192, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 193, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 194, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 195, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 196, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 197, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 198, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 199, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 200, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 201, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 202, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 203, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 204, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 205, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 206, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 207, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 208, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 209, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 210, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 211, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 212, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 213, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 214, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 215, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 216, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 217, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 218, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 219, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 220, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 221, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 222, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 223, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 224, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 225, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 226, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 227, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 228, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 229, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 230, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 231, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 232, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 233, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 234, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 235, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 236, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 237, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 238, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 239, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 240, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 241, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 242, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 243, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 244, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 245, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 246, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 247, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 248, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 249, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 250, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 251, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 252, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 253, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 254, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 255, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, - { 256, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE } }; - - i = 0; - while(pass && (i < 256)) - { - check_flush_cache__pinned_single_entry_test - ( + */ + { { 1, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE }, + { 2, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, FALSE, FALSE }, + { 3, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 4, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 5, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 6, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 7, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 8, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 9, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 10, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 11, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 12, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 13, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 14, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 15, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 16, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 17, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 18, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 19, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 20, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 21, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 22, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 23, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 24, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 25, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 26, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 27, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 28, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 29, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 30, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 31, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 32, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 33, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE }, + { 34, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, FALSE, FALSE }, + { 35, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 36, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 37, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 38, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 39, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 40, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 41, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 42, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 43, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 44, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 45, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 46, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 47, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 48, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 49, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 50, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 51, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 52, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 53, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 54, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 55, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 56, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 57, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 58, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 59, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 60, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 61, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 62, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 63, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 64, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__NO_FLAGS_SET, TRUE, FALSE }, + { 65, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 66, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 67, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 68, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 69, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 70, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 71, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 72, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 73, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 74, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 75, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 76, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 77, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 78, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 79, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 80, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 81, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 82, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 83, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 84, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 85, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 86, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 87, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 88, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 89, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 90, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 91, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 92, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 93, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 94, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 95, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 96, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 97, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 98, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 99, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 100, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 101, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 102, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 103, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 104, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 105, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 106, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 107, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 108, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, FALSE, FALSE }, + { 109, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 110, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 111, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 112, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 113, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 114, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 115, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 116, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 117, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 118, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 119, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 120, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 121, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 122, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 123, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 124, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 125, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 126, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 127, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 128, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG, TRUE, FALSE }, + { 129, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 130, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 131, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 132, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 133, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 134, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 135, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 136, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 137, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 138, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 139, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 140, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 141, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 142, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 143, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 144, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 145, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 146, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 147, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 148, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 149, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 150, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 151, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 152, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 153, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 154, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 155, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 156, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 157, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 158, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 159, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 160, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 161, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 162, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 163, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 164, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 165, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 166, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 167, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 168, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 169, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 170, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 171, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 172, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 173, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 174, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 175, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 176, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 177, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 178, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 179, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 180, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 181, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 182, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 183, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 184, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 185, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 186, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 187, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 188, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 189, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 190, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 191, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 192, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 193, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 194, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 195, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 196, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 197, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 198, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 199, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 200, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 201, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 202, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 203, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 204, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 205, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 206, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 207, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 208, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 209, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 210, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 211, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 212, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 213, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 214, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 215, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 216, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 217, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 218, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 219, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 220, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 221, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 222, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 223, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 224, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__NO_FLAGS_SET, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 225, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 226, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 227, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 228, PICO_ENTRY_TYPE, 0, FALSE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 229, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 230, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 231, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 232, PICO_ENTRY_TYPE, 0, FALSE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 233, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 234, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 235, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 236, PICO_ENTRY_TYPE, 0, FALSE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 237, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 238, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 239, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 240, PICO_ENTRY_TYPE, 0, FALSE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 241, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 242, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 243, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 244, PICO_ENTRY_TYPE, 0, TRUE, FALSE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 245, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 246, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 247, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 248, PICO_ENTRY_TYPE, 0, TRUE, FALSE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 249, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 250, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 251, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 252, PICO_ENTRY_TYPE, 0, TRUE, TRUE, FALSE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 253, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 254, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, FALSE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 255, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, FALSE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE }, + { 256, PICO_ENTRY_TYPE, 0, TRUE, TRUE, TRUE, TRUE, TRUE, H5C__SET_FLUSH_MARKER_FLAG, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG, FALSE, FALSE } }; + + i = 0; + while(pass && (i < 256)) + { + check_flush_cache__pinned_single_entry_test + ( /* file_ptr */ file_ptr, /* test_num */ spec[i].test_num, /* entry_type */ spec[i].entry_type, /* entry_idx */ spec[i].entry_idx, /* dirty_flag */ spec[i].dirty_flag, - /* mark_dirty */ spec[i].mark_dirty, + /* mark_dirty */ spec[i].mark_dirty, /* pop_mark_dirty_prot */ spec[i].pop_mark_dirty_prot, /* pop_mark_dirty_pinned */ spec[i].pop_mark_dirty_pinned, - /* unprotect_unpin */ spec[i].unprotect_unpin, + /* unprotect_unpin */ spec[i].unprotect_unpin, /* flags */ spec[i].flags, /* flush_flags */ spec[i].flush_flags, /* expected_serialized */ spec[i].expected_serialized, /* expected_destroyed */ spec[i].expected_destroyed ); - i++; - } + i++; + } } return; } /* check_flush_cache__single_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__single_entry_test() + * Function: check_flush_cache__single_entry_test() * - * Purpose: Run a single entry flush cache test. + * Purpose: Run a single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -12472,7 +12472,7 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, { H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; - herr_t result; + herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr = NULL; @@ -12612,26 +12612,26 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, } /* check_flush_cache__single_entry_test() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_cache__pinned_single_entry_test() + * Function: check_flush_cache__pinned_single_entry_test() * - * Purpose: Run a pinned single entry flush cache test. + * Purpose: Run a pinned single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * * Modifications: * - * JRM -- 5/17/06 - * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned - * flags and supporting code to allow us to test the - * H5C_mark_entry_dirty() call. Use the - * call to mark the entry dirty while the entry is protected - * if pop_mark_dirty_prot is TRUE, and to mark the entry - * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. + * JRM -- 5/17/06 + * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned + * flags and supporting code to allow us to test the + * H5C_mark_entry_dirty() call. Use the + * call to mark the entry dirty while the entry is protected + * if pop_mark_dirty_prot is TRUE, and to mark the entry + * dirty while it is pinned if pop_mark_dirty_pinned is TRUE. * *------------------------------------------------------------------------- */ @@ -12642,10 +12642,10 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, int entry_type, int entry_idx, hbool_t unprot_dirty_flag, - hbool_t mark_dirty, - hbool_t pop_mark_dirty_prot, - hbool_t pop_mark_dirty_pinned, - hbool_t unprotect_unpin, + hbool_t mark_dirty, + hbool_t pop_mark_dirty_prot, + hbool_t pop_mark_dirty_pinned, + hbool_t unprotect_unpin, unsigned int flags, unsigned int flush_flags, hbool_t expected_serialized, @@ -12654,7 +12654,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, H5C_t * cache_ptr = file_ptr->shared->cache; static char msg[128]; hbool_t expected_deserialized = TRUE; - herr_t result; + herr_t result; test_entry_t * base_addr; test_entry_t * entry_ptr = NULL; @@ -12692,24 +12692,24 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, protect_entry(file_ptr, entry_type, entry_idx); - if(pop_mark_dirty_prot) { + if(pop_mark_dirty_prot) { - mark_entry_dirty(entry_type, entry_idx); - } + mark_entry_dirty(entry_type, entry_idx); + } unprotect_entry(file_ptr, entry_type, entry_idx, (unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | (flags | H5C__PIN_ENTRY_FLAG)); - if(mark_dirty) { + if(mark_dirty) { mark_entry_dirty(entry_type, entry_idx); - } + } - if(pop_mark_dirty_pinned) { + if(pop_mark_dirty_pinned) { - mark_entry_dirty(entry_type, entry_idx); - } + mark_entry_dirty(entry_type, entry_idx); + } } if(pass) { @@ -12820,15 +12820,15 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, } /* check_flush_cache__pinned_single_entry_test() */ - + /*------------------------------------------------------------------------- - * Function: check_get_entry_status() + * Function: check_get_entry_status() * - * Purpose: Verify that H5C_get_entry_status() behaves as expected. + * Purpose: Verify that H5C_get_entry_status() behaves as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/28/06 * * Modifications: @@ -12841,11 +12841,11 @@ check_get_entry_status(unsigned paged) { static char msg[128]; herr_t result; - hbool_t in_cache; - hbool_t is_dirty; - hbool_t is_protected; - hbool_t is_pinned; - size_t entry_size; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; H5F_t * file_ptr = NULL; test_entry_t * base_addr = NULL; test_entry_t * entry_ptr = NULL; @@ -12886,14 +12886,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 1."); @@ -12914,14 +12914,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if(!in_cache || is_dirty || is_protected || is_pinned) { + } else if(!in_cache || is_dirty || is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 2."); @@ -12940,14 +12940,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if(!in_cache || is_dirty || !is_protected || is_pinned) { + } else if(!in_cache || is_dirty || !is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 3."); @@ -12966,14 +12966,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if(!in_cache || is_dirty || is_protected || !is_pinned) { + } else if(!in_cache || is_dirty || is_protected || !is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); @@ -12992,14 +12992,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || !is_pinned) { + } else if(!in_cache || !is_dirty || is_protected || !is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); @@ -13018,14 +13018,14 @@ check_get_entry_status(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); @@ -13050,15 +13050,15 @@ check_get_entry_status(unsigned paged) } /* check_get_entry_status() */ - + /*------------------------------------------------------------------------- - * Function: check_expunge_entry() + * Function: check_expunge_entry() * - * Purpose: Verify that H5C_expunge_entry() behaves as expected. + * Purpose: Verify that H5C_expunge_entry() behaves as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/5/06 * * Modifications: @@ -13072,11 +13072,11 @@ check_expunge_entry(unsigned paged) { static char msg[128]; herr_t result; - hbool_t in_cache; - hbool_t is_dirty; - hbool_t is_protected; - hbool_t is_pinned; - size_t entry_size; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; H5F_t * file_ptr = NULL; test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -13106,30 +13106,30 @@ check_expunge_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 1."); failure_mssg = msg; } else if((entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); failure_mssg = msg; - } + } } /* protect an entry to force the cache to load it, and then unprotect @@ -13149,28 +13149,28 @@ check_expunge_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if(!in_cache || is_dirty || is_protected || is_pinned) { + } else if(!in_cache || is_dirty || is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 2."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. @@ -13186,34 +13186,34 @@ check_expunge_entry(unsigned paged) if(pass) { /* entry shouldn't be in cache -- only in_cache should be touched - * by the status call. Thus, only check that boolean. + * by the status call. Thus, only check that boolean. */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 3."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); failure_mssg = msg; - } + } } /* now repeat the process with a different entry. On unprotect @@ -13231,30 +13231,30 @@ check_expunge_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); failure_mssg = msg; } else if((entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); failure_mssg = msg; - } + } } /* protect the entry to force the cache to load it, and then unprotect @@ -13273,30 +13273,30 @@ check_expunge_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); failure_mssg = msg; - } + } } /* Expunge the entry and then verify that it is no longer in the cache. @@ -13312,35 +13312,35 @@ check_expunge_entry(unsigned paged) if(pass) { /* entry shouldn't be in cache -- only in_cache should be touched - * by the status call. Thus, only check that boolean. + * by the status call. Thus, only check that boolean. */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); failure_mssg = msg; - } + } } if(pass) { @@ -13360,21 +13360,21 @@ check_expunge_entry(unsigned paged) } /* check_expunge_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_multiple_read_protect() + * Function: check_multiple_read_protect() * - * Purpose: Verify that multiple, simultaneous read protects of a - * single entry perform as expectd. + * Purpose: Verify that multiple, simultaneous read protects of a + * single entry perform as expectd. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/1/07 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -13427,8 +13427,8 @@ check_multiple_read_protect(unsigned paged) entry_ptr = &((entries[0])[0]); if((entry_ptr->header.is_protected) || - (entry_ptr->header.is_read_only) || - (entry_ptr->header.ro_ref_count != 0)) { + (entry_ptr->header.is_read_only) || + (entry_ptr->header.ro_ref_count != 0)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 1.\n"; @@ -13437,11 +13437,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 0) || - (cache_ptr->max_read_protects[0] != 0)) { + (cache_ptr->read_protects[0] != 0) || + (cache_ptr->max_read_protects[0] != 0)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 1.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 1.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13450,8 +13450,8 @@ check_multiple_read_protect(unsigned paged) protect_entry_ro(file_ptr, 0, 0); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 1)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 1)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 2.\n"; @@ -13460,11 +13460,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 1) || - (cache_ptr->max_read_protects[0] != 1)) { + (cache_ptr->read_protects[0] != 1) || + (cache_ptr->max_read_protects[0] != 1)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 2.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 2.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13473,8 +13473,8 @@ check_multiple_read_protect(unsigned paged) protect_entry_ro(file_ptr, 0, 0); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 2)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 2)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 3.\n"; @@ -13483,11 +13483,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 2) || - (cache_ptr->max_read_protects[0] != 2)) { + (cache_ptr->read_protects[0] != 2) || + (cache_ptr->max_read_protects[0] != 2)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 3.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 3.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13496,8 +13496,8 @@ check_multiple_read_protect(unsigned paged) unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 1)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 1)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 4.\n"; @@ -13506,11 +13506,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 2) || - (cache_ptr->max_read_protects[0] != 2)) { + (cache_ptr->read_protects[0] != 2) || + (cache_ptr->max_read_protects[0] != 2)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 4.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 4.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13519,8 +13519,8 @@ check_multiple_read_protect(unsigned paged) protect_entry_ro(file_ptr, 0, 0); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 2)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 2)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 5.\n"; @@ -13529,11 +13529,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 3) || - (cache_ptr->max_read_protects[0] != 2)) { + (cache_ptr->read_protects[0] != 3) || + (cache_ptr->max_read_protects[0] != 2)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 5.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 5.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13542,8 +13542,8 @@ check_multiple_read_protect(unsigned paged) protect_entry_ro(file_ptr, 0, 0); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 3)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 3)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 6.\n"; @@ -13552,11 +13552,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 6.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 6.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13565,8 +13565,8 @@ check_multiple_read_protect(unsigned paged) unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 2)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 2)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 7.\n"; @@ -13575,11 +13575,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 7.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 7.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13588,8 +13588,8 @@ check_multiple_read_protect(unsigned paged) unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); if((!(entry_ptr->header.is_protected)) || - (!(entry_ptr->header.is_read_only)) || - (entry_ptr->header.ro_ref_count != 1)) { + (!(entry_ptr->header.is_read_only)) || + (entry_ptr->header.ro_ref_count != 1)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 8.\n"; @@ -13598,11 +13598,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 8.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 8.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13611,8 +13611,8 @@ check_multiple_read_protect(unsigned paged) unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); if((entry_ptr->header.is_protected) || - (entry_ptr->header.is_read_only) || - (entry_ptr->header.ro_ref_count != 0)) { + (entry_ptr->header.is_read_only) || + (entry_ptr->header.ro_ref_count != 0)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 9.\n"; @@ -13621,11 +13621,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 0) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 9.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 9.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13639,8 +13639,8 @@ check_multiple_read_protect(unsigned paged) protect_entry(file_ptr, 0, 0); if((!(entry_ptr->header.is_protected)) || - (entry_ptr->header.is_read_only) || - (entry_ptr->header.ro_ref_count != 0)) { + (entry_ptr->header.is_read_only) || + (entry_ptr->header.ro_ref_count != 0)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 10.\n"; @@ -13649,11 +13649,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 1) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 10.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 10.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13662,8 +13662,8 @@ check_multiple_read_protect(unsigned paged) unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); if((entry_ptr->header.is_protected) || - (entry_ptr->header.is_read_only) || - (entry_ptr->header.ro_ref_count != 0)) { + (entry_ptr->header.is_read_only) || + (entry_ptr->header.ro_ref_count != 0)) { pass = FALSE; failure_mssg = "Unexpected ro protected status 11.\n"; @@ -13672,11 +13672,11 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 1) || - (cache_ptr->read_protects[0] != 4) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 4) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 11.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 11.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13691,80 +13691,80 @@ check_multiple_read_protect(unsigned paged) if(pass) { - protect_entry(file_ptr, 0, 2); /* (0,2) write */ + protect_entry(file_ptr, 0, 2); /* (0,2) write */ protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (1) */ - protect_entry(file_ptr, 0, 6); /* (0,6) write */ + protect_entry(file_ptr, 0, 6); /* (0,6) write */ unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); - protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (1) */ - protect_entry(file_ptr, 0, 1); /* (0,1) write */ - protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (2) */ - protect_entry(file_ptr, 0, 0); /* (0,0) write */ - protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (2) */ + protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (1) */ + protect_entry(file_ptr, 0, 1); /* (0,1) write */ + protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (2) */ + protect_entry(file_ptr, 0, 0); /* (0,0) write */ + protect_entry_ro(file_ptr, 0, 2); /* (0,2) read only (2) */ unprotect_entry(file_ptr, 0, 2, /* (0,2) read only (1) pin */ - H5C__PIN_ENTRY_FLAG); + H5C__PIN_ENTRY_FLAG); unprotect_entry(file_ptr, 0, 6, /* (0,6) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); - protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (3) */ + protect_entry_ro(file_ptr, 0, 4); /* (0,4) read only (3) */ unprotect_entry(file_ptr, 0, 2, /* (0,2) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); unprotect_entry(file_ptr, 0, 1, /* (0,1) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); - if(pass) { + if(pass) { - entry_ptr = &((entries[0])[4]); + entry_ptr = &((entries[0])[4]); - if(H5C_pin_protected_entry((void *)entry_ptr) < 0) { + if(H5C_pin_protected_entry((void *)entry_ptr) < 0) { - pass = FALSE; - failure_mssg = "H5C_pin_protected_entry() failed.\n"; + pass = FALSE; + failure_mssg = "H5C_pin_protected_entry() failed.\n"; - } else if(!(entry_ptr->header.is_pinned)) { + } else if(!(entry_ptr->header.is_pinned)) { - pass = FALSE; - failure_mssg = "entry (0,4) not pinned.\n"; + pass = FALSE; + failure_mssg = "entry (0,4) not pinned.\n"; - } else { + } else { - /* keep test bed sanity checks happy */ - entry_ptr->is_pinned = TRUE; + /* keep test bed sanity checks happy */ + entry_ptr->is_pinned = TRUE; - } - } + } + } unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (2) */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); unprotect_entry(file_ptr, 0, 4, /* (0,4) read only (1) */ - H5C__UNPIN_ENTRY_FLAG); + H5C__UNPIN_ENTRY_FLAG); if(pass && (entry_ptr->header.is_pinned)) { pass = FALSE; failure_mssg = "enty (0,4) still pinned.\n"; - } + } unprotect_entry(file_ptr, 0, 4, /* (0,4) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); unprotect_entry(file_ptr, 0, 0, /* (0,0) unprotect */ - H5C__NO_FLAGS_SET); + H5C__NO_FLAGS_SET); - unpin_entry(0, 2); + unpin_entry(0, 2); } #if H5C_COLLECT_CACHE_STATS if((cache_ptr->write_protects[0] != 5) || - (cache_ptr->read_protects[0] != 9) || - (cache_ptr->max_read_protects[0] != 3)) { + (cache_ptr->read_protects[0] != 9) || + (cache_ptr->max_read_protects[0] != 3)) { - pass = FALSE; - failure_mssg = "Unexpected protect stats 11.\n"; + pass = FALSE; + failure_mssg = "Unexpected protect stats 11.\n"; } #endif /* H5C_COLLECT_CACHE_STATS */ @@ -13786,17 +13786,17 @@ check_multiple_read_protect(unsigned paged) } /* check_multiple_read_protect() */ - + /*------------------------------------------------------------------------- - * Function: check_move_entry() + * Function: check_move_entry() * - * Purpose: Verify that H5C_move_entry behaves as expected. In - * particular, verify that it works correctly with pinned - * entries. + * Purpose: Verify that H5C_move_entry behaves as expected. In + * particular, verify that it works correctly with pinned + * entries. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/26/06 * *------------------------------------------------------------------------- @@ -13812,26 +13812,26 @@ check_move_entry(unsigned paged) { /* int entry_type = */ PICO_ENTRY_TYPE, /* int entry_index = */ 10, - /* hbool_t is_pinned = */ FALSE, - /* hbool_t is_protected = */ FALSE + /* hbool_t is_pinned = */ FALSE, + /* hbool_t is_protected = */ FALSE }, { /* int entry_type = */ PICO_ENTRY_TYPE, /* int entry_index = */ 20, - /* hbool_t is_pinned = */ TRUE, - /* hbool_t is_protected = */ FALSE + /* hbool_t is_pinned = */ TRUE, + /* hbool_t is_protected = */ FALSE }, { /* int entry_type = */ PICO_ENTRY_TYPE, /* int entry_index = */ 30, - /* hbool_t is_pinned = */ FALSE, - /* hbool_t is_protected = */ TRUE + /* hbool_t is_pinned = */ FALSE, + /* hbool_t is_protected = */ TRUE }, { /* int entry_type = */ PICO_ENTRY_TYPE, /* int entry_index = */ 40, - /* hbool_t is_pinned = */ TRUE, - /* hbool_t is_protected = */ TRUE + /* hbool_t is_pinned = */ TRUE, + /* hbool_t is_protected = */ TRUE }, }; @@ -13878,7 +13878,7 @@ check_move_entry(unsigned paged) while(pass && (u < NELMTS(test_specs))) { check_move_entry__run_test(file_ptr, u, &(test_specs[u])); - u++; + u++; } if(pass) @@ -13896,13 +13896,13 @@ check_move_entry(unsigned paged) return (unsigned)!pass; } /* check_move_entry() */ - + /*------------------------------------------------------------------------- * Function: check_move_entry__run_test() * * Purpose: Run a move entry test. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * * Return: void * @@ -13911,7 +13911,7 @@ check_move_entry(unsigned paged) * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -14080,15 +14080,15 @@ check_move_entry__run_test(H5F_t * file_ptr, } /* check_move_entry__run_test() */ - + /*------------------------------------------------------------------------- - * Function: check_pin_protected_entry() + * Function: check_pin_protected_entry() * - * Purpose: Verify that H5C_pin_protected_entry behaves as expected. + * Purpose: Verify that H5C_pin_protected_entry behaves as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/28/06 * * Modifications: @@ -14142,25 +14142,25 @@ check_pin_protected_entry(unsigned paged) base_addr = entries[0]; entry_ptr = &(base_addr[0]); - result = H5C_pin_protected_entry((void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_pin_protected_entry() reports failure."); failure_mssg = msg; - } else if(!(entry_ptr->header.is_pinned)) { + } else if(!(entry_ptr->header.is_pinned)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "entry not pinned when it should be."); failure_mssg = msg; - } else { + } else { - entry_ptr->is_pinned = TRUE; - } + entry_ptr->is_pinned = TRUE; + } } unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG); @@ -14182,16 +14182,16 @@ check_pin_protected_entry(unsigned paged) } /* check_pin_protected_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_resize_entry() + * Function: check_resize_entry() * - * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize - * entries as expected. + * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize + * entries as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -14202,12 +14202,12 @@ check_resize_entry(unsigned paged) { static char msg[128]; herr_t result; - hbool_t in_cache; - hbool_t is_dirty; - hbool_t is_protected; - hbool_t is_pinned; - size_t entry_size; - size_t reported_entry_size; + hbool_t in_cache; + hbool_t is_dirty; + hbool_t is_protected; + hbool_t is_pinned; + size_t entry_size; + size_t reported_entry_size; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * base_addr; @@ -14262,8 +14262,8 @@ check_resize_entry(unsigned paged) pass = FALSE; failure_mssg = "file_ptr NULL from setup_cache."; - } - else + } + else { cache_ptr = file_ptr->shared->cache; @@ -14275,16 +14275,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if((cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); failure_mssg = msg; - } + } } if(pass) { @@ -14295,48 +14295,48 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if((cache_ptr->index_len != 1) || + (cache_ptr->index_size != LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 2."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; - } else if(!in_cache || is_dirty || !is_protected || is_pinned) { + } else if(!in_cache || is_dirty || !is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 1."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); failure_mssg = msg; - } + } } if(pass) { @@ -14374,48 +14374,48 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))) { + if((cache_ptr->index_len != 1) || + (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned || - (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned || + (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 2."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); failure_mssg = msg; - } + } } if(pass) { @@ -14459,48 +14459,48 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 1) || + (cache_ptr->index_size != LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned || - (reported_entry_size != LARGE_ENTRY_SIZE)) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned || + (reported_entry_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 3."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); failure_mssg = msg; - } + } } if(pass) { @@ -14515,120 +14515,120 @@ check_resize_entry(unsigned paged) result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4)); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5C_resize_entry() reports failure 1."); + "H5C_resize_entry() reports failure 1."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))) { + if((cache_ptr->index_len != 1) || + (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || !is_pinned || - (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) { + } else if(!in_cache || !is_dirty || is_protected || !is_pinned || + (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); failure_mssg = msg; - } + } } if(pass) { result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5C_resize_entry() reports failure 2."); + "H5C_resize_entry() reports failure 2."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 1) || - (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 1) || + (cache_ptr->index_size != LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || !is_pinned || - (reported_entry_size != LARGE_ENTRY_SIZE)) { + } else if(!in_cache || !is_dirty || is_protected || !is_pinned || + (reported_entry_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); failure_mssg = msg; - } + } } if(pass) { @@ -14644,44 +14644,44 @@ check_resize_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 6."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 6."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 6."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if((cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); failure_mssg = msg; - } + } } @@ -14689,19 +14689,19 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if((cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; - } + } base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[3]); - entry_size = LARGE_ENTRY_SIZE; + entry_size = LARGE_ENTRY_SIZE; } if(pass) { @@ -14719,17 +14719,17 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 3) || - (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 3) || + (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); failure_mssg = msg; - } + } } if(pass) { @@ -14740,48 +14740,48 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 7."); failure_mssg = msg; - } else if(!in_cache || is_dirty || !is_protected || is_pinned) { + } else if(!in_cache || is_dirty || !is_protected || is_pinned) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 7."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 7."); failure_mssg = msg; - } + } } if(pass) { @@ -14819,50 +14819,50 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != - ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != - (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))) { + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 8."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned || - (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned || + (reported_entry_size != (LARGE_ENTRY_SIZE / 2))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 8."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 8."); failure_mssg = msg; - } + } } if(pass) { @@ -14906,48 +14906,48 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 12."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 9."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || is_pinned || - (reported_entry_size != LARGE_ENTRY_SIZE)) { + } else if(!in_cache || !is_dirty || is_protected || is_pinned || + (reported_entry_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 9."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 9."); failure_mssg = msg; - } + } } if(pass) { @@ -14962,129 +14962,129 @@ check_resize_entry(unsigned paged) result = H5C_resize_entry((void *)entry_ptr, (LARGE_ENTRY_SIZE / 4)); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5C_resize_entry() reports failure 3."); + "H5C_resize_entry() reports failure 3."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != - ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != - (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))) { + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != + ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != + (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 13."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 10."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || !is_pinned || - (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) { + } else if(!in_cache || !is_dirty || is_protected || !is_pinned || + (reported_entry_size != (LARGE_ENTRY_SIZE / 4))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 10."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 10."); failure_mssg = msg; - } + } } if(pass) { result = H5C_resize_entry((void *)entry_ptr, LARGE_ENTRY_SIZE); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, - "H5C_resize_entry() reports failure 4."); + "H5C_resize_entry() reports failure 4."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 4) || - (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))) { + if((cache_ptr->index_len != 4) || + (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 14."); failure_mssg = msg; - } + } } if(pass) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - &reported_entry_size, &in_cache, - &is_dirty, &is_protected, &is_pinned, + &reported_entry_size, &in_cache, + &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 11."); failure_mssg = msg; - } else if(!in_cache || !is_dirty || is_protected || !is_pinned || - (reported_entry_size != LARGE_ENTRY_SIZE)) { + } else if(!in_cache || !is_dirty || is_protected || !is_pinned || + (reported_entry_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 11."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 11."); failure_mssg = msg; - } + } } if(pass) { protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); - unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, + unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__UNPIN_ENTRY_FLAG | H5C__DELETED_FLAG); } @@ -15093,44 +15093,44 @@ check_resize_entry(unsigned paged) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL, NULL, NULL); + &is_pinned, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 12."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 12."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 12."); failure_mssg = msg; - } + } } if(pass) { - if((cache_ptr->index_len != 3) || - (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { + if((cache_ptr->index_len != 3) || + (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 15."); failure_mssg = msg; - } + } } if(pass) { @@ -15148,16 +15148,16 @@ check_resize_entry(unsigned paged) if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0)) { + if((cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 16."); failure_mssg = msg; - } + } } if(pass) { @@ -15177,16 +15177,16 @@ check_resize_entry(unsigned paged) } /* check_resize_entry() */ - + /*------------------------------------------------------------------------- - * Function: check_evictions_enabled() + * Function: check_evictions_enabled() * - * Purpose: Verify that H5C_get_evictions_enabled() and - * H5C_set_evictions_enabled() functions perform as expected. + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() functions perform as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/2/07 * * Modifications: @@ -15200,11 +15200,11 @@ check_evictions_enabled(unsigned paged) { static char msg[128]; herr_t result; - hbool_t show_progress = FALSE; - hbool_t evictions_enabled; - hbool_t in_cache; - int i; - int mile_stone = 1; + hbool_t show_progress = FALSE; + hbool_t evictions_enabled; + hbool_t in_cache; + int i; + int mile_stone = 1; H5F_t * file_ptr = NULL; H5C_t * cache_ptr = NULL; test_entry_t * base_addr = NULL; @@ -15268,8 +15268,8 @@ check_evictions_enabled(unsigned paged) pass = FALSE; failure_mssg = "file_ptr NULL from setup_cache."; - } - else + } + else { cache_ptr = file_ptr->shared->cache; @@ -15284,17 +15284,17 @@ check_evictions_enabled(unsigned paged) /* verify that it is empty */ if(pass) { - if((cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 1."); failure_mssg = msg; - } + } } if(show_progress) /* 3 */ @@ -15306,12 +15306,12 @@ check_evictions_enabled(unsigned paged) result = H5C_get_evictions_enabled(cache_ptr, &evictions_enabled); - if((result != SUCCEED) || (evictions_enabled != TRUE)) { + if((result != SUCCEED) || (evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected evictions enabled 1."); failure_mssg = msg; - } + } } if(show_progress) /* 4 */ @@ -15336,18 +15336,18 @@ check_evictions_enabled(unsigned paged) /* verify that the cache is full */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 2."); failure_mssg = msg; - } + } } if(show_progress) /* 6 */ @@ -15369,17 +15369,17 @@ check_evictions_enabled(unsigned paged) /* verify that an entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 0) || - (cache_ptr->slist_size != 0) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 0) || + (cache_ptr->slist_size != 0) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 3."); failure_mssg = msg; - } + } } if(show_progress) /* 8 */ @@ -15391,31 +15391,31 @@ check_evictions_enabled(unsigned paged) entry_ptr = &(base_addr[0]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 1."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 1."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 1."); failure_mssg = msg; - } + } } if(show_progress) /* 9 */ @@ -15436,17 +15436,17 @@ check_evictions_enabled(unsigned paged) /* verify that another entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 4."); failure_mssg = msg; - } + } } if(show_progress) /* 11 */ @@ -15458,30 +15458,30 @@ check_evictions_enabled(unsigned paged) entry_ptr = &(base_addr[1]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 2."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 2."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 2."); failure_mssg = msg; - } + } } if(show_progress) /* 12 */ @@ -15493,12 +15493,12 @@ check_evictions_enabled(unsigned paged) result = H5C_set_evictions_enabled(cache_ptr, FALSE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; HDsnprintf(msg, (size_t)128, "can't disable evictions 1."); failure_mssg = msg; - } + } } if(show_progress) /* 13 */ @@ -15508,17 +15508,17 @@ check_evictions_enabled(unsigned paged) /* verify that evictions are disabled */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 5."); failure_mssg = msg; - } + } } if(show_progress) /* 14 */ @@ -15540,17 +15540,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 17) || - (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 1) || - (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if((cache_ptr->index_len != 17) || + (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 1) || + (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 6."); failure_mssg = msg; - } + } } if(show_progress) /* 16 */ @@ -15571,17 +15571,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entry has been evicted */ if(pass) { - if((cache_ptr->index_len != 18) || - (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if((cache_ptr->index_len != 18) || + (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 7."); failure_mssg = msg; - } + } } if(show_progress) /* 18 */ @@ -15593,12 +15593,12 @@ check_evictions_enabled(unsigned paged) result = H5C_set_evictions_enabled(cache_ptr, TRUE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; HDsnprintf(msg, (size_t)128, "can't enable evictions 1."); failure_mssg = msg; - } + } } if(show_progress) /* 19 */ @@ -15620,17 +15620,17 @@ check_evictions_enabled(unsigned paged) /* verify that no entries have been evicted */ if(pass) { - if((cache_ptr->index_len != 18) || - (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 18) || + (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; - } + } } if(show_progress) /* 21 */ @@ -15655,17 +15655,17 @@ check_evictions_enabled(unsigned paged) if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 9."); failure_mssg = msg; - } + } } if(show_progress) /* 23 */ @@ -15677,30 +15677,30 @@ check_evictions_enabled(unsigned paged) entry_ptr = &(base_addr[2]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 3."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 3."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 3."); failure_mssg = msg; - } + } } if(show_progress) /* 24 */ @@ -15712,30 +15712,30 @@ check_evictions_enabled(unsigned paged) entry_ptr = &(base_addr[3]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 4."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 4."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - (entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + (entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 4."); failure_mssg = msg; - } + } } if(show_progress) /* 25 */ @@ -15747,12 +15747,12 @@ check_evictions_enabled(unsigned paged) result = H5C_set_evictions_enabled(cache_ptr, FALSE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; HDsnprintf(msg, (size_t)128, "can't disable evictions 2."); failure_mssg = msg; - } + } } if(show_progress) /* 26 */ @@ -15776,17 +15776,17 @@ check_evictions_enabled(unsigned paged) /* verify that the cache has grown */ if(pass) { - if((cache_ptr->index_len != 17) || - (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 2) || - (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != FALSE)) { + if((cache_ptr->index_len != 17) || + (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 2) || + (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != FALSE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 10."); failure_mssg = msg; - } + } } if(show_progress) /* 28 */ @@ -15798,12 +15798,12 @@ check_evictions_enabled(unsigned paged) result = H5C_set_evictions_enabled(cache_ptr, TRUE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; HDsnprintf(msg, (size_t)128, "can't enable evictions 2."); failure_mssg = msg; - } + } } if(show_progress) /* 29 */ @@ -15824,17 +15824,17 @@ check_evictions_enabled(unsigned paged) /* verify that the cache has returned to its maximum size */ if(pass) { - if((cache_ptr->index_len != 16) || - (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || - (cache_ptr->slist_len != 3) || - (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE) || - (cache_ptr->evictions_enabled != TRUE)) { + if((cache_ptr->index_len != 16) || + (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) || + (cache_ptr->slist_len != 3) || + (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE) || + (cache_ptr->evictions_enabled != TRUE)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected cache status 11."); failure_mssg = msg; - } + } } if(show_progress) /* 31 */ @@ -15846,30 +15846,30 @@ check_evictions_enabled(unsigned paged) entry_ptr = &(base_addr[4]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if(result < 0) { + if(result < 0) { pass = FALSE; HDsnprintf(msg, (size_t)128, "H5C_get_entry_status() reports failure 5."); failure_mssg = msg; - } else if(in_cache) { + } else if(in_cache) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected status 5."); failure_mssg = msg; } else if((!entry_ptr->deserialized) || - ( entry_ptr->serialized) || - (!entry_ptr->destroyed)) { + ( entry_ptr->serialized) || + (!entry_ptr->destroyed)) { pass = FALSE; HDsnprintf(msg, (size_t)128, "Unexpected entry history 5."); failure_mssg = msg; - } + } } if(show_progress) /* 32 */ @@ -15881,12 +15881,12 @@ check_evictions_enabled(unsigned paged) result = H5C_set_evictions_enabled(cache_ptr, FALSE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; HDsnprintf(msg, (size_t)128, "can't disable evictions 3."); failure_mssg = msg; - } + } } if(show_progress) /* 33 */ @@ -15914,16 +15914,16 @@ check_evictions_enabled(unsigned paged) } /* check_evictions_enabled() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_protected_err() + * Function: check_flush_protected_err() * - * Purpose: Verify that an attempt to flush the cache when it contains - * a protected entry will generate an error. + * Purpose: Verify that an attempt to flush the cache when it contains + * a protected entry will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -15989,17 +15989,17 @@ check_flush_protected_err(unsigned paged) } /* check_flush_protected_err() */ - + /*------------------------------------------------------------------------- - * Function: check_destroy_pinned_err() + * Function: check_destroy_pinned_err() * - * Purpose: Verify that an attempt to destroy the cache when it contains - * a pinned entry that can't be unpined during the flush destroy - * will generate an error. + * Purpose: Verify that an attempt to destroy the cache when it contains + * a pinned entry that can't be unpined during the flush destroy + * will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/7/06 * * Modifications: @@ -16030,7 +16030,7 @@ check_destroy_pinned_err(unsigned paged) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); if(H5C_prep_for_file_close(file_ptr) < 0) { pass = FALSE; @@ -16041,8 +16041,8 @@ check_destroy_pinned_err(unsigned paged) pass = FALSE; failure_mssg = "destroy succeeded on cache with pinned entry.\n"; } /* end if */ - else { - unpin_entry(0, 0); + else { + unpin_entry(0, 0); if(H5C_dest(file_ptr) < 0) { pass = FALSE; @@ -16057,11 +16057,11 @@ check_destroy_pinned_err(unsigned paged) saved_cache = NULL; } /* end if */ - /* call takedown_cache() with a NULL file_ptr parameter. - * This causes the function to close and delete the file, - * while skipping the call to H5C_dest(). - */ - takedown_cache(NULL, FALSE, FALSE); + /* call takedown_cache() with a NULL file_ptr parameter. + * This causes the function to close and delete the file, + * while skipping the call to H5C_dest(). + */ + takedown_cache(NULL, FALSE, FALSE); } /* end if */ if(pass) { PASSED(); } else { H5_FAILED(); } @@ -16073,16 +16073,16 @@ check_destroy_pinned_err(unsigned paged) } /* check_destroy_pinned_err() */ - + /*------------------------------------------------------------------------- - * Function: check_destroy_protected_err() + * Function: check_destroy_protected_err() * - * Purpose: Verify that an attempt to destroy the cache when it contains - * a protected entry will generate an error. + * Purpose: Verify that an attempt to destroy the cache when it contains + * a protected entry will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -16133,27 +16133,27 @@ check_destroy_protected_err(unsigned paged) pass = FALSE; failure_mssg = "destroy succeeded on cache with protected entry.\n"; } /* end if */ - else { + else { unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); if(H5C_dest(file_ptr) < 0) { pass = FALSE; failure_mssg = "destroy failed after unprotect.\n"; } /* end if */ - else { + else { file_ptr->shared->cache = NULL; - } /* end else */ - } /* end else */ + } /* end else */ + } /* end else */ if(saved_cache != NULL) { file_ptr->shared->cache = saved_cache; saved_cache = NULL; } /* end if */ - /* call takedown_cache() with a NULL file_ptr parameter. - * This causes the function to close and delete the file, - * while skipping the call to H5C_dest(). - */ - takedown_cache(NULL, FALSE, FALSE); + /* call takedown_cache() with a NULL file_ptr parameter. + * This causes the function to close and delete the file, + * while skipping the call to H5C_dest(). + */ + takedown_cache(NULL, FALSE, FALSE); } /* end if */ if(pass) { PASSED(); } else { H5_FAILED(); } @@ -16165,16 +16165,16 @@ check_destroy_protected_err(unsigned paged) } /* check_destroy_protected_err() */ - + /*------------------------------------------------------------------------- - * Function: check_duplicate_insert_err() + * Function: check_duplicate_insert_err() * - * Purpose: Verify that an attempt to insert and entry that is - * alread in the cache will generate an error. + * Purpose: Verify that an attempt to insert and entry that is + * alread in the cache will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -16245,21 +16245,21 @@ check_duplicate_insert_err(unsigned paged) } /* check_duplicate_insert_err() */ - + /*------------------------------------------------------------------------- - * Function: check_double_pin_err() + * Function: check_double_pin_err() * - * Purpose: Verify that an attempt to pin an entry that is already - * pinned will generate an error. + * Purpose: Verify that an attempt to pin an entry that is already + * pinned will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/24/06 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -16312,8 +16312,8 @@ check_double_pin_err(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG); - } + unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG); + } } if(pass) { @@ -16333,21 +16333,21 @@ check_double_pin_err(unsigned paged) } /* check_double_pin_err() */ - + /*------------------------------------------------------------------------- - * Function: check_double_unpin_err() + * Function: check_double_unpin_err() * - * Purpose: Verify that an attempt to unpin an unpinned entry will - * generate an error. + * Purpose: Verify that an attempt to unpin an unpinned entry will + * generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/24/06 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -16398,13 +16398,13 @@ check_double_unpin_err(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); - } + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + } } if(pass) { - result = H5C_unpin_entry((void *)entry_ptr); + result = H5C_unpin_entry((void *)entry_ptr); if(result > 0) { @@ -16432,21 +16432,21 @@ check_double_unpin_err(unsigned paged) } /* check_double_unpin_err() */ - + /*------------------------------------------------------------------------- - * Function: check_pin_entry_errs() + * Function: check_pin_entry_errs() * - * Purpose: Verify that invalid calls to H5C_pin_protected_entry() - * generate errors as expected. + * Purpose: Verify that invalid calls to H5C_pin_protected_entry() + * generate errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/24/06 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -16485,7 +16485,7 @@ check_pin_entry_errs(unsigned paged) protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); entry_ptr = &((entries[0])[0]); } @@ -16504,10 +16504,10 @@ check_pin_entry_errs(unsigned paged) protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); protect_entry(file_ptr, 0, 0); - } + } } if(pass) { @@ -16522,9 +16522,9 @@ check_pin_entry_errs(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__UNPIN_ENTRY_FLAG); - } + } } if(pass) { @@ -16544,16 +16544,16 @@ check_pin_entry_errs(unsigned paged) } /* check_pin_entry_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_double_protect_err() + * Function: check_double_protect_err() * - * Purpose: Verify that an attempt to protect an entry that is already - * protected will generate an error. + * Purpose: Verify that an attempt to protect an entry that is already + * protected will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * *------------------------------------------------------------------------- @@ -16592,8 +16592,8 @@ check_double_protect_err(unsigned paged) if(pass) { cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, - types[0], entry_ptr->addr, - &entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, + &entry_ptr->addr, H5C__NO_FLAGS_SET); if(cache_entry_ptr != NULL) { @@ -16624,16 +16624,16 @@ check_double_protect_err(unsigned paged) } /* check_double_protect_err() */ - + /*------------------------------------------------------------------------- - * Function: check_double_unprotect_err() + * Function: check_double_unprotect_err() * - * Purpose: Verify that an attempt to unprotect an entry that is already - * unprotected will generate an error. + * Purpose: Verify that an attempt to unprotect an entry that is already + * unprotected will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * *------------------------------------------------------------------------- @@ -16701,19 +16701,19 @@ check_double_unprotect_err(unsigned paged) } /* check_double_unprotect_err() */ - + /*------------------------------------------------------------------------- - * Function: check_mark_entry_dirty_errs() + * Function: check_mark_entry_dirty_errs() * - * Purpose: Verify that: + * Purpose: Verify that: * - * 1) a call to H5C_mark_entry_dirty with - * and unpinned and unprotected entry will generate an - * error. + * 1) a call to H5C_mark_entry_dirty with + * and unpinned and unprotected entry will generate an + * error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 5/17/06 * *------------------------------------------------------------------------- @@ -16747,14 +16747,14 @@ check_mark_entry_dirty_errs(unsigned paged) protect_entry(file_ptr, 0, 0); - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); entry_ptr = &((entries[0])[0]); } if(pass) { - result = H5C_mark_entry_dirty((void *)entry_ptr); + result = H5C_mark_entry_dirty((void *)entry_ptr); if(result > 0) { @@ -16782,21 +16782,21 @@ check_mark_entry_dirty_errs(unsigned paged) } /* check_mark_entry_dirty_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_expunge_entry_errs() + * Function: check_expunge_entry_errs() * - * Purpose: Verify that invalid calls to H5C_expunge_entry() - * generate errors as expected. + * Purpose: Verify that invalid calls to H5C_expunge_entry() + * generate errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/6/06 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -16841,7 +16841,7 @@ check_expunge_entry_errs(unsigned paged) if(pass) { - result = H5C_expunge_entry(file_ptr, + result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16852,14 +16852,14 @@ check_expunge_entry_errs(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - } + } } if(pass) { - result = H5C_expunge_entry(file_ptr, + result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result > 0) { @@ -16870,14 +16870,14 @@ check_expunge_entry_errs(unsigned paged) } else { - unpin_entry(0, 0); + unpin_entry(0, 0); - } + } } if(pass) { - result = H5C_expunge_entry(file_ptr, + result = H5C_expunge_entry(file_ptr, types[0], entry_ptr->addr, H5C__NO_FLAGS_SET); if(result < 0) { @@ -16886,7 +16886,7 @@ check_expunge_entry_errs(unsigned paged) failure_mssg = "attempt to expunge an unpinned and unprotected entry failed.\n"; - } + } } @@ -16907,16 +16907,16 @@ check_expunge_entry_errs(unsigned paged) } /* check_expunge_entry_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_move_entry_errs() + * Function: check_move_entry_errs() * - * Purpose: Verify that invalid calls to H5C_move_entry() - * generates errors as expected. + * Purpose: Verify that invalid calls to H5C_move_entry() + * generates errors as expected. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 12/10/16 * *------------------------------------------------------------------------- @@ -17000,7 +17000,7 @@ check_move_entry_errs(unsigned paged) } /* end if */ if(pass) { - result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10); + result = H5C_move_entry(cache_ptr, types[0], entry_ptr->header.addr, entry_ptr->header.addr + 10); if(result >= 0) { pass = FALSE; @@ -17024,16 +17024,16 @@ check_move_entry_errs(unsigned paged) return (unsigned)!pass; } /* check_move_entry_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_resize_entry_errs() + * Function: check_resize_entry_errs() * - * Purpose: Verify that invalid calls to H5C_resize_entry() - * generates errors as expected. + * Purpose: Verify that invalid calls to H5C_resize_entry() + * generates errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -17078,7 +17078,7 @@ check_resize_entry_errs(unsigned paged) if(pass) { - result = H5C_resize_entry((void *)entry_ptr, (size_t)1); + result = H5C_resize_entry((void *)entry_ptr, (size_t)1); if(result < 0) { @@ -17088,14 +17088,14 @@ check_resize_entry_errs(unsigned paged) } else { - unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); + unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - } + } } if(pass) { - result = H5C_resize_entry((void *)entry_ptr, (size_t)0); + result = H5C_resize_entry((void *)entry_ptr, (size_t)0); if(result >= 0) { @@ -17105,9 +17105,9 @@ check_resize_entry_errs(unsigned paged) } else { - unpin_entry(0, 0); + unpin_entry(0, 0); - } + } } if(pass) { @@ -17127,16 +17127,16 @@ check_resize_entry_errs(unsigned paged) } /* check_resize_entry_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_unprotect_ro_dirty_err() + * Function: check_unprotect_ro_dirty_err() * - * Purpose: If an entry is protected read only, verify that unprotecting - * it dirty will generate an error. + * Purpose: If an entry is protected read only, verify that unprotecting + * it dirty will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/3/07 * *------------------------------------------------------------------------- @@ -17187,7 +17187,7 @@ check_unprotect_ro_dirty_err(unsigned paged) if(pass) { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); } @@ -17229,8 +17229,8 @@ check_unprotect_ro_dirty_err(unsigned paged) if(pass) { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); } @@ -17251,21 +17251,21 @@ check_unprotect_ro_dirty_err(unsigned paged) } /* check_unprotect_ro_dirty_err() */ - + /*------------------------------------------------------------------------- - * Function: check_protect_ro_rw_err() + * Function: check_protect_ro_rw_err() * - * Purpose: If an entry is protected read only, verify that protecting - * it rw will generate an error. + * Purpose: If an entry is protected read only, verify that protecting + * it rw will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/9/07 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -17304,8 +17304,8 @@ check_protect_ro_rw_err(unsigned paged) if(pass) { thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, - types[0], entry_ptr->addr, - &entry_ptr->addr, H5C__NO_FLAGS_SET); + types[0], entry_ptr->addr, + &entry_ptr->addr, H5C__NO_FLAGS_SET); if(thing_ptr != NULL) { @@ -17316,7 +17316,7 @@ check_protect_ro_rw_err(unsigned paged) if(pass) { - unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, 0, 0, H5C__NO_FLAGS_SET); } if(pass) { @@ -17336,16 +17336,16 @@ check_protect_ro_rw_err(unsigned paged) } /* check_protect_ro_rw_err() */ - + /*------------------------------------------------------------------------- - * Function: check_protect_retries() + * Function: check_protect_retries() * - * Purpose: To exercise checksum verification retries for an entry with - * a speculative load. + * Purpose: To exercise checksum verification retries for an entry with + * a speculative load. * - * Return: + * Return: * - * Programmer: + * Programmer: * *------------------------------------------------------------------------- */ @@ -17374,8 +17374,8 @@ check_protect_retries(unsigned paged) file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged); - /* Set up read attempts for verifying checksum */ - file_ptr->shared->read_attempts = 10; + /* Set up read attempts for verifying checksum */ + file_ptr->shared->read_attempts = 10; file_ptr->shared->retries_nbins = 1; } @@ -17385,30 +17385,30 @@ check_protect_retries(unsigned paged) if(pass) { - cache_ptr = file_ptr->shared->cache; - base_addr = entries[type]; + cache_ptr = file_ptr->shared->cache; + base_addr = entries[type]; entry_ptr = &(base_addr[idx]); - /* test case (1): - * --actual_len is smaller the initial length from get_load_size() - * --verify_chksum() returns TRUE after max_verify_ct is reached - * - */ - entry_ptr->actual_len = entry_ptr->size/2; + /* test case (1): + * --actual_len is smaller the initial length from get_load_size() + * --verify_chksum() returns TRUE after max_verify_ct is reached + * + */ + entry_ptr->actual_len = entry_ptr->size/2; entry_ptr->max_verify_ct = 3; entry_ptr->verify_ct = 0; - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); - if((cache_entry_ptr != (void *)entry_ptr) || + if((cache_entry_ptr != (void *)entry_ptr) || (!(entry_ptr->header.is_protected)) || (!(entry_ptr->header.is_read_only)) || (entry_ptr->header.ro_ref_count <= 0) || (entry_ptr->header.type != types[type]) || (entry_ptr->size != entry_ptr->header.size) || (entry_ptr->addr != entry_ptr->header.addr) || - (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) { + (entry_ptr->verify_ct != entry_ptr->max_verify_ct)) { pass = FALSE; failure_mssg = "error from H5C_protect()."; @@ -17429,26 +17429,26 @@ check_protect_retries(unsigned paged) } if(pass) - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, idx, H5C__NO_FLAGS_SET); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, idx, H5C__NO_FLAGS_SET); if(pass) { entry_ptr = &(base_addr[++idx]); - /* test case (2): - * --actual_len is greater the initial length from get_load_size() - * --verify_chksum() returns FALSE even after all tries is reached - * (file_ptr->shared->read_attempts is smaller then max_verify_ct) - */ - entry_ptr->actual_len = entry_ptr->size*2; + /* test case (2): + * --actual_len is greater the initial length from get_load_size() + * --verify_chksum() returns FALSE even after all tries is reached + * (file_ptr->shared->read_attempts is smaller then max_verify_ct) + */ + entry_ptr->actual_len = entry_ptr->size*2; entry_ptr->max_verify_ct = 11; entry_ptr->verify_ct = 0; - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); - /* H5C_protect() should fail after all retries fail */ - if(cache_entry_ptr != NULL) - pass = FALSE; + /* H5C_protect() should fail after all retries fail */ + if(cache_entry_ptr != NULL) + pass = FALSE; } @@ -17467,21 +17467,21 @@ check_protect_retries(unsigned paged) } /* check_protect_retries() */ - + /*------------------------------------------------------------------------- - * Function: check_evictions_enabled_err() + * Function: check_evictions_enabled_err() * - * Purpose: Verify that H5C_get_evictions_enabled() and + * Purpose: Verify that H5C_get_evictions_enabled() and * H5C_set_evictions_enabled() generate errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/3/07 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -17524,9 +17524,9 @@ check_check_evictions_enabled_err(unsigned paged) if(pass) { - result = H5C_get_evictions_enabled(NULL, &evictions_enabled); + result = H5C_get_evictions_enabled(NULL, &evictions_enabled); - if(result == SUCCEED) { + if(result == SUCCEED) { pass = FALSE; failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n"; @@ -17535,9 +17535,9 @@ check_check_evictions_enabled_err(unsigned paged) if(pass) { - result = H5C_get_evictions_enabled(cache_ptr, NULL); + result = H5C_get_evictions_enabled(cache_ptr, NULL); - if(result == SUCCEED) { + if(result == SUCCEED) { pass = FALSE; failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n"; @@ -17546,30 +17546,30 @@ check_check_evictions_enabled_err(unsigned paged) if(pass) { - result = H5C_set_evictions_enabled(cache_ptr, TRUE); + result = H5C_set_evictions_enabled(cache_ptr, TRUE); - if(result != SUCCEED) { + if(result != SUCCEED) { pass = FALSE; failure_mssg = "H5C_set_evictions_enabled failed().\n"; - } + } } if(pass) { (cache_ptr->resize_ctl).incr_mode = H5C_incr__threshold; - result = H5C_get_evictions_enabled(cache_ptr, FALSE); + result = H5C_get_evictions_enabled(cache_ptr, FALSE); - if(result == SUCCEED) { + if(result == SUCCEED) { pass = FALSE; failure_mssg = "H5C_get_evictions_enabled succeeded() 1.\n"; } else if(cache_ptr->evictions_enabled == TRUE) { - } + } (cache_ptr->resize_ctl).incr_mode = H5C_incr__off; } @@ -17578,9 +17578,9 @@ check_check_evictions_enabled_err(unsigned paged) (cache_ptr->resize_ctl).decr_mode = H5C_decr__threshold; - result = H5C_get_evictions_enabled(cache_ptr, FALSE); + result = H5C_get_evictions_enabled(cache_ptr, FALSE); - if(result == SUCCEED) { + if(result == SUCCEED) { pass = FALSE; failure_mssg = "H5C_get_evictions_enabled succeeded() 2.\n"; @@ -17607,18 +17607,18 @@ check_check_evictions_enabled_err(unsigned paged) } /* check_evictions_enabled_err() */ - + /*------------------------------------------------------------------------- - * Function: check_auto_cache_resize() + * Function: check_auto_cache_resize() * - * Purpose: Exercise the automatic cache resizing functionality. - * The objective is to operate the auto-resize code in - * all possible modes. Unfortunately, there are quite - * a few of them. + * Purpose: Exercise the automatic cache resizing functionality. + * The objective is to operate the auto-resize code in + * all possible modes. Unfortunately, there are quite + * a few of them. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/29/04 * *------------------------------------------------------------------------- @@ -17675,9 +17675,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -18045,9 +18045,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1000 * 1000); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18333,7 +18333,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); i++; } - + if((!rpt_fcn_called) || (rpt_status != decrease) || @@ -18377,9 +18377,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -18558,9 +18558,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -18598,7 +18598,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(cork_ageout) - cork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); + cork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); /* fill the cache with 1024 byte entries -- nothing should happen * for three epochs while the markers are inserted into the cache @@ -18908,7 +18908,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); if(cork_ageout) - uncork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); + uncork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); /* repeat the above test, but with max_decrement enabled to see @@ -18941,9 +18941,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19453,9 +19453,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -19857,9 +19857,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -20114,9 +20114,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -20638,7 +20638,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { flush_cache(file_ptr, TRUE, FALSE, FALSE); - reset_entries(); + reset_entries(); } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20672,9 +20672,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (32 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - auto_size_ctl.flash_multiple = 1.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 1.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -20702,9 +20702,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if((cache_ptr->max_cache_size != (64 * 1024)) || (cache_ptr->min_clean_size != (32 * 1024)) || - (cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->cache_accesses != 0)) { + (cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->cache_accesses != 0)) { pass = FALSE; failure_mssg = "Unexpected cache config (0).\n"; @@ -20721,16 +20721,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (64 * 1024)) || - (cache_ptr->min_clean_size != (32 * 1024)) || - (cache_ptr->index_len != 1) || + if(pass && + (((cache_ptr->max_cache_size != (64 * 1024)) || + (cache_ptr->min_clean_size != (32 * 1024)) || + (cache_ptr->index_len != 1) || (cache_ptr->index_size != HUGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (1).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20747,17 +20747,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (80 * 1024)) || - (cache_ptr->min_clean_size != (40 * 1024)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (80 * 1024)) || + (cache_ptr->min_clean_size != (40 * 1024)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != (HUGE_ENTRY_SIZE + - MONSTER_ENTRY_SIZE)) || - (cache_ptr->cache_accesses != 1)))) { + MONSTER_ENTRY_SIZE)) || + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (2).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20773,17 +20773,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (144 * 1024)) || - (cache_ptr->min_clean_size != (72 * 1024)) || - (cache_ptr->index_len != 3) || + if(pass && + (((cache_ptr->max_cache_size != (144 * 1024)) || + (cache_ptr->min_clean_size != (72 * 1024)) || + (cache_ptr->index_len != 3) || (cache_ptr->index_size != ((2 * MONSTER_ENTRY_SIZE) + - HUGE_ENTRY_SIZE)) || - (cache_ptr->cache_accesses != 1)))) { + HUGE_ENTRY_SIZE)) || + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (3).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20797,16 +20797,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 2, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (144 * 1024)) || - (cache_ptr->min_clean_size != (72 * 1024)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (144 * 1024)) || + (cache_ptr->min_clean_size != (72 * 1024)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) || - (cache_ptr->cache_accesses != 2)))) { + (cache_ptr->cache_accesses != 2)))) { pass = FALSE; failure_mssg = "Unexpected cache config (4).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20816,8 +20816,8 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) */ if(pass) { - expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 1); - expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 2); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 1); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 2); if(pass) { @@ -20825,19 +20825,19 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(result != SUCCEED) { pass = FALSE; failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; - } + } } - if(pass && - (((cache_ptr->max_cache_size != (64 * 1024)) || - (cache_ptr->min_clean_size != (32 * 1024)) || - (cache_ptr->index_len != 0) || + if(pass && + (((cache_ptr->max_cache_size != (64 * 1024)) || + (cache_ptr->min_clean_size != (32 * 1024)) || + (cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (5).\n"; - } + } } /* repeat the above basic test, only this time, use inserts to add @@ -20851,22 +20851,22 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) insert_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); - /* protect and unprotect a couple times to increment cache_accesses */ + /* protect and unprotect a couple times to increment cache_accesses */ protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); protect_entry(file_ptr, HUGE_ENTRY_TYPE, 1); unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (64 * 1024)) || - (cache_ptr->min_clean_size != (32 * 1024)) || - (cache_ptr->index_len != 1) || + if(pass && + (((cache_ptr->max_cache_size != (64 * 1024)) || + (cache_ptr->min_clean_size != (32 * 1024)) || + (cache_ptr->index_len != 1) || (cache_ptr->index_size != HUGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 2)))) { + (cache_ptr->cache_accesses != 2)))) { pass = FALSE; failure_mssg = "Unexpected cache config (6).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20880,17 +20880,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 4, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (80 * 1024)) || - (cache_ptr->min_clean_size != (40 * 1024)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (80 * 1024)) || + (cache_ptr->min_clean_size != (40 * 1024)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != - HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 0)))) { + HUGE_ENTRY_SIZE + MONSTER_ENTRY_SIZE) || + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (7).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20901,17 +20901,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) insert_entry(file_ptr, MONSTER_ENTRY_TYPE, 5, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (144 * 1024)) || - (cache_ptr->min_clean_size != (72 * 1024)) || - (cache_ptr->index_len != 3) || + if(pass && + (((cache_ptr->max_cache_size != (144 * 1024)) || + (cache_ptr->min_clean_size != (72 * 1024)) || + (cache_ptr->index_len != 3) || (cache_ptr->index_size != - 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 0)))) { + 2 * MONSTER_ENTRY_SIZE + HUGE_ENTRY_SIZE) || + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (8).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20925,16 +20925,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 6, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (144 * 1024)) || - (cache_ptr->min_clean_size != (72 * 1024)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (144 * 1024)) || + (cache_ptr->min_clean_size != (72 * 1024)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != (2 * MONSTER_ENTRY_SIZE)) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (9).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -20946,26 +20946,26 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) */ if(pass) { - expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 5); - expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 6); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 5); + expunge_entry(file_ptr, MONSTER_ENTRY_TYPE, 6); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 1024, TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 1024, TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 1024, TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, 1024, TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__DIRTIED_FLAG); - flush_cache(file_ptr, TRUE, FALSE, FALSE); + flush_cache(file_ptr, TRUE, FALSE, FALSE); if(pass) { @@ -20977,19 +20977,19 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) pass = FALSE; failure_mssg = "H5C_set_cache_auto_resize_config failed 13.\n"; - } + } } - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (3 * 1024)) || - (cache_ptr->index_len != 0) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (3 * 1024)) || + (cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (10).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21009,16 +21009,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (3 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (3 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * 1024) || - (cache_ptr->cache_accesses != 4)))) { + (cache_ptr->cache_accesses != 4)))) { pass = FALSE; failure_mssg = "Unexpected cache config (11).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21029,20 +21029,20 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (3 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (3 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (3 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 6 * 1024) || - (cache_ptr->cache_accesses != 5)))) { + (cache_ptr->cache_accesses != 5)))) { pass = FALSE; failure_mssg = "Unexpected cache config (12).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21054,20 +21054,20 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (10 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (13 * 1024)) || - (cache_ptr->min_clean_size != (13 * 512)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (13 * 1024)) || + (cache_ptr->min_clean_size != (13 * 512)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 13 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (13).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21078,20 +21078,20 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (10 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 22 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (14).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21102,20 +21102,20 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (10 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 31 * 1024) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (15).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21127,16 +21127,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); if(pass) { @@ -21147,19 +21147,19 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) pass = FALSE; failure_mssg = "H5C_set_cache_auto_resize_config failed 14.\n"; - } + } } - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (3 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (3 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (16).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21172,16 +21172,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (6 * 512)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (6 * 512)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 5 * 1024) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (17).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21190,16 +21190,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (13 * 1024)) || - (cache_ptr->min_clean_size != (13 * 512)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (13 * 1024)) || + (cache_ptr->min_clean_size != (13 * 512)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 13 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (18).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21210,16 +21210,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 22 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (19).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21230,16 +21230,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 31 * 1024) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (20).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21258,16 +21258,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__UNPIN_ENTRY_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 31 * 1024) || - (cache_ptr->cache_accesses != 4)))) { + (cache_ptr->cache_accesses != 4)))) { pass = FALSE; failure_mssg = "Unexpected cache config (21).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21279,16 +21279,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if(pass) { protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__DIRTIED_FLAG); protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); - resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE); - unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); + resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, (1 * 1024), TRUE); + unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__DIRTIED_FLAG); if(pass) { @@ -21299,19 +21299,19 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) pass = FALSE; failure_mssg = "H5C_set_cache_auto_resize_config failed 15.\n"; - } + } } - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (3 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (3 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 4 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (22).\n"; - } + } } if(pass) { @@ -21320,16 +21320,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 2 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (6 * 1024)) || - (cache_ptr->min_clean_size != (6 * 512)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (6 * 1024)) || + (cache_ptr->min_clean_size != (6 * 512)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 5 * 1024) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (23).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21338,16 +21338,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (13 * 1024)) || - (cache_ptr->min_clean_size != (13 * 512)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (13 * 1024)) || + (cache_ptr->min_clean_size != (13 * 512)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 13 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (24).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21358,16 +21358,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 22 * 1024) || - (cache_ptr->cache_accesses != 0)))) { + (cache_ptr->cache_accesses != 0)))) { pass = FALSE; failure_mssg = "Unexpected cache config (25).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21378,16 +21378,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__PIN_ENTRY_FLAG); resize_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, 10 * 1024, TRUE); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 31 * 1024) || - (cache_ptr->cache_accesses != 1)))) { + (cache_ptr->cache_accesses != 1)))) { pass = FALSE; failure_mssg = "Unexpected cache config (26).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21406,16 +21406,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); unprotect_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12, H5C__UNPIN_ENTRY_FLAG); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 4) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 4) || (cache_ptr->index_size != 31 * 1024) || - (cache_ptr->cache_accesses != 4)))) { + (cache_ptr->cache_accesses != 4)))) { pass = FALSE; failure_mssg = "Unexpected cache config (27).\n"; - } + } } /* We have finished a basic check of the flash cache size increment @@ -21423,21 +21423,21 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) */ if(pass) { - expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); - expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); - expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); - expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 10); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 11); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 12); + expunge_entry(file_ptr, VARIABLE_ENTRY_TYPE, 13); - if(pass && - (((cache_ptr->max_cache_size != (22 * 1024)) || - (cache_ptr->min_clean_size != (11 * 1024)) || - (cache_ptr->index_len != 0) || + if(pass && + (((cache_ptr->max_cache_size != (22 * 1024)) || + (cache_ptr->min_clean_size != (11 * 1024)) || + (cache_ptr->index_len != 0) || (cache_ptr->index_size != 0) || - (cache_ptr->cache_accesses != 4)))) { + (cache_ptr->cache_accesses != 4)))) { pass = FALSE; failure_mssg = "Unexpected cache config (28).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21471,9 +21471,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.4f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__add_space; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.4f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -21503,9 +21503,9 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if((cache_ptr->max_cache_size != (4 * 1024)) || (cache_ptr->min_clean_size != (4 * 512)) || - (cache_ptr->index_len != 0) || - (cache_ptr->index_size != 0) || - (cache_ptr->cache_accesses != 0)) { + (cache_ptr->index_len != 0) || + (cache_ptr->index_size != 0) || + (cache_ptr->cache_accesses != 0)) { pass = FALSE; failure_mssg = "bad cache after initialization 15.\n"; @@ -21524,17 +21524,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (4 * 1024)) || - (cache_ptr->min_clean_size != (4 * 512)) || - (cache_ptr->index_len != 1) || + if(pass && + (((cache_ptr->max_cache_size != (4 * 1024)) || + (cache_ptr->min_clean_size != (4 * 512)) || + (cache_ptr->index_len != 1) || (cache_ptr->index_size != LARGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 1) || - (rpt_fcn_called == TRUE)))) { + (cache_ptr->cache_accesses != 1) || + (rpt_fcn_called == TRUE)))) { pass = FALSE; failure_mssg = "Unexpected cache config (29).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21550,17 +21550,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, LARGE_ENTRY_TYPE, 1); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 1, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (12 * 1024)) || - (cache_ptr->min_clean_size != (12 * 512)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (12 * 1024)) || + (cache_ptr->min_clean_size != (12 * 512)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != 2 * LARGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 1) || - (rpt_fcn_called != TRUE)))) { + (cache_ptr->cache_accesses != 1) || + (rpt_fcn_called != TRUE)))) { pass = FALSE; failure_mssg = "Unexpected cache config (30).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21577,17 +21577,17 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, LARGE_ENTRY_TYPE, 3); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 3, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (12 * 1024)) || - (cache_ptr->min_clean_size != (12 * 512)) || - (cache_ptr->index_len != 3) || + if(pass && + (((cache_ptr->max_cache_size != (12 * 1024)) || + (cache_ptr->min_clean_size != (12 * 512)) || + (cache_ptr->index_len != 3) || (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 3) || - (rpt_fcn_called != FALSE)))) { + (cache_ptr->cache_accesses != 3) || + (rpt_fcn_called != FALSE)))) { pass = FALSE; failure_mssg = "Unexpected cache config (31).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21628,19 +21628,19 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) protect_entry(file_ptr, LARGE_ENTRY_TYPE, 0); unprotect_entry(file_ptr, LARGE_ENTRY_TYPE, 0, H5C__NO_FLAGS_SET); - if(pass && - (((cache_ptr->max_cache_size != (4 * 1024 + 128)) || - (cache_ptr->min_clean_size != (2 * 1024 + 64)) || - (cache_ptr->index_len != 2) || + if(pass && + (((cache_ptr->max_cache_size != (4 * 1024 + 128)) || + (cache_ptr->min_clean_size != (2 * 1024 + 64)) || + (cache_ptr->index_len != 2) || (cache_ptr->index_size != - LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE) || - (cache_ptr->cache_accesses != 1) || - (rpt_fcn_called == FALSE) || + LARGE_ENTRY_SIZE + TINY_ENTRY_SIZE) || + (cache_ptr->cache_accesses != 1) || + (rpt_fcn_called == FALSE) || (rpt_status != flash_increase)))) { pass = FALSE; failure_mssg = "Unexpected cache config (33).\n"; - } + } } if(show_progress) HDfprintf(stderr, "check point %d\n", checkpoint++); @@ -21661,7 +21661,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) if((cache_ptr->max_cache_size != (20 * 1024)) || (cache_ptr->min_clean_size != (10 * 1024)) || - (rpt_fcn_called == FALSE) || + (rpt_fcn_called == FALSE) || (rpt_status != at_max_size)) { pass = FALSE; @@ -21692,16 +21692,16 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged) return (unsigned)!pass; } /* check_auto_cache_resize() */ - + /*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_disable() + * Function: check_auto_cache_resize_disable() * - * Purpose: Test the various ways in which the resize code can - * be disabled. Unfortunately, there are quite a few of them. + * Purpose: Test the various ways in which the resize code can + * be disabled. Unfortunately, there are quite a few of them. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 12/16/04 * * Modifications: @@ -21748,7 +21748,7 @@ check_auto_cache_resize_disable(unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, + /* flash_incr_mode = */ H5C_flash_incr__off, /* double flash_multiple = */ 1.0f, /* double flash_threshold = */ 0.25f, @@ -21793,7 +21793,7 @@ check_auto_cache_resize_disable(unsigned paged) pass = FALSE; failure_mssg = "file_ptr NULL from setup_cache."; - } + } else { cache_ptr = file_ptr->shared->cache; @@ -21856,9 +21856,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22014,9 +22014,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22171,9 +22171,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = FALSE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22328,9 +22328,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22485,9 +22485,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -22641,9 +22641,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__off; @@ -22799,9 +22799,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -23026,9 +23026,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -23260,9 +23260,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -23498,9 +23498,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23625,9 +23625,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23752,9 +23752,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -23879,9 +23879,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24006,9 +24006,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24134,9 +24134,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__off; @@ -24290,9 +24290,9 @@ check_auto_cache_resize_disable(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (2 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 1.0f; - auto_size_ctl.flash_threshold = 0.25f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 1.0f; + auto_size_ctl.flash_threshold = 0.25f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -24347,16 +24347,16 @@ check_auto_cache_resize_disable(unsigned paged) (cache_ptr->index_size != LARGE_ENTRY_SIZE) || (rpt_fcn_called != FALSE)))) { - HDfprintf(stdout, "\nmax_cache_size = %ld.\n", - (long)(cache_ptr->max_cache_size)); - HDfprintf(stdout, "min_clean_size = %ld.\n", - (long)(cache_ptr->min_clean_size)); - HDfprintf(stdout, "index_len = %ld.\n", - (long)(cache_ptr->index_len)); - HDfprintf(stdout, "index_size = %ld.\n", - (long)(cache_ptr->index_size)); - HDfprintf(stdout, "rpt_fcn_called = %ld.\n", - (long)(rpt_fcn_called)); + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); pass = FALSE; failure_mssg = "Unexpected cache size change results 46.\n"; @@ -24386,16 +24386,16 @@ check_auto_cache_resize_disable(unsigned paged) (cache_ptr->index_size != MONSTER_ENTRY_SIZE) || (rpt_fcn_called != FALSE)))) { - HDfprintf(stdout, "\nmax_cache_size = %ld.\n", - (long)(cache_ptr->max_cache_size)); - HDfprintf(stdout, "min_clean_size = %ld.\n", - (long)(cache_ptr->min_clean_size)); - HDfprintf(stdout, "index_len = %ld.\n", - (long)(cache_ptr->index_len)); - HDfprintf(stdout, "index_size = %ld.\n", - (long)(cache_ptr->index_size)); - HDfprintf(stdout, "rpt_fcn_called = %ld.\n", - (long)(rpt_fcn_called)); + HDfprintf(stdout, "\nmax_cache_size = %ld.\n", + (long)(cache_ptr->max_cache_size)); + HDfprintf(stdout, "min_clean_size = %ld.\n", + (long)(cache_ptr->min_clean_size)); + HDfprintf(stdout, "index_len = %ld.\n", + (long)(cache_ptr->index_len)); + HDfprintf(stdout, "index_size = %ld.\n", + (long)(cache_ptr->index_size)); + HDfprintf(stdout, "rpt_fcn_called = %ld.\n", + (long)(rpt_fcn_called)); pass = FALSE; failure_mssg = "Unexpected cache size change results 47.\n"; @@ -24423,16 +24423,16 @@ check_auto_cache_resize_disable(unsigned paged) } /* check_auto_cache_resize_disable() */ - + /*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_epoch_markers() + * Function: check_auto_cache_resize_epoch_markers() * - * Purpose: Verify that the auto-resize code manages epoch markers - * correctly. + * Purpose: Verify that the auto-resize code manages epoch markers + * correctly. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 12/16/04 * * Modifications: @@ -24476,9 +24476,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -24565,9 +24565,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -24739,9 +24739,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -24860,9 +24860,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -24939,9 +24939,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -25052,9 +25052,9 @@ check_auto_cache_resize_epoch_markers(unsigned paged) auto_size_ctl.apply_max_increment = TRUE; auto_size_ctl.max_increment = (4 * 1024 * 1024); - auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - auto_size_ctl.flash_multiple = 2.0f; - auto_size_ctl.flash_threshold = 0.5f; + auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + auto_size_ctl.flash_multiple = 2.0f; + auto_size_ctl.flash_threshold = 0.5f; auto_size_ctl.decr_mode = H5C_decr__off; @@ -25129,21 +25129,21 @@ check_auto_cache_resize_epoch_markers(unsigned paged) } /* check_auto_cache_resize_epoch_markers() */ - + /*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_input_errs() + * Function: check_auto_cache_resize_input_errs() * - * Purpose: Verify that H5C_set_cache_auto_resize_config() detects - * and rejects invalid input. + * Purpose: Verify that H5C_set_cache_auto_resize_config() detects + * and rejects invalid input. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/29/04 * * Modifications: * - * Added code to verify that errors in the flash cache size + * Added code to verify that errors in the flash cache size * increment related fields are caught as well. * * JRM -- 1/17/08 @@ -25183,9 +25183,9 @@ check_auto_cache_resize_input_errs(unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__threshold, @@ -25291,9 +25291,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25366,9 +25366,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25442,9 +25442,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25515,9 +25515,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25590,9 +25590,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25662,9 +25662,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25738,9 +25738,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25810,9 +25810,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25882,9 +25882,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -25957,9 +25957,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26029,9 +26029,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26096,7 +26096,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) -1; /* INVALID */ + (enum H5C_cache_incr_mode) -1; /* INVALID */ invalid_auto_size_ctl.lower_hr_threshold = 0.75f; @@ -26105,9 +26105,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26169,7 +26169,7 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.incr_mode = - (enum H5C_cache_incr_mode) 2; /* INVALID */ + (enum H5C_cache_incr_mode) 2; /* INVALID */ invalid_auto_size_ctl.lower_hr_threshold = 0.75f; @@ -26178,9 +26178,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26253,9 +26253,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26325,9 +26325,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26397,9 +26397,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26472,9 +26472,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26547,10 +26547,10 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = - (enum H5C_cache_flash_incr_mode) -1; /* INVALID */ - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = + (enum H5C_cache_flash_incr_mode) -1; /* INVALID */ + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26622,10 +26622,10 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = - H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 0.09f; /* INVALID */ - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 0.09f; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26695,10 +26695,10 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = - H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 10.01f; /* INVALID */ - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 10.01f; /* INVALID */ + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26770,10 +26770,10 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = - H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 1.0f; - invalid_auto_size_ctl.flash_threshold = 0.09f; /* INVALID */ + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0f; + invalid_auto_size_ctl.flash_threshold = 0.09f; /* INVALID */ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26843,10 +26843,10 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = - H5C_flash_incr__add_space; - invalid_auto_size_ctl.flash_multiple = 1.0f; - invalid_auto_size_ctl.flash_threshold = 1.001f; /* INVALID */ + invalid_auto_size_ctl.flash_incr_mode = + H5C_flash_incr__add_space; + invalid_auto_size_ctl.flash_multiple = 1.0f; + invalid_auto_size_ctl.flash_threshold = 1.001f; /* INVALID */ invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -26919,13 +26919,13 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = - (enum H5C_cache_decr_mode) -1; /* INVALID */ + (enum H5C_cache_decr_mode) -1; /* INVALID */ invalid_auto_size_ctl.upper_hr_threshold = 0.999f; @@ -26992,13 +26992,13 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = - (enum H5C_cache_decr_mode) 4; /* INVALID */ + (enum H5C_cache_decr_mode) 4; /* INVALID */ invalid_auto_size_ctl.upper_hr_threshold = 0.999f; @@ -27068,9 +27068,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -27140,9 +27140,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__threshold; @@ -27215,9 +27215,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -27286,9 +27286,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -27361,9 +27361,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out; @@ -27432,9 +27432,9 @@ check_auto_cache_resize_input_errs(unsigned paged) invalid_auto_size_ctl.apply_max_increment = TRUE; invalid_auto_size_ctl.max_increment = (2 * 1024 * 1024); - invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; - invalid_auto_size_ctl.flash_multiple = 2.0f; - invalid_auto_size_ctl.flash_threshold = 0.5f; + invalid_auto_size_ctl.flash_incr_mode = H5C_flash_incr__off; + invalid_auto_size_ctl.flash_multiple = 2.0f; + invalid_auto_size_ctl.flash_threshold = 0.5f; invalid_auto_size_ctl.decr_mode = H5C_decr__age_out_with_threshold; @@ -27538,21 +27538,21 @@ check_auto_cache_resize_input_errs(unsigned paged) } /* check_auto_cache_resize_input_errs() */ - + /*------------------------------------------------------------------------- - * Function: check_auto_cache_resize_aux_fcns() + * Function: check_auto_cache_resize_aux_fcns() * - * Purpose: Verify that the auxilary functions associated with - * the automatic cache resize capability are operating - * correctly. These functions are: + * Purpose: Verify that the auxilary functions associated with + * the automatic cache resize capability are operating + * correctly. These functions are: * - * H5C_get_cache_size() - * H5C_get_cache_hit_rate() - * H5C_reset_cache_hit_rate_stats() + * H5C_get_cache_size() + * H5C_get_cache_hit_rate() + * H5C_reset_cache_hit_rate_stats() * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 11/4/04 * * Modifications: @@ -27601,9 +27601,9 @@ check_auto_cache_resize_aux_fcns(unsigned paged) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__off, @@ -28078,11 +28078,11 @@ check_auto_cache_resize_aux_fcns(unsigned paged) } /* check_auto_cache_resize_aux_fcns() */ - + /*------------------------------------------------------------------------- - * Function: check_metadata_blizzard_absence() + * Function: check_metadata_blizzard_absence() * - * Purpose: Test to verify that a 'metadata blizzard' can not occur + * Purpose: Test to verify that a 'metadata blizzard' can not occur * upon insertion into the cache. * * A 'metadata blizzard' in this context occurs when the cache @@ -28096,9 +28096,9 @@ check_auto_cache_resize_aux_fcns(unsigned paged) * flushing the entire cache is what constitutes a 'metadata * blizzard'. * - * Return: void + * Return: void * - * Programmer: Mike McGreevy + * Programmer: Mike McGreevy * * 12/16/08 * @@ -28129,158 +28129,158 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) */ struct expected_entry_status expected[150] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; pass = TRUE; @@ -28441,13 +28441,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) */ /* entry w/ index 0 has now been flushed and is now clean. */ - expected[0].is_dirty = FALSE; - expected[0].serialized = TRUE; + expected[0].is_dirty = FALSE; + expected[0].serialized = TRUE; /* entry w/ index 26 is now in the cache and dirty. */ - expected[26].in_cache = TRUE; - expected[26].is_dirty = TRUE; - expected[26].deserialized = (unsigned char)deserialized; + expected[26].in_cache = TRUE; + expected[26].is_dirty = TRUE; + expected[26].deserialized = (unsigned char)deserialized; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28495,13 +28495,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) */ /* entry w/ index 1 has now been flushed and is now clean. */ - expected[1].is_dirty = FALSE; - expected[1].serialized = TRUE; + expected[1].is_dirty = FALSE; + expected[1].serialized = TRUE; /* entry w/ index 27 is now in the cache and dirty. */ - expected[27].in_cache = TRUE; - expected[27].is_dirty = TRUE; - expected[27].deserialized = (unsigned char)deserialized; + expected[27].in_cache = TRUE; + expected[27].is_dirty = TRUE; + expected[27].deserialized = (unsigned char)deserialized; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28544,9 +28544,9 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) expected[entry_idx - 26].is_dirty = FALSE; expected[entry_idx - 26].serialized = TRUE; - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28617,19 +28617,19 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) */ /* entry w/ index 0 has been evicted. */ - expected[0].in_cache = FALSE; - expected[0].destroyed = TRUE; + expected[0].in_cache = FALSE; + expected[0].destroyed = TRUE; /* entries w/ indices 24,25 have now been flushed and are clean. */ - expected[24].is_dirty = FALSE; - expected[24].serialized = TRUE; - expected[25].is_dirty = FALSE; - expected[25].serialized = TRUE; + expected[24].is_dirty = FALSE; + expected[24].serialized = TRUE; + expected[25].is_dirty = FALSE; + expected[25].serialized = TRUE; /* entry w/ index 50 is now in the cache and dirty */ - expected[50].in_cache = TRUE; - expected[50].is_dirty = TRUE; - expected[50].deserialized = (unsigned char)deserialized; + expected[50].in_cache = TRUE; + expected[50].is_dirty = TRUE; + expected[50].deserialized = (unsigned char)deserialized; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28672,13 +28672,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } /* This past inserted entry is now in the cache and dirty */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; /* The entry inserted 50 insertions ago has been evicted */ - expected[entry_idx - 50].in_cache = FALSE; - expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; /* If the newly inserted entry is among the first 24 * insertions in this loop, then the insertion will @@ -28803,13 +28803,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } /* This past inserted entry is now in the cache and dirty */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; /* The entry with ID minus 50 will have been evicted */ - expected[entry_idx - 50].in_cache = FALSE; - expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28851,17 +28851,17 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) */ /* entry w/ index 76 has been evicted. */ - expected[76].in_cache = FALSE; - expected[76].destroyed = TRUE; + expected[76].in_cache = FALSE; + expected[76].destroyed = TRUE; /* entry w/ index 100 has now been flushed and is now clean. */ - expected[100].is_dirty = FALSE; - expected[100].serialized = TRUE; + expected[100].is_dirty = FALSE; + expected[100].serialized = TRUE; /* entry w/ index 26 is now in the cache and dirty. */ - expected[126].in_cache = TRUE; - expected[126].is_dirty = TRUE; - expected[126].deserialized = (unsigned char)deserialized; + expected[126].in_cache = TRUE; + expected[126].is_dirty = TRUE; + expected[126].deserialized = (unsigned char)deserialized; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -28897,13 +28897,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } /* This past inserted entry is now in the cache and dirty */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; /* The entry with ID minus 50 will have been evicted */ - expected[entry_idx - 50].in_cache = FALSE; - expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; /* The entry with ID minus 26 will now be clean */ expected[entry_idx - 26].is_dirty = FALSE; @@ -28939,15 +28939,15 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged) } /* check_metadata_blizzard_absence() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_deps() + * Function: check_flush_deps() * - * Purpose: Exercise the flush dependency routines. + * Purpose: Exercise the flush dependency routines. * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/12/09 * *------------------------------------------------------------------------- @@ -28963,13 +28963,13 @@ check_flush_deps(unsigned paged) unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; if(paged) @@ -29020,16 +29020,16 @@ check_flush_deps(unsigned paged) if(!pass) CACHE_ERROR("protect_entry failed") /* Check the parent's entry status */ - entry_ptr = &(base_addr[1]); - if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, + entry_ptr = &(base_addr[1]); + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") /* Check the child's entry status */ - entry_ptr = &(base_addr[0]); - if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, + entry_ptr = &(base_addr[0]); + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) @@ -29039,16 +29039,16 @@ check_flush_deps(unsigned paged) if(!pass) CACHE_ERROR("create_flush_dependency failed") /* Check the parent's entry status */ - entry_ptr = &(base_addr[1]); - if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, + entry_ptr = &(base_addr[1]); + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || !is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") /* Check the child's entry status */ - entry_ptr = &(base_addr[0]); - if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, + entry_ptr = &(base_addr[0]); + if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child, NULL) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || !is_flush_dep_child) @@ -30678,15 +30678,15 @@ done: return (unsigned)!pass; } /* check_flush_deps() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_deps_err() + * Function: check_flush_deps_err() * - * Purpose: Check the flush dependency routines for error conditions. + * Purpose: Check the flush dependency routines for error conditions. * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/16/09 * *------------------------------------------------------------------------- @@ -30901,16 +30901,16 @@ done: return (unsigned)!pass; } /* check_flush_deps_err() */ - + /*------------------------------------------------------------------------- - * Function: check_flush_deps_order() + * Function: check_flush_deps_order() * - * Purpose: Verify that the order that entries with flush dependencies + * Purpose: Verify that the order that entries with flush dependencies * is correct * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/17/09 * *------------------------------------------------------------------------- @@ -30925,13 +30925,13 @@ check_flush_deps_order(unsigned paged) unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { PICO_ENTRY_TYPE, 0, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 1, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 2, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 3, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { PICO_ENTRY_TYPE, 4, PICO_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; unsigned flush_order; /* Index for tracking flush order */ @@ -33473,15 +33473,15 @@ done: return (unsigned)!pass; } /* check_flush_deps_order() */ - + /*------------------------------------------------------------------------- - * Function: check_notify_cb() + * Function: check_notify_cb() * - * Purpose: Exercise the client 'notify' callback. + * Purpose: Exercise the client 'notify' callback. * - * Return: 0 on success, non-zero on failure + * Return: 0 on success, non-zero on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 4/28/09 * *------------------------------------------------------------------------- @@ -33498,13 +33498,13 @@ check_notify_cb(unsigned paged) unsigned u; /* Local index variable */ struct expected_entry_status expected[5] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { NOTIFY_ENTRY_TYPE, 0, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 1, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 2, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 3, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { NOTIFY_ENTRY_TYPE, 4, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { NOTIFY_ENTRY_TYPE, 0, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 1, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 2, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 3, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { NOTIFY_ENTRY_TYPE, 4, NOTIFY_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} }; if(paged) @@ -33545,7 +33545,7 @@ check_notify_cb(unsigned paged) if(!pass) CACHE_ERROR("verify_entry_status failed") /* Check the entry's 'after insert' count */ - entry_ptr = &(base_addr[u]); + entry_ptr = &(base_addr[u]); if(1 != entry_ptr->notify_after_insert_count) CACHE_ERROR("invalid notify after insert count") if(0 != entry_ptr->notify_before_evict_count) @@ -33573,7 +33573,7 @@ check_notify_cb(unsigned paged) if(!pass) CACHE_ERROR("verify_entry_status failed") /* Check the entry's 'before evict' count */ - entry_ptr = &(base_addr[u]); + entry_ptr = &(base_addr[u]); if(1 != entry_ptr->notify_after_insert_count) CACHE_ERROR("invalid notify after insert count") if(1 != entry_ptr->notify_before_evict_count) @@ -33601,7 +33601,7 @@ check_notify_cb(unsigned paged) if(!pass) CACHE_ERROR("verify_entry_status failed") /* Check the entry's 'after insert' count */ - entry_ptr = &(base_addr[u]); + entry_ptr = &(base_addr[u]); if(2 != entry_ptr->notify_after_insert_count) CACHE_ERROR("invalid notify after insert count") if(1 != entry_ptr->notify_before_evict_count) @@ -33628,7 +33628,7 @@ check_notify_cb(unsigned paged) if(!pass) CACHE_ERROR("verify_entry_status failed") /* Check the entry's 'after insert' count */ - entry_ptr = &(base_addr[u]); + entry_ptr = &(base_addr[u]); if(2 != entry_ptr->notify_after_insert_count) CACHE_ERROR("invalid notify after insert count") if(1 != entry_ptr->notify_before_evict_count) @@ -33656,7 +33656,7 @@ check_notify_cb(unsigned paged) if(!pass) CACHE_ERROR("verify_entry_status failed") /* Check the entry's 'before evict' count */ - entry_ptr = &(base_addr[u]); + entry_ptr = &(base_addr[u]); if(2 != entry_ptr->notify_after_insert_count) CACHE_ERROR("invalid notify after insert count") if(2 != entry_ptr->notify_before_evict_count) @@ -33676,18 +33676,18 @@ done: return (unsigned)!pass; } /* check_notify_cb() */ - + /*------------------------------------------------------------------------- - * Function: check_metadata_cork + * Function: check_metadata_cork * - * Purpose: To verify that dirty corked entries are not evicted from the cache - * but clean corked entries can be evicted from the cache. - * The min_clean_size does not have effect. - * NOTE: This is a modification of check_metadata_blizzard_absence(). + * Purpose: To verify that dirty corked entries are not evicted from the cache + * but clean corked entries can be evicted from the cache. + * The min_clean_size does not have effect. + * NOTE: This is a modification of check_metadata_blizzard_absence(). * - * Return: void + * Return: void * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * *------------------------------------------------------------------------- */ @@ -33714,158 +33714,158 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) */ struct expected_entry_status expected[150] = { - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 4, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 5, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 6, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 7, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 8, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 9, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 10, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 11, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 12, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 13, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 14, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 15, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 16, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 17, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 18, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 19, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 20, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 21, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 22, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 23, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 24, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 25, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 26, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 27, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 28, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 29, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 30, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 31, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 32, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 33, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 34, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 35, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 36, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 37, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 38, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 39, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 40, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 41, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 42, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 43, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 44, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 45, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 46, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 47, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 48, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 49, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 50, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 51, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 52, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 53, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 54, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 55, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 56, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 57, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 58, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 59, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 60, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 61, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 62, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 63, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 64, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 65, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 66, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 67, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 68, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 69, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 70, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 71, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 72, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 73, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 74, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 75, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 76, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 77, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 78, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 79, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 80, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 81, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 82, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 83, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 84, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 85, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 86, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 87, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 88, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 89, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 90, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 91, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 92, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 93, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 94, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 95, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 96, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 97, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 98, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 99, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 100, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 101, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 102, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 103, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 104, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 105, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 106, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 107, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 108, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 109, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 110, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 111, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 112, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 113, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 114, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 115, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 116, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 117, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 118, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 119, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 120, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 121, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 122, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 123, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 124, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 125, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 126, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 127, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 128, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 129, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 130, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 131, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 132, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 133, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 134, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 135, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 136, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 137, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 138, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 139, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 140, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 141, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 142, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 143, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 144, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 145, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 146, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 147, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 148, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 149, HUGE_ENTRY_SIZE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, {0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE} } ; pass = TRUE; @@ -33912,9 +33912,9 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) * Phase 1: * * Inserting dirty corked entries into an empty cache, until the cache - * violates the min_clean_size requirement. - * Since entries are all dirty and corked, no entry will get flushed or - * evicted. + * violates the min_clean_size requirement. + * Since entries are all dirty and corked, no entry will get flushed or + * evicted. * * ======================================================================== * ======================================================================== @@ -33966,9 +33966,9 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) * Phase 2: * * Inserting entries into a cache that violates the min_clean_size, - * until the cache is full. - * Since entries are all dirty and corked, no entry during this phase - * will get flushed or evicted. + * until the cache is full. + * Since entries are all dirty and corked, no entry during this phase + * will get flushed or evicted. * * ======================================================================== * ======================================================================== @@ -33997,14 +33997,14 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) * * Expected status is that there are 27 entries in the cache, and * all entries remain the same as before since they are all corked - * and dirty + * and dirty */ /* entry w/ index 26 is now in the cache and dirty. */ - expected[26].in_cache = TRUE; - expected[26].is_dirty = TRUE; - expected[26].deserialized = (unsigned char)deserialized; - expected[26].is_corked = TRUE; + expected[26].in_cache = TRUE; + expected[26].is_dirty = TRUE; + expected[26].deserialized = (unsigned char)deserialized; + expected[26].is_corked = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -34043,10 +34043,10 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) * all entries are dirty corked entries. * */ - expected[27].in_cache = TRUE; - expected[27].is_dirty = TRUE; - expected[27].deserialized = (unsigned char)deserialized; - expected[27].is_corked = TRUE; + expected[27].in_cache = TRUE; + expected[27].is_dirty = TRUE; + expected[27].deserialized = (unsigned char)deserialized; + expected[27].is_corked = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -34082,12 +34082,12 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) H5C__DIRTIED_FLAG); /* unsigned int flags */ } - /* - * Expected status: all entries are dirty corked entries. + /* + * Expected status: all entries are dirty corked entries. */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; expected[entry_idx].is_corked = TRUE; /* Verify the status */ @@ -34112,8 +34112,8 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) /* ======================================================================== * ======================================================================== * Phase 3: - * Inserting entries into a cache that is completely full. - * No entry is flushed or evicted because all entries are dirty & corked. + * Inserting entries into a cache that is completely full. + * No entry is flushed or evicted because all entries are dirty & corked. * * ======================================================================== * ======================================================================== @@ -34145,10 +34145,10 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) } /* This past inserted entry is now in the cache: dirty and corked */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; - expected[entry_idx].is_corked = TRUE; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; /* Verify this expected status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -34192,7 +34192,7 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) verify_clean(); /* Verify the status of the entries. */ - /* All entries are flushed, clean but still corked */ + /* All entries are flushed, clean but still corked */ for (i = 0; i < 100; i++) { expected[i].serialized = TRUE; expected[i].is_dirty = FALSE; @@ -34211,21 +34211,21 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) if(pass) { - /* Will evict 50 clean "corked" entries all at once when inserting the 100th entry */ - for(i = 0; i < 51; i++) { - expected[i].in_cache = FALSE; - expected[i].destroyed = TRUE; - expected[i].is_corked = TRUE; - } + /* Will evict 50 clean "corked" entries all at once when inserting the 100th entry */ + for(i = 0; i < 51; i++) { + expected[i].in_cache = FALSE; + expected[i].destroyed = TRUE; + expected[i].is_corked = TRUE; + } - /* Insert the 100th entry */ - if(fill_via_insertion) { + /* Insert the 100th entry */ + if(fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ - 100, /* int32_t idx */ + 100, /* int32_t idx */ H5C__NO_FLAGS_SET); /* unsigned int flags */ - } else { + } else { protect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ 100); /* int32-t idx */ @@ -34234,16 +34234,16 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) entry_type, /* int32_t type */ 100, /* int32_t idx */ H5C__DIRTIED_FLAG); /* unsigned int flags */ - } + } - /* The 100th inserted entry is now in the cache and dirty */ - expected[100].in_cache = TRUE; - expected[100].is_dirty = TRUE; - expected[100].deserialized = (unsigned char)deserialized; - expected[100].is_corked = TRUE; + /* The 100th inserted entry is now in the cache and dirty */ + expected[100].in_cache = TRUE; + expected[100].is_dirty = TRUE; + expected[100].deserialized = (unsigned char)deserialized; + expected[100].is_corked = TRUE; - /* verify the status */ - verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ + /* verify the status */ + verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ 100, /* int tag */ 150, /* int num_entries */ expected); /* struct expected_entry_staus[] */ @@ -34257,13 +34257,13 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) if(pass) { /* Insert 25 more corked entries (indexes 101 through 125) into the cache. */ - /* Clean entry will be evicted one a time */ + /* Clean entry will be evicted one a time */ for (entry_idx = 101; entry_idx < 126; entry_idx++) { if(fill_via_insertion) { insert_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ - entry_idx, /* int32_t idx */ + entry_idx, /* int32_t idx */ H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { @@ -34278,21 +34278,21 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) } /* The inserted entry is now in the cache and dirty */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; - expected[entry_idx].is_corked = TRUE; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; - expected[entry_idx - 50].in_cache = FALSE; - expected[entry_idx - 50].destroyed = TRUE; - expected[entry_idx - 50].is_corked = TRUE; + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].is_corked = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ entry_idx, /* int tag */ 150, /* int num_entries */ expected); /* struct expected_entry_staus[] */ - } /* end for */ + } /* end for */ } @@ -34306,30 +34306,30 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) /* Insert the 127th entry (index = 126) into the cache. */ if(fill_via_insertion) { - insert_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 126, /* int32_t idx */ - H5C__NO_FLAGS_SET); /* unsigned int flags */ + insert_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 126, /* int32_t idx */ + H5C__NO_FLAGS_SET); /* unsigned int flags */ } else { - protect_entry(file_ptr, /* H5F_t * file_ptr */ - entry_type, /* int32_t type */ - 126); /* int32-t idx */ + protect_entry(file_ptr, /* H5F_t * file_ptr */ + entry_type, /* int32_t type */ + 126); /* int32-t idx */ - unprotect_entry(file_ptr, /* H5F_t * file_ptr */ + unprotect_entry(file_ptr, /* H5F_t * file_ptr */ entry_type, /* int32_t type */ - 126, /* int32_t idx */ + 126, /* int32_t idx */ H5C__DIRTIED_FLAG); /* unsigned int flags */ } /* Verify the status of the entries. */ - expected[126].in_cache = TRUE; - expected[126].is_dirty = TRUE; - expected[126].deserialized = (unsigned char)deserialized; - expected[126].is_corked = TRUE; + expected[126].in_cache = TRUE; + expected[126].is_dirty = TRUE; + expected[126].deserialized = (unsigned char)deserialized; + expected[126].is_corked = TRUE; - expected[126 - 50].in_cache = FALSE; - expected[126 - 50].destroyed = TRUE; - expected[126 - 50].is_corked = TRUE; + expected[126 - 50].in_cache = FALSE; + expected[126 - 50].destroyed = TRUE; + expected[126 - 50].is_corked = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -34367,15 +34367,15 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) } /* This past inserted entry is now in the cache, dirty and corked */ - expected[entry_idx].in_cache = TRUE; - expected[entry_idx].is_dirty = TRUE; - expected[entry_idx].deserialized = (unsigned char)deserialized; - expected[entry_idx].is_corked = TRUE; + expected[entry_idx].in_cache = TRUE; + expected[entry_idx].is_dirty = TRUE; + expected[entry_idx].deserialized = (unsigned char)deserialized; + expected[entry_idx].is_corked = TRUE; - /* Entry that is 50 entries away will be evicted since it is clean even though corked */ - expected[entry_idx - 50].in_cache = FALSE; - expected[entry_idx - 50].destroyed = TRUE; - expected[entry_idx - 50].is_corked = TRUE; + /* Entry that is 50 entries away will be evicted since it is clean even though corked */ + expected[entry_idx - 50].in_cache = FALSE; + expected[entry_idx - 50].destroyed = TRUE; + expected[entry_idx - 50].is_corked = TRUE; /* verify the status */ verify_entry_status(cache_ptr, /* H5C_t * cache_ptr */ @@ -34405,34 +34405,34 @@ check_metadata_cork(hbool_t fill_via_insertion, unsigned paged) } /* check_metadata_cork() */ - + /*------------------------------------------------------------------------- - * Function: check_entry_deletions_during_scans() + * Function: check_entry_deletions_during_scans() * - * Purpose: With the addition of the H5C__TAKE_OWNERSHIP_FLAG, it is - * possible for an entry to be removed from the cache as a - * side effect of flushing an entry. + * Purpose: With the addition of the H5C__TAKE_OWNERSHIP_FLAG, it is + * possible for an entry to be removed from the cache as a + * side effect of flushing an entry. * - * For the most part, this doesn't cause problems. However, - * during the scans of lists, it is possible that the entry - * removed will be the next entry in the scan -- which if not - * detected, will typeically cause the cache to attempt to flush - * an entry that is no longer in the cache, and which may have - * been deleted. + * For the most part, this doesn't cause problems. However, + * during the scans of lists, it is possible that the entry + * removed will be the next entry in the scan -- which if not + * detected, will typeically cause the cache to attempt to flush + * an entry that is no longer in the cache, and which may have + * been deleted. * - * This function contans tests for correct handling on this - * situation. + * This function contans tests for correct handling on this + * situation. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/3/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -34460,9 +34460,9 @@ check_entry_deletions_during_scans(unsigned paged) file_ptr = setup_cache((size_t)(2 * 1024 * 1024), (size_t)(1 * 1024 * 1024), paged); } - /* run the tests. This set of tests is somewhat eclectic, as - * we are trying to test all locations where the deletion of - * an entry from the cache as a side effect of the fluch of + /* run the tests. This set of tests is somewhat eclectic, as + * we are trying to test all locations where the deletion of + * an entry from the cache as a side effect of the fluch of * a different entry could cause problems. */ @@ -34502,32 +34502,32 @@ check_entry_deletions_during_scans(unsigned paged) } /* check_entry_deletions_during_scans() */ - + /*------------------------------------------------------------------------- - * Function: cedds__expunge_dirty_entry_in_flush_test() + * Function: cedds__expunge_dirty_entry_in_flush_test() * - * Purpose: Verify that H5C_flush_cache() can handle the removal of - * a dirty entry from the cache during its scan of the - * skip list. + * Purpose: Verify that H5C_flush_cache() can handle the removal of + * a dirty entry from the cache during its scan of the + * skip list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * flush the cache, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * flush the cache, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C_flush_cache() should handle this deletion gracefully. + * H5C_flush_cache() should handle this deletion gracefully. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -34536,8 +34536,8 @@ static void cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - herr_t result; + int i; + herr_t result; struct expected_entry_status expected[36] = { /* the expected array is used to maintain a table of the expected status of every @@ -34545,12 +34545,12 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE} + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE} }; if(pass) { @@ -34569,15 +34569,15 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = - "unexpected cache config at start of cedds expunge dirty entry in flush test."; + pass = FALSE; + failure_mssg = + "unexpected cache config at start of cedds expunge dirty entry in flush test."; } else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } @@ -34585,50 +34585,50 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) if(pass) { - /* The basic idea of this test is to setup the cache such - * that: - * - * 1) the cache contains several dirty entries. - * - * 2) the first entry on the slist is dirty, and has a flush - * operation that will remove the second entry on the + /* The basic idea of this test is to setup the cache such + * that: + * + * 1) the cache contains several dirty entries. + * + * 2) the first entry on the slist is dirty, and has a flush + * operation that will remove the second entry on the * slist. * - * Then load flush the cache. Cache should handle the - * removal of the next entry in the slist scan gracefully. + * Then load flush the cache. Cache should handle the + * removal of the next entry in the slist scan gracefully. */ - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ - H5C_stats__reset(cache_ptr); + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ + H5C_stats__reset(cache_ptr); - /* Load four huge entries into the cache. Recall that huge entries + /* Load four huge entries into the cache. Recall that huge entries * are one fourth the size of monster entries (16 KB vs. 64 KB). */ - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { - protect_entry(file_ptr, HUGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, HUGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); } - if((cache_ptr->index_len != 4) || + if((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) { pass = FALSE; - failure_mssg = "unexpected size/len in cedds expunge dirty entry in flush test (1)"; - } + failure_mssg = "unexpected size/len in cedds expunge dirty entry in flush test (1)"; + } } if(pass) { - /* Next, set up the flush operation: - * - * (HET, 0) expunges (HET, 1) - * - */ + /* Next, set up the flush operation: + * + * (HET, 0) expunges (HET, 1) + * + */ add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL); @@ -34636,27 +34636,27 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) if(pass) { - /* to summarize, at present the following entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (HET, 0) Y 16 KB Y N - expunge (HET 1) - * - * (HET, 1) Y 16 KB Y N - - + /* to summarize, at present the following entries + * are in cache with the following characteristics: + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (HET, 0) Y 16 KB Y N - expunge (HET 1) + * + * (HET, 1) Y 16 KB Y N - - * - * (HET, 2) Y 16 KB Y N - - + * (HET, 2) Y 16 KB Y N - - * - * (HET, 3) Y 16 KB Y N - - - * - * Recall that in this test bed, flush operations are excuted the - * first time the associated entry is flushed, and are then - * deleted. - */ + * (HET, 3) Y 16 KB Y N - - + * + * Recall that in this test bed, flush operations are excuted the + * first time the associated entry is flushed, and are then + * deleted. + */ - /* verify the expected status of all entries we have loaded to date: */ - verify_entry_status(cache_ptr, 0, 4, expected); + /* verify the expected status of all entries we have loaded to date: */ + verify_entry_status(cache_ptr, 0, 4, expected); } /* flush the cache to run the test. In the process, clean up after test. */ @@ -34684,7 +34684,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) * values. */ if(pass) - if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) || @@ -34708,7 +34708,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) } /* end if */ if(pass) - if((cache_ptr->slist_scan_restarts != 1) || + if((cache_ptr->slist_scan_restarts != 1) || (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 0)) { pass = FALSE; @@ -34727,34 +34727,34 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) } /* cedds__expunge_dirty_entry_in_flush_test() */ - + /*------------------------------------------------------------------------- - * Function: cedds__H5C_make_space_in_cache() + * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C__make_space_in_cache() can handle the - * removal from the cache of the next item in its reverse scan - * of the LRU list. + * Purpose: Verify that H5C__make_space_in_cache() can handle the + * removal from the cache of the next item in its reverse scan + * of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deleted the second to last entry on the LRU. Then - * load an additional entry, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deleted the second to last entry on the LRU. Then + * load an additional entry, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -34763,10 +34763,10 @@ static void cedds__H5C_make_space_in_cache(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - const int num_huge_entries = 4; - const int num_monster_entries = 32; - herr_t result; + int i; + const int num_huge_entries = 4; + const int num_monster_entries = 32; + herr_t result; struct expected_entry_status expected[36] = { /* the expected array is used to maintain a table of the expected status of every @@ -34774,44 +34774,44 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { HUGE_ENTRY_TYPE, 0, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 1, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 2, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { HUGE_ENTRY_TYPE, 3, HUGE_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, }; if(pass) { @@ -34830,15 +34830,15 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = - "unexpected cache config at start of cedds H5C__make_space_in_cache() test."; + pass = FALSE; + failure_mssg = + "unexpected cache config at start of cedds H5C__make_space_in_cache() test."; } else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } @@ -34846,54 +34846,54 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(pass) { - /* The basic idea of this test is to setup the cache such - * that: - * - * 1) the cache is full - * - * 2) the last entry on the LRU is dirty, and has a flush - * operation that will remove the second to last entry + /* The basic idea of this test is to setup the cache such + * that: + * + * 1) the cache is full + * + * 2) the last entry on the LRU is dirty, and has a flush + * operation that will remove the second to last entry * on the LRU from the cache. * - * Then load another entry into the cache. See if - * H5C__make_space_in_cache() detects the removal of - * the next item in the scan, and restarts the scan - * from the bottom of the LRU. Note that the newly + * Then load another entry into the cache. See if + * H5C__make_space_in_cache() detects the removal of + * the next item in the scan, and restarts the scan + * from the bottom of the LRU. Note that the newly * loaded entry must be large enough to require that * the scan continue after the entry is expunged. */ - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ - H5C_stats__reset(cache_ptr); + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ + H5C_stats__reset(cache_ptr); - /* Load four huge entries into the cache. Recall that huge entries + /* Load four huge entries into the cache. Recall that huge entries * are one fourth the size of monster entries (16 KB vs. 64 KB). */ - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { - protect_entry(file_ptr, HUGE_ENTRY_TYPE, i); - unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, HUGE_ENTRY_TYPE, i); + unprotect_entry(file_ptr, HUGE_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); } - if((cache_ptr->index_len != 4) || + if((cache_ptr->index_len != 4) || (cache_ptr->index_size != (4 * HUGE_ENTRY_SIZE))) { pass = FALSE; - failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (1)"; - } + failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (1)"; + } } if(pass) { - /* Next, set up the flush operation: - * - * (HET, 0) expunges (HET, 1) - * - */ + /* Next, set up the flush operation: + * + * (HET, 0) expunges (HET, 1) + * + */ add_flush_op(HUGE_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, HUGE_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL); @@ -34901,62 +34901,62 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(pass) { - /* to summarize, at present the following entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (HET, 0) Y 16 KB Y N - expunge (HET 1) - * - * (HET, 1) Y 16 KB N N - - + /* to summarize, at present the following entries + * are in cache with the following characteristics: + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (HET, 0) Y 16 KB Y N - expunge (HET 1) + * + * (HET, 1) Y 16 KB N N - - * - * (HET, 2) Y 16 KB N N - - + * (HET, 2) Y 16 KB N N - - * - * (HET, 3) Y 16 KB N N - - - * - * Recall that in this test bed, flush operations are excuted the - * first time the associated entry is flushed, and are then - * deleted. - */ + * (HET, 3) Y 16 KB N N - - + * + * Recall that in this test bed, flush operations are excuted the + * first time the associated entry is flushed, and are then + * deleted. + */ /* Now fill up the cache with other, unrelated entries. Recall * that the cache size is 2 MB and 31 * 64 KB + 4 * 16 KP == 2 MB. */ - for (i = 0; i < 31; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 0; i < 31; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__DIRTIED_FLAG); - } + } - /* The cache should now be exactly full */ - if((cache_ptr->index_len != 35) || + /* The cache should now be exactly full */ + if((cache_ptr->index_len != 35) || (cache_ptr->index_size != 2 * 1024 * 1024) || - (cache_ptr->index_size != ((4 * HUGE_ENTRY_SIZE) + + (cache_ptr->index_size != ((4 * HUGE_ENTRY_SIZE) + (31 * MONSTER_ENTRY_SIZE)))) { pass = FALSE; - failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (2)"; + failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (2)"; - } else { + } else { - /* verify the expected status of all entries we have loaded to date: */ - verify_entry_status(cache_ptr, 0, 35, expected); - } + /* verify the expected status of all entries we have loaded to date: */ + verify_entry_status(cache_ptr, 0, 35, expected); + } } if(pass) { - /* now load another monster entry. This should cause - * H5C__make_space_in_cache() to be called. (HET 0) is dirty, and is at - * the bottom of the LRU. * Thus it will be flushed, and moved to the - * head of the LRU. However, during the flush, (HET 1) should be expunged - * from the cache. Since (MET 1) is the next item in - * H5C__make_space_in_cache(), must detect its removal from the cache, + /* now load another monster entry. This should cause + * H5C__make_space_in_cache() to be called. (HET 0) is dirty, and is at + * the bottom of the LRU. * Thus it will be flushed, and moved to the + * head of the LRU. However, during the flush, (HET 1) should be expunged + * from the cache. Since (MET 1) is the next item in + * H5C__make_space_in_cache(), must detect its removal from the cache, * and refrain from trying to flush it. * * Since all entries in the cache are dirty, all entries will be flushed, - * and HET 0, 2, and 3 will be evicted to make room for the new + * and HET 0, 2, and 3 will be evicted to make room for the new * monster entry (MET, 31). * * Verify this. If H5C__make_space_in_cache() chokes, failure will @@ -34969,45 +34969,45 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(pass) { - /* if the protect succeeded, unprotect and verify that all is at + /* if the protect succeeded, unprotect and verify that all is at * it should be. */ unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG); - /* The cache should now be exactly full */ - if((cache_ptr->index_len != 32) || + /* The cache should now be exactly full */ + if((cache_ptr->index_len != 32) || (cache_ptr->index_size != 2 * 1024 * 1024) || - (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) { + (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) { pass = FALSE; - failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (3)"; + failure_mssg = "unexpected size/len in H5C__make_space_in_cache() test (3)"; - } else { + } else { - /* modify the expected table to match the new situation, and + /* modify the expected table to match the new situation, and * then call verify_entry_status(). */ for (i = 0; i < num_huge_entries; i++) { - expected[i].in_cache = FALSE; - expected[i].is_dirty = FALSE; - expected[i].serialized = TRUE; - expected[i].destroyed = TRUE; + expected[i].in_cache = FALSE; + expected[i].is_dirty = FALSE; + expected[i].serialized = TRUE; + expected[i].destroyed = TRUE; } /* (HET, 1) was expunged, so touch its entry up accordingly */ - expected[1].is_dirty = TRUE; - expected[1].serialized = FALSE; + expected[1].is_dirty = TRUE; + expected[1].serialized = FALSE; for (i = num_huge_entries; i < num_huge_entries + num_monster_entries - 1; i++) { - expected[i].is_dirty = FALSE; - expected[i].serialized = TRUE; + expected[i].is_dirty = FALSE; + expected[i].serialized = TRUE; } - /* verify the expected status of all entries: */ - verify_entry_status(cache_ptr, 0, 36, expected); + /* verify the expected status of all entries: */ + verify_entry_status(cache_ptr, 0, 36, expected); } } @@ -35038,7 +35038,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if(pass) { - if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) || (cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) || (cache_ptr->flushes[HUGE_ENTRY_TYPE] != 3) || @@ -35063,7 +35063,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) } if(pass) - if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 32) || @@ -35087,7 +35087,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) } /* end if */ if(pass) - if((cache_ptr->slist_scan_restarts != 0) || + if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) || (cache_ptr->index_scan_restarts != 0)) { @@ -35108,34 +35108,34 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) } /* cedds__H5C_make_space_in_cache() */ - + /*------------------------------------------------------------------------- - * Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries() + * Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries() * - * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() - * can handle the removal from the cache of the next item in - * its reverse scan of the LRU list. + * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() + * can handle the removal from the cache of the next item in + * its reverse scan of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * access the first item in the LRU repeatedly until the - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * access the first item in the LRU repeatedly until the + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -35144,8 +35144,8 @@ static void cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - herr_t result; + int i; + herr_t result; struct expected_entry_status expected[36] = { /* the expected array is used to maintain a table of the expected status of every @@ -35153,40 +35153,40 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 1, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 2, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 3, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 4, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 5, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 6, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 7, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 9, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 10, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 11, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 12, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 13, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 14, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 15, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 17, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 18, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 19, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 20, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 21, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 22, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 23, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 25, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 26, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 27, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 28, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 29, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 30, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,-1,-1,-1,-1,-1,-1,-1}, {-1,-1,-1,-1,-1,-1,-1,-1}, 0, 0, 0, -1, FALSE}, }; H5C_auto_size_ctl_t saved_auto_size_ctl; H5C_auto_size_ctl_t test_auto_size_ctl = @@ -35215,9 +35215,9 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) /* size_t max_increment = */ (4 * 1024 * 1024), /* enum H5C_cache_flash_incr_mode */ - /* flash_incr_mode = */ H5C_flash_incr__off, - /* double flash_multiple = */ 2.0f, - /* double flash_threshold = */ 0.5f, + /* flash_incr_mode = */ H5C_flash_incr__off, + /* double flash_multiple = */ 2.0f, + /* double flash_threshold = */ 0.5f, /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out, @@ -35251,15 +35251,15 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = - "unexpected cache config at start of cedds H5C__autoadjust__ageout__evict_aged_out_entries() test."; + pass = FALSE; + failure_mssg = + "unexpected cache config at start of cedds H5C__autoadjust__ageout__evict_aged_out_entries() test."; } else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } @@ -35295,49 +35295,49 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) if(pass) { - /* The basic idea of this test is to setup the cache such - * that: - * - * 1) the cache is full - * - * 2) the last entry on the LRU is dirty, and has a flush - * operation that will remove the second to last entry + /* The basic idea of this test is to setup the cache such + * that: + * + * 1) the cache is full + * + * 2) the last entry on the LRU is dirty, and has a flush + * operation that will remove the second to last entry * on the LRU from the cache. * * Then access the first item in the LRU until the epoch - * and H5C__autoadjust__ageout__evict_aged_out_entries() - * is invoked. Verify that the function deals with the - * deletion of the next item in its scan cleanly. + * and H5C__autoadjust__ageout__evict_aged_out_entries() + * is invoked. Verify that the function deals with the + * deletion of the next item in its scan cleanly. */ - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ - H5C_stats__reset(cache_ptr); + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ + H5C_stats__reset(cache_ptr); /* load the first entry -- mark it dirty */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); - /* Then load the rest of the entries to fill the cache: + /* Then load the rest of the entries to fill the cache: * * Recall that the cache size is 2 MB and 32 * 64 KB == 2 MB. */ - for (i = 1; i < 32; i++) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 1; i < 32; i++) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); - } + } } if(pass) { - /* Next, set up the flush operation: - * - * (MET, 0) expunges (MET, 1) - * - */ + /* Next, set up the flush operation: + * + * (MET, 0) expunges (MET, 1) + * + */ add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, MONSTER_ENTRY_TYPE, 1, FALSE, (size_t)0, NULL); @@ -35345,34 +35345,34 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) if(pass) { - /* to summarize, at present the following entries - * are in cache with the following characteristics: - * - * in - * entry: cache? size: dirty? pinned? pins: flush operations: - * - * (MET, 0) Y 64 KB Y N - expunge (MET 1) - * - * (MET, 1-31) Y 64 KB N N - - - * - * Recall that in this test bed, flush operations are excuted the - * first time the associated entry is flushed, and are then - * deleted. - */ + /* to summarize, at present the following entries + * are in cache with the following characteristics: + * + * in + * entry: cache? size: dirty? pinned? pins: flush operations: + * + * (MET, 0) Y 64 KB Y N - expunge (MET 1) + * + * (MET, 1-31) Y 64 KB N N - - + * + * Recall that in this test bed, flush operations are excuted the + * first time the associated entry is flushed, and are then + * deleted. + */ - /* The cache should now be exactly full */ - if((cache_ptr->index_len != 32) || + /* The cache should now be exactly full */ + if((cache_ptr->index_len != 32) || (cache_ptr->index_size != 2 * 1024 * 1024) || - (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) { + (cache_ptr->index_size != (32 * MONSTER_ENTRY_SIZE))) { pass = FALSE; - failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (1)"; + failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (1)"; - } else { + } else { - /* verify the expected status of all entries we have loaded to date: */ - verify_entry_status(cache_ptr, 0, 32, expected); - } + /* verify the expected status of all entries we have loaded to date: */ + verify_entry_status(cache_ptr, 0, 32, expected); + } } /* protect and unprotect (MET, 31) repeatedly until the end of the first epoch */ @@ -35398,38 +35398,38 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__NO_FLAGS_SET); } - /* at this point, only (MET, 0) and (MET, 31) should remain in the cache, - * all other entries having been evicted by the ageout adaptive cache - * resizing algorithm. (Since (MET, 0) was dirty, it was flushed and + /* at this point, only (MET, 0) and (MET, 31) should remain in the cache, + * all other entries having been evicted by the ageout adaptive cache + * resizing algorithm. (Since (MET, 0) was dirty, it was flushed and * moved to the head of the LRU by the ageout algorithm.) */ if(pass) { - if((cache_ptr->index_len != 2) || + if((cache_ptr->index_len != 2) || (cache_ptr->index_size != 2 * MONSTER_ENTRY_SIZE)) { pass = FALSE; - failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (2)"; + failure_mssg = "unexpected size/len in H5C__autoadjust__ageout__evict_aged_out_entries() test (2)"; - } else { + } else { - /* update the expected table to reflect the expected values at + /* update the expected table to reflect the expected values at * this point, and then verify. */ expected[0].is_dirty = FALSE; - expected[0].serialized = TRUE; + expected[0].serialized = TRUE; for (i = 1; i < 31; i++) { - expected[i].in_cache = FALSE; - expected[i].is_dirty = FALSE; - expected[i].destroyed = TRUE; + expected[i].in_cache = FALSE; + expected[i].is_dirty = FALSE; + expected[i].destroyed = TRUE; } - verify_entry_status(cache_ptr, 0, 32, expected); - } + verify_entry_status(cache_ptr, 0, 32, expected); + } } /* restore the initial resize configuration */ @@ -35473,7 +35473,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) */ if(pass) - if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 1) || @@ -35497,7 +35497,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) } /* end if */ if(pass) - if((cache_ptr->slist_scan_restarts != 0) || + if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 1) || (cache_ptr->index_scan_restarts != 0)) { @@ -35518,95 +35518,95 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) } /* cedds__H5C__autoadjust__ageout__evict_aged_out_entries() */ - + /*------------------------------------------------------------------------- - * Function: cedds__H5C_flush_invalidate_cache__bucket_scan() - * - * Purpose: Note: We now use the index list when we scan the - * contents of the metadata cache, so in principal, - * this test is obsolete. However, even using the - * index list, restarts are possible, and must be - * handled gracefully. - * - * As it turns out, this test triggers index list - * scan restarts, and thus with minor changes is - * still a useful test. - * - * For this reason, with the exception of changing - * to check the index_scan_restart stat instead of - * hash bucket restarts, I'm leaving the test - * alone. If and when it starts to fail due to - * other changes, we can re-work it to test - * index list scan restarts explicitly. - * - * JRM -- 11/2/16 - * - * Verify that H5C_flush_invalidate_cache() can handle - * the removal from the cache of the next item in - * its scans of hash buckets. - * - * !!!!!!!!!!WARNING !!!!!!!!!! - * - * This test may fail to function correctly if the hash - * table size or hash function is altered. - * - * To setup the test, this function depends on the fact that - * H5C_flush_invalidate_cache() does alternating scans of the - * slist and the index. If this changes, the test will likely - * also cease to function correctly. - * - * The test relies on a known hash function and hash table - * size to select a set of test entries that will all hash - * to the same hash bucket -- call it the test hash bucket. - * It also relies on known behavior of the cache to place - * the entries in the test bucket in a known order. - * - * To avoid pre-mature flushes of the entries in the - * test hash bucket, all entries are initially clean, - * with the exception of the first entry which is dirty. - * It avoids premature flushing by being the parent in - * a flush dependency. The first entry in the test bucket - * also has a flush op which expunges the second entry -- - * setting up the failure. - * - * An additional dirty entry is added (which must hash - * to a different bucket, and must have a higher address - * than at least the first entry in the test hash bucket. - * This entry is the child in a flush dependency with the - * first entry in the above hash bucket, and contains - * a flush op to destroy this flush dependency. - * - * Since the first entry in the test hash bucket has a lower - * address that the other dirty entry, the scan of the - * slist encounters it first, and passes over it because - * it has a flush dependency height of 1. - * - * The scan then encounters the second dirty entry and flushes - * it -- causing it to destroy the flush dependency and thus - * reducing the flush dependency height of the first entry in - * the test hash bucket to zero. - * - * After completing a scan of the slist, - * H5C_flush_invalidate_cache() then scans the index, - * flushing all entries of flush dependency height zero. - * - * This sets up the potential error when the first entry - * in the test hash bucket is flushed -- expunging the - * second entry as a side effect. If - * H5C_flush_invalidate_cache() fails to detect this, - * it will attempt to continue its scan of the bucket with - * an entry that has been deleted from the cache. + * Function: cedds__H5C_flush_invalidate_cache__bucket_scan() + * + * Purpose: Note: We now use the index list when we scan the + * contents of the metadata cache, so in principal, + * this test is obsolete. However, even using the + * index list, restarts are possible, and must be + * handled gracefully. + * + * As it turns out, this test triggers index list + * scan restarts, and thus with minor changes is + * still a useful test. + * + * For this reason, with the exception of changing + * to check the index_scan_restart stat instead of + * hash bucket restarts, I'm leaving the test + * alone. If and when it starts to fail due to + * other changes, we can re-work it to test + * index list scan restarts explicitly. + * + * JRM -- 11/2/16 + * + * Verify that H5C_flush_invalidate_cache() can handle + * the removal from the cache of the next item in + * its scans of hash buckets. + * + * !!!!!!!!!!WARNING !!!!!!!!!! + * + * This test may fail to function correctly if the hash + * table size or hash function is altered. + * + * To setup the test, this function depends on the fact that + * H5C_flush_invalidate_cache() does alternating scans of the + * slist and the index. If this changes, the test will likely + * also cease to function correctly. + * + * The test relies on a known hash function and hash table + * size to select a set of test entries that will all hash + * to the same hash bucket -- call it the test hash bucket. + * It also relies on known behavior of the cache to place + * the entries in the test bucket in a known order. + * + * To avoid pre-mature flushes of the entries in the + * test hash bucket, all entries are initially clean, + * with the exception of the first entry which is dirty. + * It avoids premature flushing by being the parent in + * a flush dependency. The first entry in the test bucket + * also has a flush op which expunges the second entry -- + * setting up the failure. + * + * An additional dirty entry is added (which must hash + * to a different bucket, and must have a higher address + * than at least the first entry in the test hash bucket. + * This entry is the child in a flush dependency with the + * first entry in the above hash bucket, and contains + * a flush op to destroy this flush dependency. + * + * Since the first entry in the test hash bucket has a lower + * address that the other dirty entry, the scan of the + * slist encounters it first, and passes over it because + * it has a flush dependency height of 1. + * + * The scan then encounters the second dirty entry and flushes + * it -- causing it to destroy the flush dependency and thus + * reducing the flush dependency height of the first entry in + * the test hash bucket to zero. + * + * After completing a scan of the slist, + * H5C_flush_invalidate_cache() then scans the index, + * flushing all entries of flush dependency height zero. + * + * This sets up the potential error when the first entry + * in the test hash bucket is flushed -- expunging the + * second entry as a side effect. If + * H5C_flush_invalidate_cache() fails to detect this, + * it will attempt to continue its scan of the bucket with + * an entry that has been deleted from the cache. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/9/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -35615,9 +35615,9 @@ static void cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - int expected_hash_bucket = 0; - herr_t result; + int i; + int expected_hash_bucket = 0; + herr_t result; haddr_t entry_addr; test_entry_t * entry_ptr; test_entry_t * base_addr = NULL; @@ -35629,13 +35629,13 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) * array only processes as much of it as it is told to, we don't have to * worry about maintaining the status of entries that we haven't used yet. */ - /* entry entry in at main flush dep flush dep child flush flush flush */ - /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ - { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 1, 1, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, - { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {MONSTER_ENTRY_TYPE,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 1, 0, 0, -1, FALSE}, + /* entry entry in at main flush dep flush dep child flush flush flush */ + /* type: index: size: cache: addr: dirty: prot: pinned: dsrlzd: srlzd: dest: par type[]: par idx[]: dep npart: dep nchd: dep ndirty chd: order: corked: */ + { MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 1, 1, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 8, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 16, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 24, MONSTER_ENTRY_SIZE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, {-1,0,0,0,0,0,0,0}, {-1,0,0,0,0,0,0,0}, 0, 0, 0, -1, FALSE}, + { MONSTER_ENTRY_TYPE, 31, MONSTER_ENTRY_SIZE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, {MONSTER_ENTRY_TYPE,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0}, 1, 0, 0, -1, FALSE}, }; if(pass) { @@ -35654,15 +35654,15 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = - "unexpected cache config at start of cedds cedds__H5C_flush_invalidate_cache__bucket_scan() test."; + pass = FALSE; + failure_mssg = + "unexpected cache config at start of cedds cedds__H5C_flush_invalidate_cache__bucket_scan() test."; } else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } @@ -35671,25 +35671,25 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) { - /* reset the stats before we start. If stats are enabled, we will - * check to see if they are as expected at the end. - */ + /* reset the stats before we start. If stats are enabled, we will + * check to see if they are as expected at the end. + */ - H5C_stats__reset(cache_ptr); + H5C_stats__reset(cache_ptr); - /* load one dirty and three clean entries that should hash to the - * same hash bucket. + /* load one dirty and three clean entries that should hash to the + * same hash bucket. */ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0, H5C__DIRTIED_FLAG); - for (i = 8; i <= 24; i += 8) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 8; i <= 24; i += 8) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); - } + } } if(pass) { @@ -35704,7 +35704,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) expected_hash_bucket = H5C__HASH_FCN(entry_addr); for (i = 8; i <= 24; i += 8) { - + entry_ptr = &(base_addr[i]); entry_addr = entry_ptr->header.addr; @@ -35719,10 +35719,10 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) { /* setup the expunge flush operation: - * - * (MET, 0) expunges (MET, 8) - * - */ + * + * (MET, 0) expunges (MET, 8) + * + */ add_flush_op(MONSTER_ENTRY_TYPE, 0, FLUSH_OP__EXPUNGE, MONSTER_ENTRY_TYPE, 8, FALSE, (size_t)0, NULL); } @@ -35731,16 +35731,16 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) /* load the entry that will have a flush dependencey with (MET, 0), * thus preventing it from being flushed on the first pass through - * the skip list. + * the skip list. */ - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, 31, H5C__DIRTIED_FLAG); } if(pass) { - /* verify that the dirty entry doesn't map to the same + /* verify that the dirty entry doesn't map to the same * hash bucket as the clean entries. */ @@ -35756,9 +35756,9 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) { - /* Next, create the flush dependency requiring (MET, 31) to + /* Next, create the flush dependency requiring (MET, 31) to * be flushed prior to (MET, 0). - */ + */ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 0); create_flush_dependency(MONSTER_ENTRY_TYPE, 0, MONSTER_ENTRY_TYPE, 31); @@ -35768,11 +35768,11 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) { - /* Then, setup the flush operation to take down the flush + /* Then, setup the flush operation to take down the flush * dependency when (MET, 31) is flushed. - * - * (MET, 31) destroys flush dependency with (MET, 8) - * + * + * (MET, 31) destroys flush dependency with (MET, 8) + * */ add_flush_op(MONSTER_ENTRY_TYPE, 31, FLUSH_OP__DEST_FLUSH_DEP, MONSTER_ENTRY_TYPE, 0, FALSE, (size_t)0, NULL); @@ -35781,23 +35781,23 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) { - /* verify the expected status of all entries we have loaded to date: */ + /* verify the expected status of all entries we have loaded to date: */ verify_entry_status(cache_ptr, 0, 5, expected); } if(pass) { - /* now do some protect / unprotect cycles to force the + /* now do some protect / unprotect cycles to force the * entries into the desired order in the hash bucket. - * Recall that entries are moved to the head of the + * Recall that entries are moved to the head of the * hash bucket list on lookup. */ - for (i = 24; i >= 0; i -= 8) - { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + for (i = 24; i >= 0; i -= 8) + { + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); - } + } } if(pass) { @@ -35810,7 +35810,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) i = 0; while(pass && (i <= 24)) - { + { entry_ptr = &(base_addr[i]); if(scan_ptr == NULL) { @@ -35830,7 +35830,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) scan_ptr = scan_ptr->ht_next; i += 8; } - } + } } @@ -35860,7 +35860,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) */ if(pass) - if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || + if((cache_ptr->insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->pinned_insertions[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->clears[MONSTER_ENTRY_TYPE] != 0) || (cache_ptr->flushes[MONSTER_ENTRY_TYPE] != 2) || @@ -35885,10 +35885,10 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if(pass) /* as this test is now checking for index list scan restarts, - * the following has been modified to check this instead of + * the following has been modified to check this instead of * hash bucket scan restarts. */ - if((cache_ptr->slist_scan_restarts != 0) || + if((cache_ptr->slist_scan_restarts != 0) || (cache_ptr->LRU_scan_restarts != 0) || (cache_ptr->index_scan_restarts != 1)) { pass = FALSE; @@ -35908,21 +35908,21 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) } /* cedds__H5C_flush_invalidate_cache__bucket_scan() */ - + /*------------------------------------------------------------------------- - * Function: check_stats() + * Function: check_stats() * - * Purpose: If stats are enabled, conduct tests to verify correct - * functioning of the cache statistics collection code. + * Purpose: If stats are enabled, conduct tests to verify correct + * functioning of the cache statistics collection code. * - * Skip the test if stats are not enabled. + * Skip the test if stats are not enabled. * - * At present this test is a shell -- fill it out at time - * permits. + * At present this test is a shell -- fill it out at time + * permits. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/12/15 * * Modifications: @@ -35977,7 +35977,7 @@ check_stats(unsigned paged) SKIPPED(); - HDfprintf(stdout, " Statistics collection disabled.\n"); + HDfprintf(stdout, " Statistics collection disabled.\n"); #endif /* H5C_COLLECT_CACHE_STATS */ @@ -35985,30 +35985,30 @@ check_stats(unsigned paged) } /* check_stats() */ - + /*------------------------------------------------------------------------- - * Function: check_stats__smoke_check_1() + * Function: check_stats__smoke_check_1() * - * Purpose: Test to see if the statistics collection code is working - * more or less as expected. Do this by performing a number - * of operations in the cache, and checking to verify that - * they result in the expected statistics. + * Purpose: Test to see if the statistics collection code is working + * more or less as expected. Do this by performing a number + * of operations in the cache, and checking to verify that + * they result in the expected statistics. * - * Note that this function is not intended to be a full test - * of the statistics collection facility -- only a cursory - * check that will serve as a place holder until more complete - * tests are implemented. + * Note that this function is not intended to be a full test + * of the statistics collection facility -- only a cursory + * check that will serve as a place holder until more complete + * tests are implemented. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/22/15 * * Modifications: * - * None. + * None. * *------------------------------------------------------------------------- */ @@ -36017,8 +36017,8 @@ static void check_stats__smoke_check_1(H5F_t * file_ptr) { H5C_t * cache_ptr = file_ptr->shared->cache; - int i; - herr_t result; + int i; + herr_t result; if(pass) { if(cache_ptr == NULL) { @@ -36035,15 +36035,15 @@ check_stats__smoke_check_1(H5F_t * file_ptr) else if((cache_ptr->max_cache_size != (2 * 1024 * 1024)) || (cache_ptr->min_clean_size != (1 * 1024 * 1024))) { - pass = FALSE; - failure_mssg = "unexpected cache config at start of check_stats__smoke_check_1()."; + pass = FALSE; + failure_mssg = "unexpected cache config at start of check_stats__smoke_check_1()."; } /* end else-if */ - else { + else { /* set min clean size to zero for this test as it simplifies - * computing the expected cache size after each operation. - */ + * computing the expected cache size after each operation. + */ cache_ptr->min_clean_size = 0; } /* end else */ } /* end if */ @@ -36129,13 +36129,13 @@ check_stats__smoke_check_1(H5F_t * file_ptr) #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ if(pass) - /* protect and unprotect each entry once. Note + /* protect and unprotect each entry once. Note * that all entries are already dirty, as they * entered the cache via insertion */ for(i = 0; i < 32; i++) { - protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); - unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); + protect_entry(file_ptr, MONSTER_ENTRY_TYPE, i); + unprotect_entry(file_ptr, MONSTER_ENTRY_TYPE, i, H5C__NO_FLAGS_SET); } /* end for */ if(pass) @@ -36216,7 +36216,7 @@ check_stats__smoke_check_1(H5F_t * file_ptr) if(pass) { /* protect and unprotect an entry that is not currently * in the cache. Since the cache is full and all entries - * are dirty, this will force a flush of each entry, and + * are dirty, this will force a flush of each entry, and * the eviction of (MET, 0). */ protect_entry(file_ptr, MONSTER_ENTRY_TYPE, 32); @@ -36416,7 +36416,7 @@ check_stats__smoke_check_1(H5F_t * file_ptr) #endif /* H5C_COLLECT_CACHE_STATS */ - + /*------------------------------------------------------------------------- * Function: main * @@ -36439,14 +36439,14 @@ main(void) express_test = GetTestExpress(); - printf("=========================================\n"); - printf("Internal cache tests\n"); - printf(" express_test = %d\n", express_test); - printf("=========================================\n"); + HDprintf("=========================================\n"); + HDprintf("Internal cache tests\n"); + HDprintf(" express_test = %d\n", express_test); + HDprintf("=========================================\n"); if(create_entry_arrays() < 0) { - printf("ERROR: Unable to create entries arrays. Aborting.\n"); + HDprintf("ERROR: Unable to create entries arrays. Aborting.\n"); return EXIT_FAILURE; } /* end if */ diff --git a/test/cache_api.c b/test/cache_api.c index 4f29009..87b9567 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -14,8 +14,8 @@ /* Programmer: John Mainzer * 11/10/05 * - * This file contains tests for the API calls associated - * with the cache implemented in H5C.c + * This file contains tests for the API calls associated + * with the cache implemented in H5C.c */ #include "cache_common.h" @@ -36,7 +36,7 @@ static hbool_t check_fapl_mdc_api_errs(void); static hbool_t check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id); - + /**************************************************************************/ /**************************************************************************/ /********************************* tests: *********************************/ @@ -104,8 +104,8 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t scratch; H5C_auto_size_ctl_t default_auto_size_ctl; @@ -495,7 +495,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id) } /* check_fapl_mdc_api_calls() */ - + /*------------------------------------------------------------------------- * Function: check_file_mdc_api_calls() * @@ -560,8 +560,8 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_2 = { @@ -595,8 +595,8 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_3 = { @@ -630,8 +630,8 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ FALSE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_4 = { @@ -666,8 +666,8 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.1f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; if(paged) @@ -813,9 +813,9 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) else { HDfprintf(stdout, "H5Fget_mdc_size() reports:\n"); - HDfprintf(stdout, " max_size: %ld, min_clean_size: %ld\n", + HDfprintf(stdout, " max_size: %ld, min_clean_size: %ld\n", (long)max_size, (long)min_clean_size); - HDfprintf(stdout, " cur_size: %ld, cur_num_entries: %d\n", + HDfprintf(stdout, " cur_size: %ld, cur_num_entries: %d\n", (long)cur_size, cur_num_entries); } #endif @@ -846,7 +846,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) } if ( ! pass ) { - + HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n", FUNC, failure_mssg); } @@ -854,14 +854,14 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id) } /* check_file_mdc_api_calls() */ - + /*------------------------------------------------------------------------- - * Function: mdc_api_call_smoke_check() + * Function: mdc_api_call_smoke_check() * * Purpose: Initial basic functional test to see if there are problems * with the cache API calls. * - * NOTE: This test takes some time to run and checks the + * NOTE: This test takes some time to run and checks the * HDF5TestExpress environment variable. * * Return: Test pass status (TRUE/FALSE) @@ -933,8 +933,8 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_2 = { @@ -968,8 +968,8 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; H5AC_cache_config_t mod_config_3 = { @@ -1003,8 +1003,8 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* hbool_t apply_empty_reserve = */ TRUE, /* double empty_reserve = */ 0.05f, /* int dirty_bytes_threshold = */ (256 * 1024), - /* int metadata_write_strategy = */ - H5AC__DEFAULT_METADATA_WRITE_STRATEGY + /* int metadata_write_strategy = */ + H5AC__DEFAULT_METADATA_WRITE_STRATEGY }; if(paged) @@ -1117,9 +1117,9 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* create the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, - dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); + dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1327,7 +1327,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "slab validation failed."; #else /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); #endif } @@ -1448,7 +1448,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) pass = FALSE; failure_mssg = "slab validation failed."; #if 0 /* as above */ - fprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); #endif } @@ -1523,9 +1523,9 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) } if ( pass ) { - + PASSED(); - + } else { H5_FAILED(); @@ -1561,7 +1561,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) *------------------------------------------------------------------------- */ -#define NUM_INVALID_CONFIGS 36 +#define NUM_INVALID_CONFIGS 36 static H5AC_cache_config_t * invalid_configs = NULL; static H5AC_cache_config_t * @@ -1737,7 +1737,7 @@ init_invalid_configs(void) { } /* initialize_invalid_configs() */ - + /*------------------------------------------------------------------------- * Function: check_fapl_mdc_api_errs() * @@ -1913,7 +1913,7 @@ check_fapl_mdc_api_errs(void) } /* check_fapl_mdc_api_errs() */ - + /*------------------------------------------------------------------------- * Function: check_file_mdc_api_errs() * @@ -2259,7 +2259,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id) } /* check_file_mdc_api_errs() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -2285,10 +2285,10 @@ main(void) express_test = GetTestExpress(); - printf("===================================\n"); - printf("Cache API tests\n"); - printf(" express_test = %d\n", express_test); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("Cache API tests\n"); + HDprintf(" express_test = %d\n", express_test); + HDprintf("===================================\n"); /* Initialize invalid configurations. diff --git a/test/cache_common.c b/test/cache_common.c index 94d3f59..24962bc 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -14,8 +14,8 @@ /* Programmer: John Mainzer * 10/27/05 * - * This file contains common code for tests of the cache - * implemented in H5C.c + * This file contains common code for tests of the cache + * implemented in H5C.c */ #include "H5CXprivate.h" /* API Contexts */ #include "H5MFprivate.h" @@ -33,27 +33,27 @@ const char *FILENAME[] = { }; hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between - * cache setup and takedown. Note - * that if saved_fapl_id == H5P_DEFAULT, - * we assume that there is no fapl to - * close. - */ + * cache setup and takedown. Note + * that if saved_fapl_id == H5P_DEFAULT, + * we assume that there is no fapl to + * close. + */ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between - * cache setup and takedown. Note - * that if saved_fcpl_id == H5P_DEFAULT, - * we assume that there is no fcpl to - * close. - */ + * cache setup and takedown. Note + * that if saved_fcpl_id == H5P_DEFAULT, + * we assume that there is no fcpl to + * close. + */ hid_t saved_fid = -1; /* store the file id here between cache setup - * and takedown. - */ + * and takedown. + */ H5C_t * saved_cache = NULL; /* store the pointer to the instance of - * of H5C_t created by H5Fcreate() - * here between test cache setup and - * shutdown. - */ + * of H5C_t created by H5Fcreate() + * here between test cache setup and + * shutdown. + */ haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the space allocated for cache items in the file between @@ -132,37 +132,37 @@ static herr_t variable_image_len(const void *thing, size_t *image_len_ptr); static herr_t notify_image_len(const void *thing, size_t *image_len_ptr); static herr_t pico_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t nano_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t micro_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t tiny_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t small_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t medium_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t large_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t huge_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t monster_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t variable_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t notify_pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); static herr_t pico_serialize(const H5F_t *f, void *image_ptr, @@ -215,11 +215,11 @@ static void *deserialize(const void *image_ptr, size_t len, void *udata_ptr, hbool_t *dirty_ptr, int32_t entry_type); static herr_t image_len(const void *thing, size_t *image_len_ptr, int32_t entry_type); static herr_t pre_serialize(H5F_t *f, void *thing, - haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, + haddr_t addr, size_t len, haddr_t *new_addr_ptr, size_t *new_len_ptr, unsigned *flags_ptr); -static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len, +static herr_t serialize(const H5F_t *f, void *image_ptr, size_t len, void *thing); -static herr_t notify(H5C_notify_action_t action, void *thing, int32_t +static herr_t notify(H5C_notify_action_t action, void *thing, int32_t entry_type); static herr_t free_icr(test_entry_t *entry, int32_t entry_type); @@ -291,7 +291,7 @@ const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES] = NOTIFY_ALT_BASE_ADDR }; - + /* Callback classes */ static const H5C_class_t pico_class[1] = {{ PICO_ENTRY_TYPE, @@ -498,16 +498,16 @@ const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES] = { /* address translation functions: */ - + /*------------------------------------------------------------------------- - * Function: addr_to_type_and_index + * Function: addr_to_type_and_index * - * Purpose: Given an address, compute the type and index of the - * associated entry. + * Purpose: Given an address, compute the type and index of the + * associated entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -577,7 +577,7 @@ addr_to_type_and_index(haddr_t addr, /* Call back functions: */ - + /*------------------------------------------------------------------------- * * Function: check_if_write_permitted @@ -607,16 +607,16 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt return(SUCCEED); } /* check_write_permitted() */ - + /*------------------------------------------------------------------------- - * Function: get_initial_load_size & friends + * Function: get_initial_load_size & friends * - * Purpose: Query the image size for loading an entry. The helper + * Purpose: Query the image size for loading an entry. The helper * functions funnel into get_initial_load_size proper. * - * Return: SUCCEED + * Return: SUCCEED * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 5/18/10 * *------------------------------------------------------------------------- @@ -716,16 +716,16 @@ notify_get_initial_load_size(void *udata, size_t *image_length) return get_initial_load_size(udata, image_length, NOTIFY_ENTRY_TYPE); } - + /*------------------------------------------------------------------------- - * Function: get_final_load_size & friends + * Function: get_final_load_size & friends * - * Purpose: Query the final image size for loading an entry. The helper + * Purpose: Query the final image size for loading an entry. The helper * functions funnel into get_final_load_size proper. * - * Return: SUCCEED + * Return: SUCCEED * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 11/18/16 * *------------------------------------------------------------------------- @@ -774,19 +774,19 @@ variable_get_final_load_size(const void *image, size_t image_len, return get_final_load_size(image, image_len, udata, actual_len, VARIABLE_ENTRY_TYPE); } - + /*------------------------------------------------------------------------- - * Function: verify_chksum & friends - * (only done for VARIABLE_ENTRY_TYPE which has a speculative read) + * Function: verify_chksum & friends + * (only done for VARIABLE_ENTRY_TYPE which has a speculative read) * - * Purpose: Simulate checksum verification: - * --check is ok only after 'max_verify_ct' is reached - * --otherwise check is not ok + * Purpose: Simulate checksum verification: + * --check is ok only after 'max_verify_ct' is reached + * --otherwise check is not ok * - * Return: TRUE: checksum is ok - * FALSE: checksum is not ok + * Return: TRUE: checksum is ok + * FALSE: checksum is not ok * - * Programmer: + * Programmer: * *------------------------------------------------------------------------- */ @@ -817,9 +817,9 @@ verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void HDassert(entry->addr == addr); if(++entry->verify_ct >= entry->max_verify_ct) - return(TRUE); - else - return(FALSE); + return(TRUE); + else + return(FALSE); } /* verify_chksum() */ @@ -829,17 +829,17 @@ variable_verify_chksum(const void *image, size_t len, void *udata) return verify_chksum(image, len, udata, VARIABLE_ENTRY_TYPE); } - + /*------------------------------------------------------------------------- - * Function: deserialize & friends + * Function: deserialize & friends * - * Purpose: deserialize the entry. The helper functions verify that the - * correct version of deserialize is being called, and then call - * deserialize proper. + * Purpose: deserialize the entry. The helper functions verify that the + * correct version of deserialize is being called, and then call + * deserialize proper. * - * Return: void * (pointer to the in core representation of the entry) + * Return: void * (pointer to the in core representation of the entry) * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/20/07 * *------------------------------------------------------------------------- @@ -891,7 +891,7 @@ deserialize(const void *image, size_t len, void *udata, hbool_t *dirty, HDfprintf(stdout, "expected *image = 0x%x\n", (int)(idx & 0xFF)); } /* end if */ - HDassert((*((const char *)image)) == (char)(idx & 0xFF)); + HDassert((*((const char *)image)) == (char)(idx & 0xFF)); } /* end if */ else { if((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) { @@ -905,9 +905,9 @@ deserialize(const void *image, size_t len, void *udata, hbool_t *dirty, (int)(idx & 0xFF), (int)((idx & 0xFF00) >> 8)); } /* end if */ - HDassert((*((const char *)image)) == (char)(type & 0xFF)); - HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8)); - HDassert((*(((const char *)image) + 2)) == (char)(idx & 0xFF)); + HDassert((*((const char *)image)) == (char)(type & 0xFF)); + HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8)); + HDassert((*(((const char *)image) + 2)) == (char)(idx & 0xFF)); } /* end else */ } /* end if */ @@ -985,18 +985,18 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty) return deserialize(image, len, udata, dirty, NOTIFY_ENTRY_TYPE); } - + /*------------------------------------------------------------------------- - * Function: image_len & friends + * Function: image_len & friends * - * Purpose: Return the real (and possibly reduced) length of the image. - * The helper functions verify that the correct version of - * deserialize is being called, and then call deserialize - * proper. + * Purpose: Return the real (and possibly reduced) length of the image. + * The helper functions verify that the correct version of + * deserialize is being called, and then call deserialize + * proper. * - * Return: SUCCEED + * Return: SUCCEED * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/19/07 * *------------------------------------------------------------------------- @@ -1027,10 +1027,10 @@ image_len(const void *thing, size_t *image_length, int32_t entry_type) HDassert(entry == &(base_addr[idx])); if(type != VARIABLE_ENTRY_TYPE) - HDassert(entry->size == entry_sizes[type]); + HDassert(entry->size == entry_sizes[type]); else { - HDassert(entry->size <= entry_sizes[type]); - HDassert(entry->size > 0); + HDassert(entry->size <= entry_sizes[type]); + HDassert(entry->size > 0); } /* end else */ *image_length = entry->size; @@ -1104,21 +1104,21 @@ notify_image_len(const void *thing, size_t *image_length) return image_len(thing, image_length, NOTIFY_ENTRY_TYPE); } - + /*------------------------------------------------------------------------- - * Function: pre_serialize & friends + * Function: pre_serialize & friends * - * Purpose: Pre_serialize the supplied entry. For now this consistes of - * executing any flush operations and loading the appropriate - * values into *new_addr_ptr, *new_len_ptr, and *flags_ptr. + * Purpose: Pre_serialize the supplied entry. For now this consistes of + * executing any flush operations and loading the appropriate + * values into *new_addr_ptr, *new_len_ptr, and *flags_ptr. * - * The helper functions verify that the correct version of - * serialize is being called, and then call serialize - * proper. + * The helper functions verify that the correct version of + * serialize is being called, and then call serialize + * proper. * - * Return: SUCCEED if successful, FAIL otherwise. + * Return: SUCCEED if successful, FAIL otherwise. * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/07/14 * *------------------------------------------------------------------------- @@ -1216,7 +1216,7 @@ pico_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1229,7 +1229,7 @@ nano_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1242,7 +1242,7 @@ micro_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1255,7 +1255,7 @@ tiny_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1268,7 +1268,7 @@ small_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1281,7 +1281,7 @@ medium_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1294,7 +1294,7 @@ large_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1307,7 +1307,7 @@ huge_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1320,7 +1320,7 @@ monster_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1333,7 +1333,7 @@ variable_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } @@ -1346,28 +1346,28 @@ notify_pre_serialize(H5F_t *f, size_t *new_len_ptr, unsigned *flags_ptr) { - return pre_serialize(f, thing, addr, len, + return pre_serialize(f, thing, addr, len, new_addr_ptr, new_len_ptr, flags_ptr); } - + /*------------------------------------------------------------------------- - * Function: serialize & friends + * Function: serialize & friends * - * Purpose: Serialize the supplied entry. For now this consistes of - * loading the type and index of the entry into the first - * three bytes of the image (if it is long enough -- if not - * just load the low order byte of the index into the first - * byte of the image). + * Purpose: Serialize the supplied entry. For now this consistes of + * loading the type and index of the entry into the first + * three bytes of the image (if it is long enough -- if not + * just load the low order byte of the index into the first + * byte of the image). * - * The helper functions verify that the correct version of - * serialize is being called, and then call serialize - * proper. + * The helper functions verify that the correct version of + * serialize is being called, and then call serialize + * proper. * - * Return: SUCCEED if successful, FAIL otherwise. + * Return: SUCCEED if successful, FAIL otherwise. * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/19/07 * *------------------------------------------------------------------------- @@ -1408,14 +1408,14 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin if((type == PICO_ENTRY_TYPE) || (type == VARIABLE_ENTRY_TYPE) || (type == NOTIFY_ENTRY_TYPE )) { - HDassert(entry->size >= PICO_ENTRY_SIZE); - *((char *)image_ptr) = (char)((entry->index) & 0xFF); + HDassert(entry->size >= PICO_ENTRY_SIZE); + *((char *)image_ptr) = (char)((entry->index) & 0xFF); } /* end if */ else { - HDassert(entry->size >= NANO_ENTRY_SIZE); - *((char *)image_ptr) = (char)((entry->type) & 0xFF); - *(((char *)image_ptr) + 1) = (char)(((entry->index) & 0xFF00) >> 8); - *(((char *)image_ptr) + 2) = (char)((entry->index) & 0xFF); + HDassert(entry->size >= NANO_ENTRY_SIZE); + *((char *)image_ptr) = (char)((entry->type) & 0xFF); + *(((char *)image_ptr) + 1) = (char)(((entry->index) & 0xFF00) >> 8); + *(((char *)image_ptr) + 2) = (char)((entry->index) & 0xFF); } /* end else */ /* We no longer do the actual write through an callback -- this is @@ -1425,7 +1425,7 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin entry->is_dirty = FALSE; if(entry->flush_dep_npar > 0) { - HDassert(entry->flush_dep_ndirty_chd == 0); + HDassert(entry->flush_dep_ndirty_chd == 0); mark_flush_dep_clean(entry); } /* end if */ @@ -1433,9 +1433,9 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin * as initialized. */ if(entry->at_main_addr) - entry->written_to_main_addr = TRUE; + entry->written_to_main_addr = TRUE; else - entry->written_to_alt_addr = TRUE; + entry->written_to_alt_addr = TRUE; /* do book keeping */ (entry->serializes)++; @@ -1475,7 +1475,7 @@ small_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void } herr_t -medium_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, +medium_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { return serialize(f, image_ptr, len, thing); @@ -1494,37 +1494,37 @@ huge_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void } herr_t -monster_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, +monster_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { return serialize(f, image_ptr, len, thing); } herr_t -variable_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, +variable_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { return serialize(f, image_ptr, len, thing); } herr_t -notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, +notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing) { return serialize(f, image_ptr, len, thing); } - + /*------------------------------------------------------------------------- - * Function: notify & friends + * Function: notify & friends * - * Purpose: Record notifications of cache events for the entry. + * Purpose: Record notifications of cache events for the entry. * The helper functions verify that the correct version of notify * is being called, and then call notify proper. * - * Return: SUCCEED + * Return: SUCCEED * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 4/28/09 * *------------------------------------------------------------------------- @@ -1553,8 +1553,8 @@ notify(H5C_notify_action_t action, void *thing, int32_t entry_type) /* Increment count for appropriate action */ switch(action) { - case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added */ - case H5C_NOTIFY_ACTION_AFTER_LOAD: /* to the cache. */ + case H5C_NOTIFY_ACTION_AFTER_INSERT: /* Entry has been added */ + case H5C_NOTIFY_ACTION_AFTER_LOAD: /* to the cache. */ entry->notify_after_insert_count++; break; @@ -1565,8 +1565,8 @@ notify(H5C_notify_action_t action, void *thing, int32_t entry_type) case H5C_NOTIFY_ACTION_CHILD_CLEANED: case H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED: case H5C_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ - break; + /* do nothing */ + break; case H5C_NOTIFY_ACTION_BEFORE_EVICT: /* Entry is about to be evicted from cache */ entry->notify_before_evict_count++; @@ -1585,25 +1585,25 @@ notify_notify(H5C_notify_action_t action, void *thing) return(notify(action, thing, NOTIFY_ENTRY_TYPE)); } - + /*------------------------------------------------------------------------- - * Function: free_icr & friends + * Function: free_icr & friends * - * Purpose: Nominally, this callback is supposed to free the - * in core representation of the entry. + * Purpose: Nominally, this callback is supposed to free the + * in core representation of the entry. * - * In the context of this test bed, we use it to do - * do all the processing we used to do on a destroy. - * In particular, we use it to release all the pins - * that this entry may have on other entries. + * In the context of this test bed, we use it to do + * do all the processing we used to do on a destroy. + * In particular, we use it to release all the pins + * that this entry may have on other entries. * - * The helper functions verify that the correct version of - * serialize is being called, and then call free_icr - * proper. + * The helper functions verify that the correct version of + * serialize is being called, and then call free_icr + * proper. * - * Return: SUCCEED + * Return: SUCCEED * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/19/07 * *------------------------------------------------------------------------- @@ -1629,43 +1629,43 @@ free_icr(test_entry_t *entry, int32_t entry_type) HDassert(entry->header.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); HDassert(entry->header.size == entry->size); HDassert((entry->type == VARIABLE_ENTRY_TYPE) || - (entry->size == entry_sizes[entry->type])); + (entry->size == entry_sizes[entry->type])); HDassert(entry->header.tl_next == NULL); HDassert(entry->header.tl_prev == NULL); if(entry->num_pins > 0) { int i; - for(i = 0; i < entry->num_pins; i++) { + for(i = 0; i < entry->num_pins; i++) { test_entry_t *pinned_entry; test_entry_t *pinned_base_addr; - pinned_base_addr = entries[entry->pin_type[i]]; - pinned_entry = &(pinned_base_addr[entry->pin_idx[i]]); + pinned_base_addr = entries[entry->pin_type[i]]; + pinned_entry = &(pinned_base_addr[entry->pin_idx[i]]); - HDassert(0 <= pinned_entry->type); + HDassert(0 <= pinned_entry->type); HDassert(pinned_entry->type < NUMBER_OF_ENTRY_TYPES); - HDassert(pinned_entry->type == entry->pin_type[i]); - HDassert(pinned_entry->index >= 0); - HDassert(pinned_entry->index <= max_indices[pinned_entry->type]); - HDassert(pinned_entry->index == entry->pin_idx[i]); - HDassert(pinned_entry == pinned_entry->self); - HDassert(pinned_entry->header.is_pinned); - HDassert(pinned_entry->is_pinned); - HDassert(pinned_entry->pinning_ref_count > 0); - - pinned_entry->pinning_ref_count--; - - if(pinned_entry->pinning_ref_count <= 0) { + HDassert(pinned_entry->type == entry->pin_type[i]); + HDassert(pinned_entry->index >= 0); + HDassert(pinned_entry->index <= max_indices[pinned_entry->type]); + HDassert(pinned_entry->index == entry->pin_idx[i]); + HDassert(pinned_entry == pinned_entry->self); + HDassert(pinned_entry->header.is_pinned); + HDassert(pinned_entry->is_pinned); + HDassert(pinned_entry->pinning_ref_count > 0); + + pinned_entry->pinning_ref_count--; + + if(pinned_entry->pinning_ref_count <= 0) { HDassert(pinned_entry->file_ptr); - unpin_entry(pinned_entry->type, pinned_entry->index); - } /* end if */ + unpin_entry(pinned_entry->type, pinned_entry->index); + } /* end if */ - entry->pin_type[i] = -1; - entry->pin_idx[i] = -1; - } /* end if */ - entry->num_pins = 0; + entry->pin_type[i] = -1; + entry->pin_idx[i] = -1; + } /* end if */ + entry->num_pins = 0; } /* end if */ entry->destroyed = TRUE; @@ -1740,7 +1740,7 @@ notify_free_icr(void *thing) return free_icr((test_entry_t *)thing, NOTIFY_ENTRY_TYPE); } - + /**************************************************************************/ /**************************************************************************/ /************************** test utility functions: ***********************/ @@ -1748,16 +1748,16 @@ notify_free_icr(void *thing) /**************************************************************************/ /*------------------------------------------------------------------------- - * Function: add_flush_op + * Function: add_flush_op * - * Purpose: Do nothing if pass is FALSE on entry. + * Purpose: Do nothing if pass is FALSE on entry. * * Otherwise, add the specified flush operation to the * target instance of test_entry_t. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/1/06 * *------------------------------------------------------------------------- @@ -1765,12 +1765,12 @@ notify_free_icr(void *thing) void add_flush_op(int target_type, - int target_idx, - int op_code, - int type, - int idx, - hbool_t flag, - size_t new_size, + int target_idx, + int op_code, + int type, + int idx, + hbool_t flag, + size_t new_size, unsigned * order_ptr) { int i; @@ -1779,10 +1779,10 @@ add_flush_op(int target_type, HDassert( ( 0 <= target_type ) && ( target_type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= target_idx ) && - ( target_idx <= max_indices[target_type] ) ); + ( target_idx <= max_indices[target_type] ) ); HDassert( ( 0 <= op_code ) && ( op_code <= FLUSH_OP__MAX_OP ) ); HDassert( ( op_code != FLUSH_OP__RESIZE ) || - ( type == VARIABLE_ENTRY_TYPE ) ); + ( type == VARIABLE_ENTRY_TYPE ) ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); HDassert( new_size <= VARIABLE_ENTRY_SIZE ); @@ -1801,15 +1801,15 @@ add_flush_op(int target_type, HDassert( target_entry_ptr->index == target_idx ); HDassert( target_entry_ptr->type == target_type ); HDassert( target_entry_ptr == target_entry_ptr->self ); - HDassert( target_entry_ptr->num_flush_ops < MAX_FLUSH_OPS ); + HDassert( target_entry_ptr->num_flush_ops < MAX_FLUSH_OPS ); - i = (target_entry_ptr->num_flush_ops)++; - (target_entry_ptr->flush_ops)[i].op_code = op_code; - (target_entry_ptr->flush_ops)[i].type = type; - (target_entry_ptr->flush_ops)[i].idx = idx; - (target_entry_ptr->flush_ops)[i].flag = flag; - (target_entry_ptr->flush_ops)[i].size = new_size; - (target_entry_ptr->flush_ops)[i].order_ptr = order_ptr; + i = (target_entry_ptr->num_flush_ops)++; + (target_entry_ptr->flush_ops)[i].op_code = op_code; + (target_entry_ptr->flush_ops)[i].type = type; + (target_entry_ptr->flush_ops)[i].idx = idx; + (target_entry_ptr->flush_ops)[i].flag = flag; + (target_entry_ptr->flush_ops)[i].size = new_size; + (target_entry_ptr->flush_ops)[i].order_ptr = order_ptr; } @@ -1817,24 +1817,24 @@ add_flush_op(int target_type, } /* add_flush_op() */ - + /*------------------------------------------------------------------------- - * Function: create_pinned_entry_dependency + * Function: create_pinned_entry_dependency * - * Purpose: Do nothing if pass is FALSE on entry. + * Purpose: Do nothing if pass is FALSE on entry. * * Otherwise, set up a pinned entry dependency so we can * test the pinned entry modifications to the flush routine. * - * Given the types and indicies of the pinned and pinning - * entries, add the pinned entry to the list of pinned - * entries in the pinning entry, increment the - * pinning reference count of the pinned entry, and - * if that count was zero initially, pin the entry. + * Given the types and indicies of the pinned and pinning + * entries, add the pinned entry to the list of pinned + * entries in the pinning entry, increment the + * pinning reference count of the pinned entry, and + * if that count was zero initially, pin the entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -1842,10 +1842,10 @@ add_flush_op(int target_type, void create_pinned_entry_dependency(H5F_t * file_ptr, - int pinning_type, + int pinning_type, int pinning_idx, - int pinned_type, - int pinned_idx) + int pinned_type, + int pinned_idx) { test_entry_t * pinning_base_addr; test_entry_t * pinning_entry_ptr; @@ -1855,13 +1855,13 @@ create_pinned_entry_dependency(H5F_t * file_ptr, if ( pass ) { HDassert( ( 0 <= pinning_type ) && - ( pinning_type < NUMBER_OF_ENTRY_TYPES ) ); + ( pinning_type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= pinning_idx ) && - ( pinning_idx <= max_indices[pinning_type] ) ); + ( pinning_idx <= max_indices[pinning_type] ) ); HDassert( ( 0 <= pinned_type ) && - ( pinned_type < NUMBER_OF_ENTRY_TYPES ) ); + ( pinned_type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= pinned_idx ) && - ( pinned_idx <= max_indices[pinned_type] ) ); + ( pinned_idx <= max_indices[pinned_type] ) ); pinning_base_addr = entries[pinning_type]; pinning_entry_ptr = &(pinning_base_addr[pinning_idx]); @@ -1872,47 +1872,47 @@ create_pinned_entry_dependency(H5F_t * file_ptr, HDassert( pinning_entry_ptr->index == pinning_idx ); HDassert( pinning_entry_ptr->type == pinning_type ); HDassert( pinning_entry_ptr == pinning_entry_ptr->self ); - HDassert( pinning_entry_ptr->num_pins < MAX_PINS ); + HDassert( pinning_entry_ptr->num_pins < MAX_PINS ); HDassert( pinning_entry_ptr->index == pinning_idx ); HDassert( pinning_entry_ptr->type == pinning_type ); HDassert( pinning_entry_ptr == pinning_entry_ptr->self ); - HDassert( ! ( pinning_entry_ptr->is_protected ) ); + HDassert( ! ( pinning_entry_ptr->is_protected ) ); - pinning_entry_ptr->pin_type[pinning_entry_ptr->num_pins] = pinned_type; - pinning_entry_ptr->pin_idx[pinning_entry_ptr->num_pins] = pinned_idx; - (pinning_entry_ptr->num_pins)++; + pinning_entry_ptr->pin_type[pinning_entry_ptr->num_pins] = pinned_type; + pinning_entry_ptr->pin_idx[pinning_entry_ptr->num_pins] = pinned_idx; + (pinning_entry_ptr->num_pins)++; if ( pinned_entry_ptr->pinning_ref_count == 0 ) { - protect_entry(file_ptr, pinned_type, pinned_idx); - unprotect_entry(file_ptr, pinned_type, pinned_idx, H5C__PIN_ENTRY_FLAG); - } + protect_entry(file_ptr, pinned_type, pinned_idx); + unprotect_entry(file_ptr, pinned_type, pinned_idx, H5C__PIN_ENTRY_FLAG); + } - (pinned_entry_ptr->pinning_ref_count)++; + (pinned_entry_ptr->pinning_ref_count)++; } return; } /* create_pinned_entry_dependency() */ - + /*------------------------------------------------------------------------- - * Function: dirty_entry + * Function: dirty_entry * - * Purpose: Given a pointer to a cache, an entry type, and an index, - * dirty the target entry. + * Purpose: Given a pointer to a cache, an entry type, and an index, + * dirty the target entry. * - * If the dirty_pin parameter is true, verify that the - * target entry is in the cache and is pinned. If it - * isn't, scream and die. If it is, use the - * H5C_mark_entry_dirty() call to dirty it. + * If the dirty_pin parameter is true, verify that the + * target entry is in the cache and is pinned. If it + * isn't, scream and die. If it is, use the + * H5C_mark_entry_dirty() call to dirty it. * - * Do nothing if pass is false on entry. + * Do nothing if pass is false on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -1922,7 +1922,7 @@ void dirty_entry(H5F_t * file_ptr, int32_t type, int32_t idx, - hbool_t dirty_pin) + hbool_t dirty_pin) { test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -1938,54 +1938,54 @@ dirty_entry(H5F_t * file_ptr, HDassert(cache_ptr); - if ( ! entry_in_cache(cache_ptr, type, idx) ) { + if ( ! entry_in_cache(cache_ptr, type, idx) ) { - pass = FALSE; + pass = FALSE; failure_mssg = "entry to be dirty pinned is not in cache."; - } else { + } else { base_addr = entries[type]; entry_ptr = &(base_addr[idx]); - HDassert( entry_ptr->index == idx ); - HDassert( entry_ptr->type == type ); + HDassert( entry_ptr->index == idx ); + HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - if ( ! ( (entry_ptr->header).is_pinned ) ) { + if ( ! ( (entry_ptr->header).is_pinned ) ) { pass = FALSE; failure_mssg = "entry to be dirty pinned is not pinned."; } else { - mark_entry_dirty(type, idx); + mark_entry_dirty(type, idx); - } - } + } + } } else { - protect_entry(file_ptr, type, idx); + protect_entry(file_ptr, type, idx); unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG); - } + } } return; } /* dirty_entry() */ - + /*------------------------------------------------------------------------- - * Function: execute_flush_op + * Function: execute_flush_op * - * Purpose: Given a pointer to an instance of struct flush_op, execute - * it. + * Purpose: Given a pointer to an instance of struct flush_op, execute + * it. * - * Do nothing if pass is false on entry. + * Do nothing if pass is false on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/1/06 * *------------------------------------------------------------------------- @@ -1993,9 +1993,9 @@ dirty_entry(H5F_t * file_ptr, void execute_flush_op(H5F_t * file_ptr, - struct test_entry_t * entry_ptr, - struct flush_op * op_ptr, - unsigned * flags_ptr) + struct test_entry_t * entry_ptr, + struct flush_op * op_ptr, + unsigned * flags_ptr) { H5C_t * cache_ptr; @@ -2027,56 +2027,56 @@ execute_flush_op(H5F_t * file_ptr, if ( pass ) { - switch ( op_ptr->op_code ) - { - case FLUSH_OP__NO_OP: - break; + switch ( op_ptr->op_code ) + { + case FLUSH_OP__NO_OP: + break; - case FLUSH_OP__DIRTY: - HDassert( ( entry_ptr->type != op_ptr->type ) || - ( entry_ptr->index != op_ptr->idx ) ); + case FLUSH_OP__DIRTY: + HDassert( ( entry_ptr->type != op_ptr->type ) || + ( entry_ptr->index != op_ptr->idx ) ); - dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); - break; + dirty_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); + break; case FLUSH_OP__RESIZE: - if ( ( entry_ptr->type == op_ptr->type ) && + if ( ( entry_ptr->type == op_ptr->type ) && ( entry_ptr->index == op_ptr->idx ) ) { /* the flush operation is acting on the entry to - * which it is attached. Handle this here: - */ + * which it is attached. Handle this here: + */ HDassert( entry_ptr->type == VARIABLE_ENTRY_TYPE ); - HDassert( op_ptr->size > 0 ); - HDassert( op_ptr->size <= VARIABLE_ENTRY_SIZE ); + HDassert( op_ptr->size > 0 ); + HDassert( op_ptr->size <= VARIABLE_ENTRY_SIZE ); entry_ptr->size = op_ptr->size; - (*flags_ptr) |= H5C__SERIALIZE_RESIZED_FLAG; + (*flags_ptr) |= H5C__SERIALIZE_RESIZED_FLAG; - entry_ptr->flush_op_self_resize_in_progress = TRUE; + entry_ptr->flush_op_self_resize_in_progress = TRUE; - } else { + } else { - /* change the size of some other entry */ + /* change the size of some other entry */ - resize_entry(file_ptr, op_ptr->type, op_ptr->idx, + resize_entry(file_ptr, op_ptr->type, op_ptr->idx, op_ptr->size, op_ptr->flag); - } - break; + } + break; - case FLUSH_OP__MOVE: - if((entry_ptr->type == op_ptr->type) && + case FLUSH_OP__MOVE: + if((entry_ptr->type == op_ptr->type) && (entry_ptr->index == op_ptr->idx)) { /* the flush operation is acting on the entry to - * which it is attached. Handle this here: - */ + * which it is attached. Handle this here: + */ - HDassert(((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0); + HDassert(((*flags_ptr) & H5C__SERIALIZE_RESIZED_FLAG) != 0); (*flags_ptr) |= H5C__SERIALIZE_MOVED_FLAG; - if(op_ptr->flag) { + if(op_ptr->flag) { HDassert(entry_ptr->addr == entry_ptr->alt_addr); entry_ptr->addr = entry_ptr->main_addr; entry_ptr->at_main_addr = TRUE; @@ -2086,65 +2086,65 @@ execute_flush_op(H5F_t * file_ptr, entry_ptr->addr = entry_ptr->alt_addr; entry_ptr->at_main_addr = FALSE; } /* end else */ - } /* end if */ + } /* end if */ else - move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); - break; + move_entry(cache_ptr, op_ptr->type, op_ptr->idx, op_ptr->flag); + break; - case FLUSH_OP__ORDER: + case FLUSH_OP__ORDER: HDassert( op_ptr->order_ptr ); entry_ptr->flush_order = *op_ptr->order_ptr; (*op_ptr->order_ptr)++; - break; - - case FLUSH_OP__EXPUNGE: - /* the expunge flush op exists to allow us to simulate the - * case in which an entry is removed from the cashe as the - * the result of the flush of a second entry. At present, - * this can only happen via the take ownership flag, but - * we will make this test feature more general to as to make - * tests easier to write. - * - * When this operation is executed, the target entry is - * removed from the cache without being flushed if dirty - * via the expunge_entry() test function (which calls - * H5C_expunge_entry()). Note that this flush operation - * must always be executed on an entry other than the - * entry being flushed. - */ - HDassert( ( entry_ptr->type != op_ptr->type ) || + break; + + case FLUSH_OP__EXPUNGE: + /* the expunge flush op exists to allow us to simulate the + * case in which an entry is removed from the cashe as the + * the result of the flush of a second entry. At present, + * this can only happen via the take ownership flag, but + * we will make this test feature more general to as to make + * tests easier to write. + * + * When this operation is executed, the target entry is + * removed from the cache without being flushed if dirty + * via the expunge_entry() test function (which calls + * H5C_expunge_entry()). Note that this flush operation + * must always be executed on an entry other than the + * entry being flushed. + */ + HDassert( ( entry_ptr->type != op_ptr->type ) || ( entry_ptr->index != op_ptr->idx ) ); - expunge_entry(file_ptr, op_ptr->type, op_ptr->idx); - break; + expunge_entry(file_ptr, op_ptr->type, op_ptr->idx); + break; - case FLUSH_OP__DEST_FLUSH_DEP: - HDassert( ( entry_ptr->type != op_ptr->type ) || + case FLUSH_OP__DEST_FLUSH_DEP: + HDassert( ( entry_ptr->type != op_ptr->type ) || ( entry_ptr->index != op_ptr->idx ) ); - destroy_flush_dependency(op_ptr->type, op_ptr->idx, + destroy_flush_dependency(op_ptr->type, op_ptr->idx, entry_ptr->type, entry_ptr->index); break; - default: + default: pass = FALSE; failure_mssg = "Undefined flush op code."; - break; - } + break; + } } return; } /* execute_flush_op() */ - + /*------------------------------------------------------------------------- - * Function: entry_in_cache + * Function: entry_in_cache * - * Purpose: Given a pointer to a cache, an entry type, and an index, - * determine if the entry is currently in the cache. + * Purpose: Given a pointer to a cache, an entry type, and an index, + * determine if the entry is currently in the cache. * - * Return: TRUE if the entry is in the cache, and FALSE otherwise. + * Return: TRUE if the entry is in the cache, and FALSE otherwise. * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -2184,7 +2184,7 @@ entry_in_cache(H5C_t * cache_ptr, } /* entry_in_cache() */ - + /*------------------------------------------------------------------------- * Function: create_entry_arrays * @@ -2192,7 +2192,7 @@ entry_in_cache(H5C_t * cache_ptr, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson + * Programmer: Dana Robinson * Spring 2016 * *------------------------------------------------------------------------- @@ -2300,7 +2300,7 @@ error: } /* create_entry_arrays() */ - + /*------------------------------------------------------------------------- * Function: free_entry_arrays * @@ -2308,7 +2308,7 @@ error: * * Return: void * - * Programmer: Dana Robinson + * Programmer: Dana Robinson * Spring 2016 * *------------------------------------------------------------------------- @@ -2366,15 +2366,15 @@ free_entry_arrays(void) } /* free_entry_arrays() */ - + /*------------------------------------------------------------------------- - * Function: reset_entries + * Function: reset_entries * - * Purpose: reset the contents of the entries arrays to known values. + * Purpose: reset the contents of the entries arrays to known values. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -2518,15 +2518,15 @@ reset_entries(void) } /* reset_entries() */ - + /*------------------------------------------------------------------------- * Function: resize_entry * * Purpose: Given a pointer to a cache, an entry type, an index, and - * a new size, set the size of the target entry to the new size. + * a new size, set the size of the target entry to the new size. * - * Note that at present, the type of the entry must be - * VARIABLE_ENTRY_TYPE. + * Note that at present, the type of the entry must be + * VARIABLE_ENTRY_TYPE. * * Do nothing if pass is false on entry. * @@ -2543,7 +2543,7 @@ resize_entry(H5F_t * file_ptr, int32_t type, int32_t idx, size_t new_size, - hbool_t in_cache) + hbool_t in_cache) { test_entry_t * base_addr; test_entry_t * entry_ptr; @@ -2606,28 +2606,28 @@ resize_entry(H5F_t * file_ptr, } } else { - protect_entry(file_ptr, type, idx); + protect_entry(file_ptr, type, idx); resize_entry(file_ptr, type, idx, new_size, TRUE); - unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG); - } + unprotect_entry(file_ptr, type, idx, H5C__DIRTIED_FLAG); + } } return; } /* resize_entry() */ - + /*------------------------------------------------------------------------- - * Function: verify_clean + * Function: verify_clean * - * Purpose: Verify that all cache entries are marked as clean. If any - * are not, set pass to FALSE. + * Purpose: Verify that all cache entries are marked as clean. If any + * are not, set pass to FALSE. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -2655,7 +2655,7 @@ verify_clean(void) for ( j = 0; j <= max_index; j++ ) { if ( ( base_addr[j].header.is_dirty ) || - ( base_addr[j].is_dirty ) ) { + ( base_addr[j].is_dirty ) ) { dirty_count++; } @@ -2673,19 +2673,19 @@ verify_clean(void) } /* verify_clean() */ - + /*------------------------------------------------------------------------- - * Function: verify_entry_status + * Function: verify_entry_status * - * Purpose: Verify that a list of entries have the expected status. - * If any discrepencies are found, set the failure message - * and set pass to FALSE. + * Purpose: Verify that a list of entries have the expected status. + * If any discrepencies are found, set the failure message + * and set pass to FALSE. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/8/04 * *------------------------------------------------------------------------- @@ -2693,9 +2693,9 @@ verify_clean(void) void verify_entry_status(H5C_t * cache_ptr, - int tag, - int num_entries, - struct expected_entry_status expected[]) + int tag, + int num_entries, + struct expected_entry_status expected[]) { static char msg[256]; int i; @@ -2708,222 +2708,222 @@ verify_entry_status(H5C_t * cache_ptr, hbool_t in_cache = FALSE; /* will set to TRUE if necessary */ unsigned u; /* Local index variable */ - if ( ( ! expected[i].in_cache ) && + if ( ( ! expected[i].in_cache ) && ( ( expected[i].is_protected ) || ( expected[i].is_pinned ) ) ) { - pass = FALSE; - sprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i); - failure_mssg = msg; - } + pass = FALSE; + HDsprintf(msg, "%d: Contradictory data in expected[%d].\n", tag, i); + failure_mssg = msg; + } if ( ( ! expected[i].in_cache ) && ( expected[i].is_dirty ) && ( ! entry_ptr->expunged ) ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d: expected[%d] specs non-expunged, dirty, non-resident.\n", tag, i); - failure_mssg = msg; + failure_mssg = msg; } if ( pass ) { - in_cache = entry_in_cache(cache_ptr, expected[i].entry_type, - expected[i].entry_index); + in_cache = entry_in_cache(cache_ptr, expected[i].entry_type, + expected[i].entry_index); - if ( in_cache != expected[i].in_cache ) { + if ( in_cache != expected[i].in_cache ) { - pass = FALSE; - sprintf(msg, - "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)in_cache, - (int)expected[i].in_cache); - failure_mssg = msg; - } - } + pass = FALSE; + HDsprintf(msg, + "%d entry (%d, %d) in cache actual/expected = %d/%d.\n", + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)in_cache, + (int)expected[i].in_cache); + failure_mssg = msg; + } + } if ( pass ) { - if ( entry_ptr->size != expected[i].size ) { + if ( entry_ptr->size != expected[i].size ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) size actual/expected = %ld/%ld.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (long)(entry_ptr->size), - (long)expected[i].size); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (long)(entry_ptr->size), + (long)expected[i].size); + failure_mssg = msg; + } + } if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.size != expected[i].size ) { + if ( entry_ptr->header.size != expected[i].size ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) header size actual/expected = %ld/%ld.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (long)(entry_ptr->header.size), - (long)expected[i].size); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (long)(entry_ptr->header.size), + (long)expected[i].size); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { - if ( entry_ptr->at_main_addr != expected[i].at_main_addr ) { + if ( entry_ptr->at_main_addr != expected[i].at_main_addr ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) at main addr actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->at_main_addr), - (int)expected[i].at_main_addr); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->at_main_addr), + (int)expected[i].at_main_addr); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { - if ( entry_ptr->is_dirty != expected[i].is_dirty ) { + if ( entry_ptr->is_dirty != expected[i].is_dirty ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) is_dirty actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->is_dirty), - (int)expected[i].is_dirty); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->is_dirty), + (int)expected[i].is_dirty); + failure_mssg = msg; + } + } - if ( ( pass ) && ( in_cache ) ) { + if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.is_dirty != expected[i].is_dirty ) { + if ( entry_ptr->header.is_dirty != expected[i].is_dirty ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) header is_dirty actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->header.is_dirty), - (int)expected[i].is_dirty); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->header.is_dirty), + (int)expected[i].is_dirty); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { - if ( entry_ptr->is_protected != expected[i].is_protected ) { + if ( entry_ptr->is_protected != expected[i].is_protected ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) is_protected actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->is_protected), - (int)expected[i].is_protected); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->is_protected), + (int)expected[i].is_protected); + failure_mssg = msg; + } + } - if ( ( pass ) && ( in_cache ) ) { + if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.is_protected != expected[i].is_protected ) { + if ( entry_ptr->header.is_protected != expected[i].is_protected ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) header is_protected actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->header.is_protected), - (int)expected[i].is_protected); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->header.is_protected), + (int)expected[i].is_protected); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { - if ( entry_ptr->is_pinned != expected[i].is_pinned ) { + if ( entry_ptr->is_pinned != expected[i].is_pinned ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) is_pinned actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->is_pinned), - (int)expected[i].is_pinned); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->is_pinned), + (int)expected[i].is_pinned); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { - if ( entry_ptr->is_corked != expected[i].is_corked) { + if ( entry_ptr->is_corked != expected[i].is_corked) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) is_corked actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->is_corked), - (int)expected[i].is_corked); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->is_corked), + (int)expected[i].is_corked); + failure_mssg = msg; + } + } - if ( ( pass ) && ( in_cache ) ) { + if ( ( pass ) && ( in_cache ) ) { - if ( entry_ptr->header.is_pinned != expected[i].is_pinned ) { + if ( entry_ptr->header.is_pinned != expected[i].is_pinned ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d, %d) header is_pinned actual/expected = %d/%d.\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->header.is_pinned), - (int)expected[i].is_pinned); - failure_mssg = msg; - } - } + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->header.is_pinned), + (int)expected[i].is_pinned); + failure_mssg = msg; + } + } - if ( pass ) { + if ( pass ) { if ( ( entry_ptr->deserialized != expected[i].deserialized ) || - ( entry_ptr->serialized != expected[i].serialized ) || - ( entry_ptr->destroyed != expected[i].destroyed ) ) { + ( entry_ptr->serialized != expected[i].serialized ) || + ( entry_ptr->destroyed != expected[i].destroyed ) ) { - pass = FALSE; - sprintf(msg, + pass = FALSE; + HDsprintf(msg, "%d entry (%d,%d) deserialized = %d(%d), serialized = %d(%d), dest = %d(%d)\n", - tag, - (int)expected[i].entry_type, - (int)expected[i].entry_index, - (int)(entry_ptr->deserialized), - (int)(expected[i].deserialized), - (int)(entry_ptr->serialized), - (int)(expected[i].serialized), - (int)(entry_ptr->destroyed), - (int)(expected[i].destroyed)); + tag, + (int)expected[i].entry_type, + (int)expected[i].entry_index, + (int)(entry_ptr->deserialized), + (int)(expected[i].deserialized), + (int)(entry_ptr->serialized), + (int)(expected[i].serialized), + (int)(entry_ptr->destroyed), + (int)(expected[i].destroyed)); failure_mssg = msg; } } @@ -2934,7 +2934,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( pass ) { if ( entry_ptr->flush_dep_npar != expected[i].flush_dep_npar ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_dep_npar actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -2947,7 +2947,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( ( pass ) && ( in_cache ) ) { if ( entry_ptr->header.flush_dep_nparents != expected[i].flush_dep_npar ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nparents actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -2964,7 +2964,7 @@ verify_entry_status(H5C_t * cache_ptr, for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) { if ( entry_ptr->flush_dep_par_type[u] != expected[i].flush_dep_par_type[u] ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_type[%u] actual/expected = %d/%d.\n", tag, expected[i].entry_type, @@ -2980,7 +2980,7 @@ verify_entry_status(H5C_t * cache_ptr, for ( u = 0; u < entry_ptr->flush_dep_npar; u++ ) { if ( entry_ptr->flush_dep_par_idx[u] != expected[i].flush_dep_par_idx[u] ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_dep_par_idx[%u] actual/expected = %d/%d.\n", tag, expected[i].entry_type, @@ -2997,7 +2997,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( pass ) { if ( entry_ptr->flush_dep_nchd != expected[i].flush_dep_nchd ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_dep_nchd actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -3010,7 +3010,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( ( pass ) && ( in_cache ) ) { if ( entry_ptr->header.flush_dep_nchildren != expected[i].flush_dep_nchd ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header flush_dep_nchildren actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -3023,7 +3023,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( pass ) { if ( entry_ptr->flush_dep_ndirty_chd != expected[i].flush_dep_ndirty_chd ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_dep_ndirty_chd actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -3036,7 +3036,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( ( pass ) && ( in_cache ) ) { if ( entry_ptr->header.flush_dep_ndirty_children != expected[i].flush_dep_ndirty_chd ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) header flush_dep_ndirty_children actual/expected = %u/%u.\n", tag, expected[i].entry_type, @@ -3051,7 +3051,7 @@ verify_entry_status(H5C_t * cache_ptr, if ( pass ) { if ( expected[i].flush_order >= 0 && entry_ptr->flush_order != (unsigned)expected[i].flush_order ) { pass = FALSE; - sprintf(msg, + HDsprintf(msg, "%d entry (%d, %d) flush_order actual/expected = %u/%d.\n", tag, expected[i].entry_type, @@ -3069,18 +3069,18 @@ verify_entry_status(H5C_t * cache_ptr, } /* verify_entry_status() */ - + /*------------------------------------------------------------------------- - * Function: verify_unprotected + * Function: verify_unprotected * - * Purpose: Verify that no cache entries are marked as protected. If - * any are, set pass to FALSE. + * Purpose: Verify that no cache entries are marked as protected. If + * any are, set pass to FALSE. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/10/04 * *------------------------------------------------------------------------- @@ -3129,30 +3129,30 @@ verify_unprotected(void) } /* verify_unprotected() */ - + /***************************************************************************** * * Function: setup_cache() * * Purpose: Open an HDF file. This will allocate an instance and - * initialize an associated instance of H5C_t. However, - * we want to test an instance of H5C_t, so allocate and - * initialize one with the file ID returned by the call to - * H5Fcreate(). Return a pointer to this instance of H5C_t. + * initialize an associated instance of H5C_t. However, + * we want to test an instance of H5C_t, so allocate and + * initialize one with the file ID returned by the call to + * H5Fcreate(). Return a pointer to this instance of H5C_t. * - * Observe that we open a HDF file because the cache now - * writes directly to file, and we need the file I/O facilities - * associated with the file. + * Observe that we open a HDF file because the cache now + * writes directly to file, and we need the file I/O facilities + * associated with the file. * - * To avoid tripping on error check code, must allocate enough - * space in the file to hold all the test entries and their - * alternates. This is a little sticky, as the addresses of - * all the test entries are determined at compile time. + * To avoid tripping on error check code, must allocate enough + * space in the file to hold all the test entries and their + * alternates. This is a little sticky, as the addresses of + * all the test entries are determined at compile time. * - * Deal with this by choosing BASE_ADDR large enough that - * the base address of the allocate space will be less than - * or equal to BASE_ADDR, and then requesting an extra BASE_ADDR - * bytes, so we don't have to wory about exceeding the allocation. + * Deal with this by choosing BASE_ADDR large enough that + * the base address of the allocate space will be less than + * or equal to BASE_ADDR, and then requesting an extra BASE_ADDR + * bytes, so we don't have to wory about exceeding the allocation. * * Return: Success: Ptr to H5C_t * @@ -3198,7 +3198,7 @@ setup_cache(size_t max_cache_size, pass = FALSE; failure_mssg = "H5Pset_file_space_strategy() failed.\n"; H5Pclose(fcpl_id); - fcpl_id = H5P_DEFAULT; + fcpl_id = H5P_DEFAULT; } } @@ -3208,11 +3208,11 @@ setup_cache(size_t max_cache_size, pass = FALSE; failure_mssg = "H5Pset_file_space_page_size() failed.\n"; H5Pclose(fcpl_id); - fcpl_id = H5P_DEFAULT; + fcpl_id = H5P_DEFAULT; } } - if(pass) + if(pass) saved_fcpl_id = fcpl_id; /* setup the file name */ @@ -3228,24 +3228,24 @@ setup_cache(size_t max_cache_size, FUNC, mile_stone++, (int)pass); if(pass && try_core_file_driver) { - if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) { - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; + if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) { + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n"; } - else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) { - H5Pclose(fapl_id); - fapl_id = H5P_DEFAULT; - pass = FALSE; - failure_mssg = "H5P_set_fapl_core() failed.\n"; + else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) { + H5Pclose(fapl_id); + fapl_id = H5P_DEFAULT; + pass = FALSE; + failure_mssg = "H5P_set_fapl_core() failed.\n"; } - else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) { - core_file_driver_failed = TRUE; + else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) { + core_file_driver_failed = TRUE; if(verbose) HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC); } else { - saved_fapl_id = fapl_id; - } + saved_fapl_id = fapl_id; + } } if(show_progress) /* 3 */ @@ -3376,21 +3376,21 @@ setup_cache(size_t max_cache_size, if(pass) { /* allocate space for test entries */ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); - if(actual_base_addr == HADDR_UNDEF) { + if(actual_base_addr == HADDR_UNDEF) { pass = FALSE; - failure_mssg = "H5MF_alloc() failed."; + failure_mssg = "H5MF_alloc() failed."; - if(verbose) + if(verbose) HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC); - } else if(actual_base_addr > BASE_ADDR) { - /* If this happens, must increase BASE_ADDR so that the - * actual_base_addr is <= BASE_ADDR. This should only happen - * if the size of the superblock is increase. - */ + } else if(actual_base_addr > BASE_ADDR) { + /* If this happens, must increase BASE_ADDR so that the + * actual_base_addr is <= BASE_ADDR. This should only happen + * if the size of the superblock is increase. + */ pass = FALSE; - failure_mssg = "actual_base_addr > BASE_ADDR"; + failure_mssg = "actual_base_addr > BASE_ADDR"; - if(verbose) + if(verbose) HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC); } @@ -3416,19 +3416,19 @@ setup_cache(size_t max_cache_size, return(ret_val); } /* setup_cache() */ - + /*------------------------------------------------------------------------- - * Function: takedown_cache() + * Function: takedown_cache() * - * Purpose: Flush the specified cache and destroy it. If requested, - * dump stats first. Then close and delete the associate - * file. + * Purpose: Flush the specified cache and destroy it. If requested, + * dump stats first. Then close and delete the associate + * file. * - * If pass is FALSE, do nothing. + * If pass is FALSE, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/14/07 * *------------------------------------------------------------------------- @@ -3528,22 +3528,22 @@ takedown_cache(H5F_t * file_ptr, } /* takedown_cache() */ - + /*------------------------------------------------------------------------- - * Function: expunge_entry() + * Function: expunge_entry() * - * Purpose: Expunge the entry indicated by the type and index. + * Purpose: Expunge the entry indicated by the type and index. * * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/6/06 * - * Changes: Added code to set entry_ptr->expunged to TRUE if - * H5C_expunge_entry() returns without error. + * Changes: Added code to set entry_ptr->expunged to TRUE if + * H5C_expunge_entry() returns without error. * - * JRM -- 8/21/14 + * JRM -- 8/21/14 * *------------------------------------------------------------------------- */ @@ -3573,11 +3573,11 @@ expunge_entry(H5F_t * file_ptr, HDassert( entry_ptr->index == idx ); HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); - HDassert( entry_ptr->cache_ptr == cache_ptr ); + HDassert( entry_ptr->cache_ptr == cache_ptr ); HDassert( ! ( entry_ptr->header.is_protected ) ); HDassert( ! ( entry_ptr->is_protected ) ); HDassert( ! ( entry_ptr->header.is_pinned ) ); - HDassert( ! ( entry_ptr->is_pinned ) ); + HDassert( ! ( entry_ptr->is_pinned ) ); result = H5C_expunge_entry(file_ptr, types[type], entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -3588,7 +3588,7 @@ expunge_entry(H5F_t * file_ptr, } else { - entry_ptr->expunged = TRUE; + entry_ptr->expunged = TRUE; } } @@ -3596,16 +3596,16 @@ expunge_entry(H5F_t * file_ptr, } /* expunge_entry() */ - + /*------------------------------------------------------------------------- - * Function: flush_cache() + * Function: flush_cache() * - * Purpose: Flush the specified cache, destroying all entries if + * Purpose: Flush the specified cache, destroying all entries if requested. If requested, dump stats first. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/23/04 * *------------------------------------------------------------------------- @@ -3665,18 +3665,18 @@ flush_cache(H5F_t * file_ptr, } /* flush_cache() */ - + /*------------------------------------------------------------------------- - * Function: cork_entry_type() + * Function: cork_entry_type() * - * Purpose: To "cork" an object: - * --insert the base address of an entry type into - * the cache's list of corked object addresses + * Purpose: To "cork" an object: + * --insert the base address of an entry type into + * the cache's list of corked object addresses * - * Return: void + * Return: void * - * Programmer: Vailin Choi - * Jan 2014 + * Programmer: Vailin Choi + * Jan 2014 * *------------------------------------------------------------------------- */ @@ -3701,18 +3701,18 @@ cork_entry_type(H5F_t *file_ptr, int32_t type) } /* cork_entry_type() */ - + /*------------------------------------------------------------------------- - * Function: uncork_entry_type() + * Function: uncork_entry_type() * - * Purpose: To "uncork" an object: - * --insert the base address of an entry type into - * the cache's list of corked object addresses + * Purpose: To "uncork" an object: + * --insert the base address of an entry type into + * the cache's list of corked object addresses * - * Return: void + * Return: void * - * Programmer: Vailin Choi - * Jan 2014 + * Programmer: Vailin Choi + * Jan 2014 * *------------------------------------------------------------------------- */ @@ -3737,17 +3737,17 @@ uncork_entry_type(H5F_t *file_ptr, int32_t type) } /* uncork_entry_type() */ - + /*------------------------------------------------------------------------- - * Function: insert_entry() + * Function: insert_entry() * - * Purpose: Insert the entry indicated by the type and index. + * Purpose: Insert the entry indicated by the type and index. * - * Do nothing if pass is false. + * Do nothing if pass is false. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/16/04 * *------------------------------------------------------------------------- @@ -3810,7 +3810,7 @@ insert_entry(H5F_t * file_ptr, HDfprintf(stdout, "entry_ptr->header.is_protected = %d\n", (int)(entry_ptr->header.is_protected)); HDfprintf(stdout, - "entry_ptr->header.type != types[type] = %d\n", + "entry_ptr->header.type != types[type] = %d\n", (int)(entry_ptr->header.type != types[type])); HDfprintf(stdout, "entry_ptr->size != entry_ptr->header.size = %d\n", @@ -3843,17 +3843,17 @@ insert_entry(H5F_t * file_ptr, } /* insert_entry() */ - + /*------------------------------------------------------------------------- - * Function: mark_entry_dirty() + * Function: mark_entry_dirty() * - * Purpose: Mark the specified entry as dirty. + * Purpose: Mark the specified entry as dirty. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * *------------------------------------------------------------------------- @@ -3880,10 +3880,10 @@ mark_entry_dirty(int32_t type, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->header.is_protected || - entry_ptr->header.is_pinned ); + entry_ptr->header.is_pinned ); was_dirty = entry_ptr->is_dirty; - entry_ptr->is_dirty = TRUE; + entry_ptr->is_dirty = TRUE; if(entry_ptr->flush_dep_npar > 0 && !was_dirty) mark_flush_dep_dirty(entry_ptr); @@ -3911,17 +3911,17 @@ mark_entry_dirty(int32_t type, } /* mark_entry_dirty() */ - + /*------------------------------------------------------------------------- - * Function: move_entry() + * Function: move_entry() * - * Purpose: Move the entry indicated by the type and index to its - * main or alternate address as indicated. If the entry is - * already at the desired entry, do nothing. + * Purpose: Move the entry indicated by the type and index to its + * main or alternate address as indicated. If the entry is + * already at the desired entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/21/04 * *------------------------------------------------------------------------- @@ -3934,7 +3934,7 @@ move_entry(H5C_t * cache_ptr, hbool_t main_addr) { herr_t result; - hbool_t done = TRUE; /* will set to FALSE if we have work to do */ + hbool_t done = TRUE; /* will set to FALSE if we have work to do */ haddr_t old_addr = HADDR_UNDEF; haddr_t new_addr = HADDR_UNDEF; test_entry_t * base_addr; @@ -3994,8 +3994,8 @@ move_entry(H5C_t * cache_ptr, if ( ! done ) { if ( ( result < 0 ) || - ( ( ! ( entry_ptr->header.destroy_in_progress ) ) && - ( entry_ptr->header.addr != new_addr ) ) ) { + ( ( ! ( entry_ptr->header.destroy_in_progress ) ) && + ( entry_ptr->header.addr != new_addr ) ) ) { pass = FALSE; failure_mssg = "error in H5C_move_entry()."; @@ -4017,17 +4017,17 @@ move_entry(H5C_t * cache_ptr, } /* move_entry() */ - + /*------------------------------------------------------------------------- - * Function: protect_entry() + * Function: protect_entry() * - * Purpose: Protect the entry indicated by the type and index. + * Purpose: Protect the entry indicated by the type and index. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/11/04 * *------------------------------------------------------------------------- @@ -4061,8 +4061,8 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) /* Use to cork entries for the object */ H5AC_tag(baddrs, NULL); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, - types[type], entry_ptr->addr, &entry_ptr->addr, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, + types[type], entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || @@ -4092,7 +4092,7 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) HDfprintf(stdout, "entry_ptr->addr = %d, entry_ptr->header.addr = %d\n", (int)(entry_ptr->addr), (int)(entry_ptr->header.addr)); - HDfprintf(stdout, + HDfprintf(stdout, "entry_ptr->verify_ct = %d, entry_ptr->max_verify_ct = %d\n", entry_ptr->verify_ct, entry_ptr->max_verify_ct); H5Eprint2(H5E_DEFAULT, stdout); @@ -4103,35 +4103,35 @@ protect_entry(H5F_t * file_ptr, int32_t type, int32_t idx) } /* end if */ else { - HDassert( ( entry_ptr->cache_ptr == NULL ) || - ( entry_ptr->cache_ptr == cache_ptr ) ); + HDassert( ( entry_ptr->cache_ptr == NULL ) || + ( entry_ptr->cache_ptr == cache_ptr ) ); - entry_ptr->cache_ptr = cache_ptr; - entry_ptr->file_ptr = file_ptr; + entry_ptr->cache_ptr = cache_ptr; + entry_ptr->file_ptr = file_ptr; entry_ptr->is_protected = TRUE; } /* end else */ if(entry_ptr->header.tag_info && entry_ptr->header.tag_info->corked) - entry_ptr->is_corked = TRUE; + entry_ptr->is_corked = TRUE; HDassert(((entry_ptr->header).type)->id == type); } /* end if */ } /* protect_entry() */ - + /*------------------------------------------------------------------------- - * Function: protect_entry_ro() + * Function: protect_entry_ro() * - * Purpose: Do a read only protect the entry indicated by the type - * and index. + * Purpose: Do a read only protect the entry indicated by the type + * and index. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/1/07 * *------------------------------------------------------------------------- @@ -4162,8 +4162,8 @@ protect_entry_ro(H5F_t * file_ptr, HDassert( entry_ptr->type == type ); HDassert( entry_ptr == entry_ptr->self ); HDassert( ( ! ( entry_ptr->is_protected ) ) || - ( ( entry_ptr->is_read_only ) && - ( entry_ptr->ro_ref_count > 0 ) ) ); + ( ( entry_ptr->is_read_only ) && + ( entry_ptr->ro_ref_count > 0 ) ) ); cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, types[type], entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); @@ -4181,14 +4181,14 @@ protect_entry_ro(H5F_t * file_ptr, } else { - HDassert( ( entry_ptr->cache_ptr == NULL ) || - ( entry_ptr->cache_ptr == cache_ptr ) ); + HDassert( ( entry_ptr->cache_ptr == NULL ) || + ( entry_ptr->cache_ptr == cache_ptr ) ); - entry_ptr->cache_ptr = cache_ptr; - entry_ptr->file_ptr = file_ptr; + entry_ptr->cache_ptr = cache_ptr; + entry_ptr->file_ptr = file_ptr; entry_ptr->is_protected = TRUE; - entry_ptr->is_read_only = TRUE; - entry_ptr->ro_ref_count++; + entry_ptr->is_read_only = TRUE; + entry_ptr->ro_ref_count++; } HDassert( ((entry_ptr->header).type)->id == type ); @@ -4198,17 +4198,17 @@ protect_entry_ro(H5F_t * file_ptr, } /* protect_entry_ro() */ - + /*------------------------------------------------------------------------- - * Function: pin_entry() + * Function: pin_entry() * - * Purpose: Pin the entry indicated by the type and index. + * Purpose: Pin the entry indicated by the type and index. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/17/09 * *------------------------------------------------------------------------- @@ -4235,41 +4235,41 @@ pin_entry(int32_t type, HDassert( entry_ptr->is_protected ); HDassert( !(entry_ptr->pinned_from_client) ); - result = H5C_pin_protected_entry((void *)entry_ptr); + result = H5C_pin_protected_entry((void *)entry_ptr); - if ( result < 0 ) { + if ( result < 0 ) { pass = FALSE; failure_mssg = "H5C_pin_protected_entry() reports failure."; - } else if ( ! ( entry_ptr->header.is_pinned ) ) { + } else if ( ! ( entry_ptr->header.is_pinned ) ) { pass = FALSE; failure_mssg = "entry not pinned when it should be."; - } else { + } else { entry_ptr->pinned_from_client = TRUE; - entry_ptr->is_pinned = TRUE; + entry_ptr->is_pinned = TRUE; - } + } } /* end if */ return; } /* pin_entry() */ - + /*------------------------------------------------------------------------- - * Function: unpin_entry() + * Function: unpin_entry() * - * Purpose: Unpin the entry indicated by the type and index. + * Purpose: Unpin the entry indicated by the type and index. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * *------------------------------------------------------------------------- @@ -4295,8 +4295,8 @@ unpin_entry(int32_t type, HDassert( entry_ptr == entry_ptr->self ); HDassert( entry_ptr->header.is_pinned ); HDassert( entry_ptr->header.pinned_from_client ); - HDassert( entry_ptr->is_pinned ); - HDassert( entry_ptr->pinned_from_client ); + HDassert( entry_ptr->is_pinned ); + HDassert( entry_ptr->pinned_from_client ); result = H5C_unpin_entry(entry_ptr); @@ -4314,7 +4314,7 @@ unpin_entry(int32_t type, entry_ptr->pinned_from_client = FALSE; - entry_ptr->is_pinned = entry_ptr->pinned_from_cache; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; HDassert( ((entry_ptr->header).type)->id == type ); @@ -4324,17 +4324,17 @@ unpin_entry(int32_t type, } /* unpin_entry() */ - + /*------------------------------------------------------------------------- - * Function: unprotect_entry() + * Function: unprotect_entry() * - * Purpose: Unprotect the entry indicated by the type and index. + * Purpose: Unprotect the entry indicated by the type and index. * - * Do nothing if pass is FALSE on entry. + * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/12/04 * *------------------------------------------------------------------------- @@ -4365,12 +4365,12 @@ unprotect_entry(H5F_t * file_ptr, HDassert( entry_ptr->header.is_protected ); HDassert( entry_ptr->is_protected ); - pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0); - unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0); + pin_flag_set = (hbool_t)((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_flag_set = (hbool_t)((flags & H5C__UNPIN_ENTRY_FLAG) != 0); - HDassert ( ! ( pin_flag_set && unpin_flag_set ) ); - HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); - HDassert ( ( ! unpin_flag_set ) || ( entry_ptr->is_pinned ) ); + HDassert ( ! ( pin_flag_set && unpin_flag_set ) ); + HDassert ( ( ! pin_flag_set ) || ( ! (entry_ptr->is_pinned) ) ); + HDassert ( ( ! unpin_flag_set ) || ( entry_ptr->is_pinned ) ); if(flags & H5C__DIRTIED_FLAG) { hbool_t was_dirty = entry_ptr->is_dirty; @@ -4385,8 +4385,8 @@ unprotect_entry(H5F_t * file_ptr, if ( ( result < 0 ) || ( ( entry_ptr->header.is_protected ) && - ( ( ! ( entry_ptr->is_read_only ) ) || - ( entry_ptr->ro_ref_count <= 0 ) ) ) || + ( ( ! ( entry_ptr->is_read_only ) ) || + ( entry_ptr->ro_ref_count <= 0 ) ) ) || ( entry_ptr->header.type != types[type] ) || ( entry_ptr->size != entry_ptr->header.size ) || ( entry_ptr->addr != entry_ptr->header.addr ) ) { @@ -4397,33 +4397,33 @@ unprotect_entry(H5F_t * file_ptr, } else { - if ( entry_ptr->ro_ref_count > 1 ) { + if ( entry_ptr->ro_ref_count > 1 ) { - entry_ptr->ro_ref_count--; + entry_ptr->ro_ref_count--; - } else if ( entry_ptr->ro_ref_count == 1 ) { + } else if ( entry_ptr->ro_ref_count == 1 ) { - entry_ptr->is_protected = FALSE; - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; + entry_ptr->is_protected = FALSE; + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; - } else { + } else { - entry_ptr->is_protected = FALSE; + entry_ptr->is_protected = FALSE; - } + } - if ( pin_flag_set ) { + if ( pin_flag_set ) { - HDassert(entry_ptr->header.is_pinned); - entry_ptr->pinned_from_client = TRUE; - entry_ptr->is_pinned = TRUE; + HDassert(entry_ptr->header.is_pinned); + entry_ptr->pinned_from_client = TRUE; + entry_ptr->is_pinned = TRUE; - } else if ( unpin_flag_set ) { + } else if ( unpin_flag_set ) { - HDassert(entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache); - entry_ptr->pinned_from_client = FALSE; - entry_ptr->is_pinned = entry_ptr->pinned_from_cache; + HDassert(entry_ptr->header.is_pinned == entry_ptr->header.pinned_from_cache); + entry_ptr->pinned_from_client = FALSE; + entry_ptr->is_pinned = entry_ptr->pinned_from_cache; } } @@ -4437,26 +4437,26 @@ unprotect_entry(H5F_t * file_ptr, HDassert( entry_ptr->is_dirty ); } - HDassert( entry_ptr->header.is_protected == entry_ptr->is_protected ); - HDassert( entry_ptr->header.is_read_only == entry_ptr->is_read_only ); - HDassert( entry_ptr->header.ro_ref_count == entry_ptr->ro_ref_count ); + HDassert( entry_ptr->header.is_protected == entry_ptr->is_protected ); + HDassert( entry_ptr->header.is_read_only == entry_ptr->is_read_only ); + HDassert( entry_ptr->header.ro_ref_count == entry_ptr->ro_ref_count ); } return; } /* unprotect_entry() */ - + /*------------------------------------------------------------------------- - * Function: row_major_scan_forward() + * Function: row_major_scan_forward() * - * Purpose: Do a sequence of inserts, protects, unprotects, moves, - * destroys while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: Do a sequence of inserts, protects, unprotects, moves, + * destroys while scanning through the set of entries. If + * pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/12/04 * *------------------------------------------------------------------------- @@ -4473,7 +4473,7 @@ row_major_scan_forward(H5F_t * file_ptr, hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys, - hbool_t do_mult_ro_protects, + hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects) { @@ -4501,7 +4501,7 @@ row_major_scan_forward(H5F_t * file_ptr, while(pass && idx <= (local_max_index + lag)) { int32_t tmp_idx; - if(verbose) + if(verbose) HDfprintf(stdout, "%d:%d: ", type, idx); tmp_idx = idx + lag; @@ -4512,7 +4512,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx); insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx--; @@ -4523,7 +4523,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx--; @@ -4534,7 +4534,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ /* (don't decrement tmp_idx) */ @@ -4545,7 +4545,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr); move_entry(cache_ptr, type, tmp_idx, move_to_main_addr); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx--; @@ -4556,7 +4556,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx -= 2; @@ -4567,83 +4567,83 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ - if(do_mult_ro_protects) { + if(do_mult_ro_protects) { /* (don't decrement tmp_idx) */ - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9) == 0) { if(verbose) HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ + protect_entry_ro(file_ptr, type, tmp_idx); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ tmp_idx--; - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11) == 0) { if(verbose) HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ + protect_entry_ro(file_ptr, type, tmp_idx); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ tmp_idx--; - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13) == 0) { if(verbose) HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ + protect_entry_ro(file_ptr, type, tmp_idx); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ /* (don't decrement tmp_idx) */ - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 9) == 0) { if(verbose) HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ tmp_idx--; - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 11) == 0) { if(verbose) HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ tmp_idx--; - if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && + if(pass && (tmp_idx >= 0) && (tmp_idx < local_max_index) && (tmp_idx % 13) == 0) { if(verbose) HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); - } /* end if */ - } /* if ( do_mult_ro_protects ) */ + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + } /* end if */ + } /* if ( do_mult_ro_protects ) */ if(pass && (idx >= 0) && (idx <= local_max_index)) { if(verbose) HDfprintf(stdout, "13(p, %d, %d) ", type, idx); protect_entry(file_ptr, type, idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx = idx - lag + 2; @@ -4654,7 +4654,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ tmp_idx--; @@ -4665,7 +4665,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx); protect_entry(file_ptr, type, tmp_idx); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ if(do_destroys) { @@ -4677,7 +4677,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); break; case 1: @@ -4686,14 +4686,14 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ else { if(verbose) HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end else */ break; @@ -4702,7 +4702,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); break; case 3: @@ -4711,14 +4711,14 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ else { if(verbose) HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end else */ break; @@ -4735,7 +4735,7 @@ row_major_scan_forward(H5F_t * file_ptr, HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx); unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET)); - HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); + HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size); } /* end if */ } /* end elsef */ @@ -4753,17 +4753,17 @@ row_major_scan_forward(H5F_t * file_ptr, } /* row_major_scan_forward() */ - + /*------------------------------------------------------------------------- - * Function: hl_row_major_scan_forward() + * Function: hl_row_major_scan_forward() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. - * If pass is false on entry, do nothing. + * Purpose: Do a high locality sequence of inserts, protects, and + * unprotects while scanning through the set of entries. + * If pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/21/04 * *------------------------------------------------------------------------- @@ -4858,17 +4858,17 @@ hl_row_major_scan_forward(H5F_t * file_ptr, } /* hl_row_major_scan_forward() */ - + /*------------------------------------------------------------------------- - * Function: row_major_scan_backward() + * Function: row_major_scan_backward() * - * Purpose: Do a sequence of inserts, protects, unprotects, moves, - * destroys while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. + * Purpose: Do a sequence of inserts, protects, unprotects, moves, + * destroys while scanning backwards through the set of + * entries. If pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/12/04 * *------------------------------------------------------------------------- @@ -4886,7 +4886,7 @@ row_major_scan_backward(H5F_t * file_ptr, hbool_t do_moves, hbool_t move_to_main_addr, hbool_t do_destroys, - hbool_t do_mult_ro_protects, + hbool_t do_mult_ro_protects, int dirty_destroys, int dirty_unprotects) { @@ -4962,7 +4962,7 @@ row_major_scan_backward(H5F_t * file_ptr, if ( verbose ) HDfprintf(stdout, "(r, %d, %d, %d) ", - type, tmp_idx, (int)move_to_main_addr); + type, tmp_idx, (int)move_to_main_addr); move_entry(cache_ptr, type, tmp_idx, move_to_main_addr); } @@ -4990,73 +4990,73 @@ row_major_scan_backward(H5F_t * file_ptr, } /* (don't increment tmp_idx) */ - if ( do_mult_ro_protects ) - { - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 9 == 0 ) ) { + if ( do_mult_ro_protects ) + { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 9 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - } + protect_entry_ro(file_ptr, type, tmp_idx); + } tmp_idx++; - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 11 == 0 ) ) { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 11 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - } + protect_entry_ro(file_ptr, type, tmp_idx); + } tmp_idx++; - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 13 == 0 ) ) { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 13 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(p-ro, %d, %d) ", type, tmp_idx); - protect_entry_ro(file_ptr, type, tmp_idx); - } + protect_entry_ro(file_ptr, type, tmp_idx); + } /* (don't increment tmp_idx) */ - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 9 == 0 ) ) { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 9 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - } + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + } tmp_idx++; - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 11 == 0 ) ) { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 11 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - } + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + } tmp_idx++; - if ( ( pass ) && ( tmp_idx >= 0 ) && - ( tmp_idx < local_max_index ) && - ( tmp_idx % 13 == 0 ) ) { + if ( ( pass ) && ( tmp_idx >= 0 ) && + ( tmp_idx < local_max_index ) && + ( tmp_idx % 13 == 0 ) ) { if ( verbose ) HDfprintf(stdout, "(u-ro, %d, %d) ", type, tmp_idx); - unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); - } - } /* if ( do_mult_ro_protects ) */ + unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET); + } + } /* if ( do_mult_ro_protects ) */ if ( ( pass ) && ( idx >= 0 ) && ( idx <= local_max_index ) ) { @@ -5162,17 +5162,17 @@ row_major_scan_backward(H5F_t * file_ptr, } /* row_major_scan_backward() */ - + /*------------------------------------------------------------------------- - * Function: hl_row_major_scan_backward() + * Function: hl_row_major_scan_backward() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. - * If pass is false on entry, do nothing. + * Purpose: Do a high locality sequence of inserts, protects, and + * unprotects while scanning through the set of entries. + * If pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/21/04 * *------------------------------------------------------------------------- @@ -5267,17 +5267,17 @@ hl_row_major_scan_backward(H5F_t * file_ptr, } /* hl_row_major_scan_backward() */ - + /*------------------------------------------------------------------------- - * Function: col_major_scan_forward() + * Function: col_major_scan_forward() * - * Purpose: Do a sequence of inserts, protects, and unprotects - * while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: Do a sequence of inserts, protects, and unprotects + * while scanning through the set of entries. If + * pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/23/04 * *------------------------------------------------------------------------- @@ -5285,7 +5285,7 @@ hl_row_major_scan_backward(H5F_t * file_ptr, void col_major_scan_forward(H5F_t * file_ptr, - int32_t max_index, + int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -5375,17 +5375,17 @@ col_major_scan_forward(H5F_t * file_ptr, } /* col_major_scan_forward() */ - + /*------------------------------------------------------------------------- - * Function: hl_col_major_scan_forward() + * Function: hl_col_major_scan_forward() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning through the set of entries. If - * pass is false on entry, do nothing. + * Purpose: Do a high locality sequence of inserts, protects, and + * unprotects while scanning through the set of entries. If + * pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 19/25/04 * *------------------------------------------------------------------------- @@ -5491,17 +5491,17 @@ hl_col_major_scan_forward(H5F_t * file_ptr, } /* hl_col_major_scan_forward() */ - + /*------------------------------------------------------------------------- - * Function: col_major_scan_backward() + * Function: col_major_scan_backward() * - * Purpose: Do a sequence of inserts, protects, and unprotects - * while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. + * Purpose: Do a sequence of inserts, protects, and unprotects + * while scanning backwards through the set of + * entries. If pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/23/04 * *------------------------------------------------------------------------- @@ -5509,7 +5509,7 @@ hl_col_major_scan_forward(H5F_t * file_ptr, void col_major_scan_backward(H5F_t * file_ptr, - int32_t max_index, + int32_t max_index, int32_t lag, hbool_t verbose, hbool_t reset_stats, @@ -5569,8 +5569,8 @@ col_major_scan_backward(H5F_t * file_ptr, } if ( ( pass ) && - ( idx >= 0 ) && - ( idx <= local_max_index[type] ) ) { + ( idx >= 0 ) && + ( idx <= local_max_index[type] ) ) { if ( verbose ) HDfprintf(stdout, "(p, %d, %d) ", type, idx); @@ -5612,17 +5612,17 @@ col_major_scan_backward(H5F_t * file_ptr, } /* col_major_scan_backward() */ - + /*------------------------------------------------------------------------- - * Function: hl_col_major_scan_backward() + * Function: hl_col_major_scan_backward() * - * Purpose: Do a high locality sequence of inserts, protects, and - * unprotects while scanning backwards through the set of - * entries. If pass is false on entry, do nothing. + * Purpose: Do a high locality sequence of inserts, protects, and + * unprotects while scanning backwards through the set of + * entries. If pass is false on entry, do nothing. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/25/04 * *------------------------------------------------------------------------- @@ -5727,17 +5727,17 @@ hl_col_major_scan_backward(H5F_t * file_ptr, } /* hl_col_major_scan_backward() */ - + /*------------------------------------------------------------------------- - * Function: create_flush_dependency() + * Function: create_flush_dependency() * - * Purpose: Create a 'flush dependency' between two entries. + * Purpose: Create a 'flush dependency' between two entries. * - * Do nothing if pass is false. + * Do nothing if pass is false. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/16/09 * *------------------------------------------------------------------------- @@ -5808,17 +5808,17 @@ create_flush_dependency(int32_t par_type, } /* end if */ } /* create_flush_dependency() */ - + /*------------------------------------------------------------------------- - * Function: destroy_flush_dependency() + * Function: destroy_flush_dependency() * - * Purpose: Destroy a 'flush dependency' between two entries. + * Purpose: Destroy a 'flush dependency' between two entries. * - * Do nothing if pass is false. + * Do nothing if pass is false. * - * Return: void + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * 3/16/09 * *------------------------------------------------------------------------- @@ -5899,7 +5899,7 @@ destroy_flush_dependency(int32_t par_type, } /* end if */ } /* destroy_flush_dependency() */ - + /*------------------------------------------------------------------------- * Function: mark_flush_dep_dirty() * @@ -5942,7 +5942,7 @@ mark_flush_dep_dirty(test_entry_t * entry_ptr) } /* end if */ } /* end mark_flush_dep_dirty() */ - + /*------------------------------------------------------------------------- * Function: mark_flush_dep_clean() * @@ -5985,31 +5985,31 @@ mark_flush_dep_clean(test_entry_t * entry_ptr) } /* end if */ } /* end mark_flush_dep_clean() */ - + /*** H5AC level utility functions ***/ - + /*------------------------------------------------------------------------- - * Function: check_and_validate_cache_hit_rate() + * Function: check_and_validate_cache_hit_rate() * - * Purpose: Use the API functions to get and reset the cache hit rate. - * Verify that the value returned by the API call agrees with - * the cache internal data structures. + * Purpose: Use the API functions to get and reset the cache hit rate. + * Verify that the value returned by the API call agrees with + * the cache internal data structures. * - * If the number of cache accesses exceeds the value provided - * in the min_accesses parameter, and the hit rate is less than - * min_hit_rate, set pass to FALSE, and set failure_mssg to - * a string indicating that hit rate was unexpectedly low. + * If the number of cache accesses exceeds the value provided + * in the min_accesses parameter, and the hit rate is less than + * min_hit_rate, set pass to FALSE, and set failure_mssg to + * a string indicating that hit rate was unexpectedly low. * - * Return hit rate in *hit_rate_ptr, and print the data to - * stdout if requested. + * Return hit rate in *hit_rate_ptr, and print the data to + * stdout if requested. * - * If an error is detected, set pass to FALSE, and set - * failure_mssg to an appropriate value. + * If an error is detected, set pass to FALSE, and set + * failure_mssg to an appropriate value. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/18/04 * *------------------------------------------------------------------------- @@ -6124,24 +6124,24 @@ check_and_validate_cache_hit_rate(hid_t file_id, } /* check_and_validate_cache_hit_rate() */ - + /*------------------------------------------------------------------------- - * Function: check_and_validate_cache_size() + * Function: check_and_validate_cache_size() * - * Purpose: Use the API function to get the cache size data. Verify - * that the values returned by the API call agree with - * the cache internal data structures. + * Purpose: Use the API function to get the cache size data. Verify + * that the values returned by the API call agree with + * the cache internal data structures. * - * Return size data in the locations specified by the pointer - * parameters if these parameters are not NULL. Print the - * data to stdout if requested. + * Return size data in the locations specified by the pointer + * parameters if these parameters are not NULL. Print the + * data to stdout if requested. * - * If an error is detected, set pass to FALSE, and set - * failure_mssg to an appropriate value. + * If an error is detected, set pass to FALSE, and set + * failure_mssg to an appropriate value. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/18/04 * *------------------------------------------------------------------------- @@ -6315,21 +6315,21 @@ resize_configs_are_equal(const H5C_auto_size_ctl_t *a, return(TRUE); } - + /*------------------------------------------------------------------------- - * Function: validate_mdc_config() + * Function: validate_mdc_config() * - * Purpose: Verify that the file indicated by the file_id parameter - * has both internal and external configuration matching - * *config_ptr. + * Purpose: Verify that the file indicated by the file_id parameter + * has both internal and external configuration matching + * *config_ptr. * - * Do nothin on success. On failure, set pass to FALSE, and - * load an error message into failue_mssg. Note that - * failure_msg is assumed to be at least 128 bytes in length. + * Do nothin on success. On failure, set pass to FALSE, and + * load an error message into failue_mssg. Note that + * failure_msg is assumed to be at least 128 bytes in length. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/14/04 * *------------------------------------------------------------------------- @@ -6383,7 +6383,7 @@ validate_mdc_config(hid_t file_id, /* compare the cache's internal configuration with the expected value */ if ( pass ) { - if ( ! resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, + if ( ! resize_configs_are_equal(&int_config, &cache_ptr->resize_ctl, compare_init) ) { pass = FALSE; @@ -6434,12 +6434,12 @@ validate_mdc_config(hid_t file_id, } /* validate_mdc_config() */ - + #if 0 /* debugging functions -- normally commented out */ /*------------------------------------------------------------------------- * Function: dump_LRU * - * Purpose: Display a summarize list of the contents of the LRU + * Purpose: Display a summarize list of the contents of the LRU * from head to tail. * * Return: void @@ -6467,7 +6467,7 @@ dump_LRU(H5F_t * file_ptr) entry_ptr = cache_ptr->LRU_head_ptr; - HDfprintf(stdout, + HDfprintf(stdout, "\n\nIndex len/size/clean size/dirty size = %u/%lld/%lld/%lld\n", cache_ptr->index_len, (long long)(cache_ptr->index_size), (long long)(cache_ptr->clean_index_size), @@ -6482,17 +6482,17 @@ dump_LRU(H5F_t * file_ptr) while ( entry_ptr != NULL ) { - HDfprintf(stdout, + HDfprintf(stdout, " %3d %d %10lld 0x%010llx %s(%d)\n", - i, - (int)(entry_ptr->is_dirty), + i, + (int)(entry_ptr->is_dirty), (long long)(entry_ptr->size), (long long)(entry_ptr->addr), entry_ptr->type->name, entry_ptr->type->id); i++; entry_ptr = entry_ptr->next; - } + } if ( cache_ptr->LRU_list_len > 0 ) { diff --git a/test/cache_image.c b/test/cache_image.c index 9150836..59689a9 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -14,8 +14,8 @@ /* Programmer: John Mainzer * 7/13/15 * - * This file contains tests specific to the cache image - * feature implemented in H5C.c + * This file contains tests specific to the cache image + * feature implemented in H5C.c */ #include "cache_common.h" #include "genall5.h" @@ -33,7 +33,7 @@ static void create_datasets(hid_t file_id, int min_dset, int max_dset); static void delete_datasets(hid_t file_id, int min_dset, int max_dset); static void open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm, - hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags, + hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags, hid_t *file_id_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr); static void attempt_swmr_open_hdf5_file(hbool_t create_file, hbool_t set_mdci_fapl, const char *hdf_file_name); @@ -62,7 +62,7 @@ static unsigned cache_image_api_error_check_4(hbool_t single_file_vfd); static unsigned get_free_sections_test(hbool_t single_file_vfd); static unsigned evict_on_close_test(hbool_t single_file_vfd); - + /****************************************************************************/ /***************************** Utility Functions ****************************/ /****************************************************************************/ @@ -71,10 +71,10 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd); * Function: create_datasets() * * Purpose: If pass is TRUE on entry, create the specified datasets - * in the indicated file. + * in the indicated file. * - * Datasets and their contents must be well known, as we - * will verify that they contain the expected data later. + * Datasets and their contents must be well known, as we + * will verify that they contain the expected data later. * * On failure, set pass to FALSE, and set failure_mssg * to point to an appropriate failure message. @@ -93,7 +93,7 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd); #define DSET_SIZE (40 * CHUNK_SIZE) #define MAX_NUM_DSETS 256 -static void +static void create_datasets(hid_t file_id, int min_dset, int max_dset) { const char * fcn_name = "create_datasets()"; @@ -169,7 +169,7 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) /* create the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); @@ -315,8 +315,8 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) /* read the chunk from file */ if ( pass ) { - status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, - memspace_id, filespace_ids[m], + status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, + memspace_id, filespace_ids[m], H5P_DEFAULT, data_chunk); if ( status < 0 ) { @@ -341,7 +341,7 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) valid_chunk = FALSE; - if ( verbose ) { + if ( verbose ) { HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n", @@ -351,7 +351,7 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) HDfprintf(stdout, "m = %d, i = %d, j = %d, k = %d, l = %d\n", m, i, j, k, l); - } + } } } } @@ -361,12 +361,12 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) pass = FALSE; failure_mssg = "slab validation failed."; - if ( verbose ) { + if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); - } + } } } m++; @@ -417,16 +417,16 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) } /* create_datasets() */ - + /*------------------------------------------------------------------------- * Function: delete_datasets() * - * Purpose: If pass is TRUE on entry, verify and then delete the - * dataset(s) indicated by min_dset and max_dset in the - * indicated file. + * Purpose: If pass is TRUE on entry, verify and then delete the + * dataset(s) indicated by min_dset and max_dset in the + * indicated file. * - * Datasets and their contents must be well know, as we - * will verify that they contain the expected data later. + * Datasets and their contents must be well know, as we + * will verify that they contain the expected data later. * * On failure, set pass to FALSE, and set failure_mssg * to point to an appropriate failure message. @@ -441,7 +441,7 @@ create_datasets(hid_t file_id, int min_dset, int max_dset) *------------------------------------------------------------------------- */ -static void +static void delete_datasets(hid_t file_id, int min_dset, int max_dset) { const char * fcn_name = "delete_datasets()"; @@ -470,13 +470,13 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset) while ( ( pass ) && ( i <= max_dset ) ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); - if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) { + if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) { pass = FALSE; failure_mssg = "H5Ldelete() failed."; - } + } i++; } @@ -488,32 +488,32 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset) } /* delete_datasets() */ - + /*------------------------------------------------------------------------- * Function: open_hdf5_file() * - * Purpose: If pass is true on entry, create or open the specified HDF5 - * and test to see if it has a metadata cache image superblock - * extension message. + * Purpose: If pass is true on entry, create or open the specified HDF5 + * and test to see if it has a metadata cache image superblock + * extension message. * - * Set pass to FALSE and issue a suitable failure - * message if either the file contains a metadata cache image - * superblock extension and mdci_sbem_expected is TRUE, or - * vise versa. + * Set pass to FALSE and issue a suitable failure + * message if either the file contains a metadata cache image + * superblock extension and mdci_sbem_expected is TRUE, or + * vise versa. * - * If mdci_sbem_expected is TRUE, also verify that the metadata - * cache has been advised of this. + * If mdci_sbem_expected is TRUE, also verify that the metadata + * cache has been advised of this. * - * If read_only is TRUE, open the file read only. Otherwise - * open the file read/write. + * If read_only is TRUE, open the file read only. Otherwise + * open the file read/write. * - * If set_mdci_fapl is TRUE, set the metadata cache image - * FAPL entry when opening the file, and verify that the - * metadata cache is notified. + * If set_mdci_fapl is TRUE, set the metadata cache image + * FAPL entry when opening the file, and verify that the + * metadata cache is notified. * - * If config_fsm is TRUE, setup the persistent free space - * manager. Note that this flag may only be set if - * create_file is also TRUE. + * If config_fsm is TRUE, setup the persistent free space + * manager. Note that this flag may only be set if + * create_file is also TRUE. * * Return pointers to the cache data structure and file data * structures. @@ -556,8 +556,8 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, if ( pass ) { - /* opening the file both read only and with a cache image - * requested is a contradiction. We resolve it by ignoring + /* opening the file both read only and with a cache image + * requested is a contradiction. We resolve it by ignoring * the cache image request silently. */ if ( ( create_file && mdci_sbem_expected ) || @@ -600,7 +600,7 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, /* call H5Pset_libver_bounds() on the fapl_id */ if ( pass ) { - if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) { pass = FALSE; @@ -625,7 +625,7 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || ( cache_image_config.generate_image != FALSE ) || ( cache_image_config.save_resize_status != FALSE ) || - ( cache_image_config.entry_ageout != + ( cache_image_config.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) ) { pass = FALSE; @@ -657,17 +657,17 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, /* setup the persistent free space manager if indicated */ if ( ( pass ) && ( config_fsm ) ) { - fcpl_id = H5Pcreate(H5P_FILE_CREATE); + fcpl_id = H5Pcreate(H5P_FILE_CREATE); - if ( fcpl_id <= 0 ) { + if ( fcpl_id <= 0 ) { - pass = FALSE; - failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed."; - } + pass = FALSE; + failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed."; + } } if ( ( pass ) && ( config_fsm ) ) { - if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, + if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) { pass = FALSE; failure_mssg = "H5Pset_file_space_strategy() failed."; @@ -693,13 +693,13 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, if ( create_file ) { - if ( fcpl_id != -1 ) + if ( fcpl_id != -1 ) - file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, fcpl_id, fapl_id); - else + else - file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); } else { @@ -779,26 +779,26 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, if ( set_mdci_fapl ) { - if ( read_only ) { + if ( read_only ) { - if ( ( image_ctl.version != + if ( ( image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || ( image_ctl.generate_image != FALSE ) || ( image_ctl.save_resize_status != FALSE ) || - ( image_ctl.entry_ageout != + ( image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { pass = FALSE; failure_mssg = "Unexpected image_ctl values(1).\n"; } - } else { + } else { - if ( ( image_ctl.version != + if ( ( image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || ( image_ctl.generate_image != TRUE ) || ( image_ctl.save_resize_status != FALSE ) || - ( image_ctl.entry_ageout != + ( image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { @@ -808,11 +808,11 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, } } else { - if ( ( image_ctl.version != + if ( ( image_ctl.version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION ) || ( image_ctl.generate_image != FALSE ) || ( image_ctl.save_resize_status != FALSE ) || - ( image_ctl.entry_ageout != + ( image_ctl.entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE ) || ( image_ctl.flags != H5C_CI__ALL_FLAGS ) ) { @@ -863,15 +863,15 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, pass = FALSE; failure_mssg = "mdci sb extension message not present?\n"; } - } + } } else { - if ( ( cache_ptr->load_image == TRUE ) || + if ( ( cache_ptr->load_image == TRUE ) || ( cache_ptr->delete_image == TRUE ) ) { pass = FALSE; failure_mssg = "mdci sb extension message present?\n"; - } + } } } @@ -891,12 +891,12 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, } /* open_hdf5_file() */ - + /*------------------------------------------------------------------------- * Function: attempt_swmr_open_hdf5_file() * - * Purpose: If pass is true on entry, attempt to create or open the - * specified HDF5 file with SWMR, and also with cache image + * Purpose: If pass is true on entry, attempt to create or open the + * specified HDF5 file with SWMR, and also with cache image * creation if requested. * * In all cases, the attempted open or create should fail. @@ -913,8 +913,8 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected, static void attempt_swmr_open_hdf5_file(const hbool_t create_file, - const hbool_t set_mdci_fapl, - const char * hdf_file_name) + const hbool_t set_mdci_fapl, + const char * hdf_file_name) { const char * fcn_name = "attempt_swmr_open_hdf5_file()"; hbool_t show_progress = FALSE; @@ -945,7 +945,7 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, /* call H5Pset_libver_bounds() on the fapl_id */ if ( pass ) { - if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) + if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) { pass = FALSE; @@ -980,8 +980,8 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, if ( create_file ) { H5E_BEGIN_TRY { - file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, - H5P_DEFAULT, fapl_id); + file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, + H5P_DEFAULT, fapl_id); } H5E_END_TRY; } else { @@ -995,7 +995,7 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, pass = FALSE; failure_mssg = "SWMR H5Fcreate() or H5Fopen() succeeded.\n"; - } + } } if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++); @@ -1004,17 +1004,17 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, } /* attempt_swmr_open_hdf5_file() */ - + /*------------------------------------------------------------------------- * Function: verify_datasets() * - * Purpose: If pass is TRUE on entry, verify that the datasets in the - * file exist and contain the expected data. + * Purpose: If pass is TRUE on entry, verify that the datasets in the + * file exist and contain the expected data. * - * Note that these datasets were created by - * create_datasets() above. Thus any changes in that - * function must be reflected in this function, and - * vise-versa. + * Note that these datasets were created by + * create_datasets() above. Thus any changes in that + * function must be reflected in this function, and + * vise-versa. * * On failure, set pass to FALSE, and set failure_mssg * to point to an appropriate failure message. @@ -1029,7 +1029,7 @@ attempt_swmr_open_hdf5_file(const hbool_t create_file, *------------------------------------------------------------------------- */ -static void +static void verify_datasets(hid_t file_id, int min_dset, int max_dset) { const char * fcn_name = "verify_datasets()"; @@ -1065,7 +1065,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) /* open the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -1157,8 +1157,8 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) /* read the chunk from file */ if ( pass ) { - status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, - memspace_id, filespace_ids[m], + status = H5Dread(dataset_ids[m], H5T_NATIVE_INT, + memspace_id, filespace_ids[m], H5P_DEFAULT, data_chunk); if ( status < 0 ) { @@ -1183,8 +1183,8 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) valid_chunk = FALSE; - if ( verbose ) { - + if ( verbose ) { + HDfprintf(stdout, "data_chunk[%0d][%0d] = %0d, expect %0d.\n", k, l, data_chunk[k][l], @@ -1193,7 +1193,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) HDfprintf(stdout, "m = %d, i = %d, j = %d, k = %d, l = %d\n", m, i, j, k, l); - } + } } } } @@ -1203,12 +1203,12 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) pass = FALSE; failure_mssg = "slab validation failed."; - if ( verbose ) { + if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); - } + } } } m++; @@ -1259,7 +1259,7 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) } /* verify_datasets() */ - + /****************************************************************************/ /******************************* Test Functions *****************************/ /****************************************************************************/ @@ -1268,60 +1268,60 @@ verify_datasets(hid_t file_id, int min_dset, int max_dset) * Function: check_cache_image_ctl_flow_1() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * This test is an initial smoke check, so the sequence of - * operations is relatively simple. In particular, we are - * testing: + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: * - * i) Creation of file with cache image FAPL entry set - * and insertion of metadata cache image superblock - * message on file close. + * i) Creation of file with cache image FAPL entry set + * and insertion of metadata cache image superblock + * message on file close. * - * ii) Open of file with metadata cache image superblock - * message, transmission of message to metadata cache, - * and deletion of superblock message prior to close. + * ii) Open of file with metadata cache image superblock + * message, transmission of message to metadata cache, + * and deletion of superblock message prior to close. * - * Note that in all cases we are performing operations on the - * file. While this is the typical case, we must repeat this - * test without operations on the file. + * Note that in all cases we are performing operations on the + * file. While this is the typical case, we must repeat this + * test without operations on the file. * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file. + * 4) Open the file. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 5) Open a dataset. + * 5) Open a dataset. * - * Verify that the metadata cache image superblock - * extension message has been deleted. + * Verify that the metadata cache image superblock + * extension message has been deleted. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file. + * 7) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 8) Close the file. + * 8) Close the file. * - * 9) Delete the file. + * 9) Delete the file. * * Return: void * @@ -1353,7 +1353,7 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -1368,16 +1368,16 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image super block - * extension message only. + * Set flags forcing creation of metadata cache image super block + * extension message only. */ if ( pass ) { @@ -1386,8 +1386,8 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -1395,10 +1395,10 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -1406,10 +1406,10 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) create_datasets(file_id, 0, 5); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -1422,26 +1422,26 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 4) Open the file. + + + /* 4) Open the file. * - * Verify that the metadata cache is instructed to load the - * metadata cache image, and that the supplied address and length - * are HADDR_UNDEF and zero respectively. Note that these values + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values * indicate that the metadata image block doesn't exist. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -1449,13 +1449,13 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -1471,9 +1471,9 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) */ } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -1486,24 +1486,24 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 7) Open the file. + + + /* 7) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -1511,9 +1511,9 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 8) Close the file. */ @@ -1526,9 +1526,9 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 9) Delete the file */ @@ -1551,63 +1551,63 @@ check_cache_image_ctl_flow_1(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_1() */ - + /*------------------------------------------------------------------------- * Function: check_cache_image_ctl_flow_2() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * This test is an initial smoke check, so the sequence of - * operations is relatively simple. In particular, we are - * testing: + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: * - * i) Creation of file with cache image FAPL entry set - * and insertion of metadata cache image superblock - * message on file close. + * i) Creation of file with cache image FAPL entry set + * and insertion of metadata cache image superblock + * message on file close. * - * ii) Open of file with metadata cache image superblock - * message, transmission of message to metadata cache, - * and deletion of superblock message prior to close. + * ii) Open of file with metadata cache image superblock + * message, transmission of message to metadata cache, + * and deletion of superblock message prior to close. * - * Note that unlike the previous test, no operations are performed - * on the file. As a result of this, the metadata cache image - * message is not processed until the metadata cache receives - * the file close warning. (Under normal circumstances, it is - * processed as part of the first protect operation after the - * superblock is loaded.) + * Note that unlike the previous test, no operations are performed + * on the file. As a result of this, the metadata cache image + * message is not processed until the metadata cache receives + * the file close warning. (Under normal circumstances, it is + * processed as part of the first protect operation after the + * superblock is loaded.) * - * In this particular test, we preform the following operations: + * In this particular test, we preform the following operations: * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 2) Close the file. + * 2) Close the file. * - * 3) Open the file. + * 3) Open the file. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file. + * 7) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 8) Close the file. + * 8) Close the file. * - * 9) Delete the file. + * 9) Delete the file. * * Return: void * @@ -1639,7 +1639,7 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* setup the file name */ @@ -1653,16 +1653,16 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image super block - * extension message only. + * Set flags forcing creation of metadata cache image super block + * extension message only. */ if ( pass ) { @@ -1671,8 +1671,8 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -1680,10 +1680,10 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Close the file. */ if ( pass ) { @@ -1696,26 +1696,26 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 3) Open the file. + + + /* 3) Open the file. * - * Verify that the metadata cache is instructed to load the - * metadata cache image, and that the supplied address and length - * are HADDR_UNDEF and zero respectively. Note that these values + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values * indicate that the metadata image block doesn't exist. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -1723,10 +1723,10 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 4) Close the file. */ if ( pass ) { @@ -1738,24 +1738,24 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 5) Open the file. + + + /* 5) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -1763,9 +1763,9 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -1778,9 +1778,9 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Delete the file */ @@ -1803,81 +1803,81 @@ check_cache_image_ctl_flow_2(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_2() */ - + /*------------------------------------------------------------------------- * Function: check_cache_image_ctl_flow_3() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * The objectives of this test are to: + * The objectives of this test are to: * - * i) Test operation of the metadata cache image FAPL - * entry set on open of an existing file. This - * should result in the insertion of a metadata - * cache image superblock message on file close. + * i) Test operation of the metadata cache image FAPL + * entry set on open of an existing file. This + * should result in the insertion of a metadata + * cache image superblock message on file close. * - * ii) Test operation of the metadata cache image super - * block extension message when it appears in a file - * that is opened READ ONLY. + * ii) Test operation of the metadata cache image super + * block extension message when it appears in a file + * that is opened READ ONLY. * - * Note that in all cases we are performing operations on the - * file between file open and close. While this is the - * typical case, we must repeat this test without operations - * on the file. + * Note that in all cases we are performing operations on the + * file between file open and close. While this is the + * typical case, we must repeat this test without operations + * on the file. * - * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. * - * Verify that the cache is NOT informed of the cache image - * FAPL entry. + * Verify that the cache is NOT informed of the cache image + * FAPL entry. * - * 2) Close the file. + * 2) Close the file. * - * 3) Open the file WITH the cache image FAPL entry. + * 3) Open the file WITH the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 4) Create some datasets. + * 4) Create some datasets. * - * 5) Close the file. + * 5) Close the file. * - * 6) Open the file READ ONLY. + * 6) Open the file READ ONLY. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 7) Verify the contents of the datasets. + * 7) Verify the contents of the datasets. * - * 8) Close the file. + * 8) Close the file. * - * 9) Open the file READ/WRITE. + * 9) Open the file READ/WRITE. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 10) Verify the contents of the datasets. + * 10) Verify the contents of the datasets. * - * 11) Close the file. + * 11) Close the file. * - * 12) Open the file + * 12) Open the file * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 13) Close the file. + * 13) Close the file. * - * 14) Delete the file. + * 14) Delete the file. * * Return: void * @@ -1925,10 +1925,10 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 1 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + + /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. * - * Verify that the cache is NOT informed of the cache image + * Verify that the cache is NOT informed of the cache image * FAPL entry. */ @@ -1938,8 +1938,8 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -1950,7 +1950,7 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 2 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Close the file. */ if ( pass ) { @@ -1964,13 +1964,13 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 3) Open the file WITH the cache image FAPL entry. + + + /* 3) Open the file WITH the cache image FAPL entry. * * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image super block + * Set flags forcing creation of metadata cache image super block * extension message only. */ @@ -1980,8 +1980,8 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -2017,13 +2017,13 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 6 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Open the file READ ONLY. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -2031,11 +2031,11 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2045,7 +2045,7 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Verify the contents of the datasets. */ @@ -2071,13 +2071,13 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 9 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 9) Open the file READ/WRITE. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -2085,11 +2085,11 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2111,7 +2111,7 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Close the file. */ if ( pass ) { @@ -2126,21 +2126,21 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 12 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 12) Open the file * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2166,7 +2166,7 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) if ( show_progress ) /* 14 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 14) Delete the file. */ if ( pass ) { @@ -2189,73 +2189,73 @@ check_cache_image_ctl_flow_3(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_3() */ - + /*------------------------------------------------------------------------- * Function: check_cache_image_ctl_flow_4() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * The objectives of this test are to: + * The objectives of this test are to: * - * i) Test operation of the metadata cache image FAPL - * entry set on open of an existing file. This - * should result in the insertion of a metadata - * cache image superblock message on file close. + * i) Test operation of the metadata cache image FAPL + * entry set on open of an existing file. This + * should result in the insertion of a metadata + * cache image superblock message on file close. * - * ii) Test operation of the metadata cache image super - * block extension message when it appears in a file - * that is opened READ ONLY. + * ii) Test operation of the metadata cache image super + * block extension message when it appears in a file + * that is opened READ ONLY. * - * In this test we avoid all file access beyond file open - * and close. + * In this test we avoid all file access beyond file open + * and close. * - * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + * 1) Create a HDF5 file WITHOUT the cache image FAPL entry. * - * Verify that the cache is NOT informed of the cache image - * FAPL entry. + * Verify that the cache is NOT informed of the cache image + * FAPL entry. * - * 2) Close the file. + * 2) Close the file. * - * 3) Open the file WITH the cache image FAPL entry. + * 3) Open the file WITH the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 4) Close the file. + * 4) Close the file. * - * 5) Open the file READ ONLY. + * 5) Open the file READ ONLY. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file READ/WRITE. + * 7) Open the file READ/WRITE. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 8) Close the file. + * 8) Close the file. * - * 9) Open the file + * 9) Open the file * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 10) Close the file. + * 10) Close the file. * - * 11) Delete the file. + * 11) Delete the file. * * Return: void * @@ -2303,10 +2303,10 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 1 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. + + /* 1) Create a HDF5 file WITHOUT the cache image FAPL entry. * - * Verify that the cache is NOT informed of the cache image + * Verify that the cache is NOT informed of the cache image * FAPL entry. */ @@ -2316,8 +2316,8 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2328,7 +2328,7 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 2 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Close the file. */ if ( pass ) { @@ -2342,13 +2342,13 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 3) Open the file WITH the cache image FAPL entry. + + + /* 3) Open the file WITH the cache image FAPL entry. * * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image super block + * Set flags forcing creation of metadata cache image super block * extension message only. */ @@ -2358,8 +2358,8 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -2384,13 +2384,13 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 5 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 5) Open the file READ ONLY. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -2398,11 +2398,11 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2412,7 +2412,7 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 6 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -2427,13 +2427,13 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Open the file READ/WRITE. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -2441,11 +2441,11 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2471,21 +2471,21 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 9 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 9) Open the file * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2511,7 +2511,7 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) if ( show_progress ) /* 11 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Delete the file. */ if ( pass ) { @@ -2534,66 +2534,66 @@ check_cache_image_ctl_flow_4(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_4() */ - + /*------------------------------------------------------------------------- * Function: check_cache_image_ctl_flow_5() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * The objective of this test is verify correct control flow - * when a file with a metadata cache image superblock extension - * message is opened with the metadata cache image FAPL entry. + * The objective of this test is verify correct control flow + * when a file with a metadata cache image superblock extension + * message is opened with the metadata cache image FAPL entry. * - * Note that in all cases we are performing operations on the - * file between file open and close. While this is the - * typical case, we must repeat this test without operations - * on the file. + * Note that in all cases we are performing operations on the + * file between file open and close. While this is the + * typical case, we must repeat this test without operations + * on the file. * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 2) Create some datasets. + * 2) Create some datasets. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file WITH the cache image FAPL entry. + * 4) Open the file WITH the cache image FAPL entry. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 5) Verify the contents of the datasets. + * 5) Verify the contents of the datasets. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file. + * 7) Open the file. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 8) Verify the contents of the datasets. + * 8) Verify the contents of the datasets. * - * 9) Close the file. + * 9) Close the file. * - * 10) Delete the file. + * 10) Delete the file. * * Return: void * @@ -2642,12 +2642,12 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 1 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 1) Create a HDF5 file with the cache image FAPL entry. + + /* 1) Create a HDF5 file with the cache image FAPL entry. * * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image + * Set flags forcing creation of metadata cache image * super block extension message only. */ @@ -2657,8 +2657,8 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -2668,7 +2668,7 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 2 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets. */ @@ -2680,7 +2680,7 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 3) Close the file. */ if ( pass ) { @@ -2695,30 +2695,30 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 4 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 4) Open the file WITH the cache image FAPL entry. + + /* 4) Open the file WITH the cache image FAPL entry. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. * - * Verify that the cache is informed of the cache image + * Verify that the cache is informed of the cache image * FAPL entry. * - * Set flags forcing creation of metadata cache image + * Set flags forcing creation of metadata cache image * super block extension message only. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -2739,7 +2739,7 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 6 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ if ( pass ) { @@ -2754,12 +2754,12 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 7) Open the file. + + /* 7) Open the file. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -2767,11 +2767,11 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -2791,8 +2791,8 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 9 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 9) Close the file. */ if ( pass ) { @@ -2807,7 +2807,7 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) if ( show_progress ) /* 10 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Delete the file. */ if ( pass ) { @@ -2830,58 +2830,58 @@ check_cache_image_ctl_flow_5(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_5() */ - + /*------------------------------------------------------------------------- * Function: check_cache_image_ctl_flow_6() * * Purpose: This test is one of a sequence of control flow tests intended - * to verify that control flow for the cache image feature works - * as expected. + * to verify that control flow for the cache image feature works + * as expected. * - * The objective of this test is verify correct control flow - * when a file with a metadata cache image superblock extension - * message is opened with the metadata cache image FAPL entry. + * The objective of this test is verify correct control flow + * when a file with a metadata cache image superblock extension + * message is opened with the metadata cache image FAPL entry. * - * In this test we avoid all file activity other than open - * and close. + * In this test we avoid all file activity other than open + * and close. * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 2) Close the file. + * 2) Close the file. * - * 3) Open the file WITH the cache image FAPL entry. + * 3) Open the file WITH the cache image FAPL entry. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set flags forcing creation of metadata cache image - * super block extension message only. + * Set flags forcing creation of metadata cache image + * super block extension message only. * - * 4) Close the file. + * 4) Close the file. * - * 5) Open the file. + * 5) Open the file. * - * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and - * zero respectively. Note that these values indicate - * that the metadata image block doesn't exist. + * Verify that the metadata cache is instructed + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and + * zero respectively. Note that these values indicate + * that the metadata image block doesn't exist. * - * 6) Close the file. + * 6) Close the file. * - * 7) Delete the file. + * 7) Delete the file. * * Return: void * @@ -2930,12 +2930,12 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 1 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 1) Create a HDF5 file with the cache image FAPL entry. + + /* 1) Create a HDF5 file with the cache image FAPL entry. * * Verify that the cache is informed of the cache image FAPL entry. * - * Set flags forcing creation of metadata cache image + * Set flags forcing creation of metadata cache image * super block extension message only. */ @@ -2945,8 +2945,8 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -2956,7 +2956,7 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 2 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Close the file. */ @@ -2972,30 +2972,30 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 3 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 4) Open the file WITH the cache image FAPL entry. + + /* 4) Open the file WITH the cache image FAPL entry. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. * - * Verify that the cache is informed of the cache image + * Verify that the cache is informed of the cache image * FAPL entry. * - * Set flags forcing creation of metadata cache image + * Set flags forcing creation of metadata cache image * super block extension message only. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG, /* file_id_ptr */ &file_id, @@ -3006,7 +3006,7 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 4 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 5) Close the file. */ if ( pass ) { @@ -3021,12 +3021,12 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 5 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 5) Open the file. + + /* 5) Open the file. * * Verify that the metadata cache is instructed - * to load the metadata cache image, and that the - * supplied address and length are HADDR_UNDEF and + * to load the metadata cache image, and that the + * supplied address and length are HADDR_UNDEF and * zero respectively. Note that these values indicate * that the metadata image block doesn't exist. */ @@ -3034,11 +3034,11 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3049,7 +3049,7 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 6 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ if ( pass ) { @@ -3064,7 +3064,7 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) if ( show_progress ) /* 7 */ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Delete the file. */ if ( pass ) { @@ -3087,93 +3087,93 @@ check_cache_image_ctl_flow_6(hbool_t single_file_vfd) } /* check_cache_image_ctl_flow_6() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_1() * * Purpose: This test is one of a sequence of tests intended - * to exercise the cache image feature verifying that it - * works more or less correctly in common cases. + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. * - * This test is an initial smoke check, so the sequence of - * operations is relatively simple. In particular, we are - * testing: + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: * - * i) Creation of file with metadata cache image - * superblock extension message and cache image - * block. + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. * - * ii) Open of file with metadata cache image superblock - * extension message and cache image block. - * Deserialization and removal of both, insertion - * of prefetched cache entries, and deserialization - * of prefetched cache entries as they are protected. + * ii) Open of file with metadata cache image superblock + * extension message and cache image block. + * Deserialization and removal of both, insertion + * of prefetched cache entries, and deserialization + * of prefetched cache entries as they are protected. * - * iii) Subsequent write of file without metadata cache - * image. + * iii) Subsequent write of file without metadata cache + * image. * - * iv) Open and close of file with metadata cache image - * image requested, but with no operations on the - * file. + * iv) Open and close of file with metadata cache image + * image requested, but with no operations on the + * file. * - * To do this: + * To do this: * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file. + * 4) Open the file. * - * Verify that the metadata cache is instructed - * to load the metadata cache image. + * Verify that the metadata cache is instructed + * to load the metadata cache image. * - * 5) Open a dataset. + * 5) Open a dataset. * - * Verify that it contains the expected data + * Verify that it contains the expected data * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file. + * 7) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 8) Open a dataset. + * 8) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 9) Close the file. + * 9) Close the file. * - * 10) Open the file with the cache image FAPL entry. + * 10) Open the file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 11) Close the file. Since there has been no access to - * any entries that would be included in the cache image, - * there should be no cache image. + * 11) Close the file. Since there has been no access to + * any entries that would be included in the cache image, + * there should be no cache image. * - * 12) Open the file. + * 12) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 13) Open a dataset. + * 13) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 14) Close the file. + * 14) Close the file. * - * 15) Delete the file. + * 15) Delete the file. * * Return: void * @@ -3205,7 +3205,7 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -3220,13 +3220,13 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -3237,8 +3237,8 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -3246,10 +3246,10 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -3270,10 +3270,10 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -3286,26 +3286,26 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 4) Open the file. + + + /* 4) Open the file. * - * Verify that the metadata cache is instructed to load the - * metadata cache image, and that the supplied address and length - * are HADDR_UNDEF and zero respectively. Note that these values + * Verify that the metadata cache is instructed to load the + * metadata cache image, and that the supplied address and length + * are HADDR_UNDEF and zero respectively. Note that these values * indicate that the metadata image block doesn't exist. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3313,13 +3313,13 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -3339,9 +3339,9 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -3354,24 +3354,24 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 7) Open the file. + + + /* 7) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3379,13 +3379,13 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 8) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -3406,7 +3406,7 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -3421,24 +3421,24 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Open the file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -3446,13 +3446,13 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 11) Close the file. Since there has been no access to - * any entries that would be included in the cache image, - * there should be no cache image. + + /* 11) Close the file. Since there has been no access to + * any entries that would be included in the cache image, + * there should be no cache image. */ if ( pass ) { @@ -3464,24 +3464,24 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 12) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3489,13 +3489,13 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 13) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. */ if ( pass ) { @@ -3515,10 +3515,10 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 14) Close the file. */ if ( pass ) { @@ -3530,9 +3530,9 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 15) Delete the file */ @@ -3555,55 +3555,55 @@ cache_image_smoke_check_1(hbool_t single_file_vfd) } /* cache_image_smoke_check_1() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_2() * * Purpose: This test is one of a sequence of tests intended - * to exercise the cache image feature verifying that it - * works more or less correctly in common cases. + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. * - * This test is an initial smoke check, so the sequence of - * operations is relatively simple. In particular, we are - * testing: + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: * - * i) Creation of file with metadata cache image - * superblock extension message and cache image - * block. + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. * - * ii) Open of file with metadata cache image superblock - * extension message and cache image block. Write - * of prefetched entries to file on file close. + * ii) Open of file with metadata cache image superblock + * extension message and cache image block. Write + * of prefetched entries to file on file close. * - * To do this: + * To do this: * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file. + * 4) Open the file. * - * 5) Close the file. + * 5) Close the file. * - * 6) Open the file. + * 6) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 7) Open a dataset. + * 7) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 8) Close the file. + * 8) Close the file. * - * 9) Delete the file. + * 9) Delete the file. * * Return: void * @@ -3635,7 +3635,7 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -3650,13 +3650,13 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -3667,8 +3667,8 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -3676,10 +3676,10 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -3699,10 +3699,10 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -3715,23 +3715,23 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 4) Open the file. + /* 4) Open the file. * - * Verify that the metadata cache is instructed to load the + * Verify that the metadata cache is instructed to load the * metadata cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3740,15 +3740,15 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } /* can't verify that metadata cache image has been loaded directly, - * as in this cache, the load will not happen until close, and thus - * the images_created stat will not be readily available as it is + * as in this cache, the load will not happen until close, and thus + * the images_created stat will not be readily available as it is * incremented just before the cache is shut down. */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Close the file. */ if ( pass ) { @@ -3760,24 +3760,24 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 6) Open the file. + + + /* 6) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -3785,13 +3785,13 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 7) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -3800,7 +3800,7 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) verify_datasets(file_id, 0, 5); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -3815,9 +3815,9 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 9) Delete the file */ @@ -3840,77 +3840,77 @@ cache_image_smoke_check_2(hbool_t single_file_vfd) } /* cache_image_smoke_check_2() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_3() * * Purpose: This test is one of a sequence of tests intended - * to exercise the cache image feature verifying that it - * works more or less correctly in common cases. + * to exercise the cache image feature verifying that it + * works more or less correctly in common cases. * - * This test is an initial smoke check, so the sequence of - * operations is relatively simple. In particular, we are - * testing: + * This test is an initial smoke check, so the sequence of + * operations is relatively simple. In particular, we are + * testing: * - * i) Creation of file with metadata cache image - * superblock extension message and cache image - * block. + * i) Creation of file with metadata cache image + * superblock extension message and cache image + * block. * - * ii) Read only open and close of file with metadata - * cache image superblock extension message and - * cache image block. + * ii) Read only open and close of file with metadata + * cache image superblock extension message and + * cache image block. * - * iii) Subsequent R/W open and close of file with metadata - * cache image superblock extension message and + * iii) Subsequent R/W open and close of file with metadata + * cache image superblock extension message and * cache image block. * - * To do this: + * To do this: * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file read only. + * 4) Open the file read only. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 5 Open a dataset. + * 5 Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file. + * 7) Open the file. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 8 Open a dataset. + * 8 Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 9) Close the file. + * 9) Close the file. * - * 10) Open the file. + * 10) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 11) Open a dataset. + * 11) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 12) Close the file. + * 12) Close the file. * - * 13) Delete the file. + * 13) Delete the file. * * Return: void * @@ -3942,7 +3942,7 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -3957,13 +3957,13 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -3974,8 +3974,8 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -3983,10 +3983,10 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -4005,10 +4005,10 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -4021,24 +4021,24 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 4) Open the file read only. + + + /* 4) Open the file read only. * - * Verify that the metadata cache is instructed to load the + * Verify that the metadata cache is instructed to load the * metadata cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4046,13 +4046,13 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -4072,10 +4072,10 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ if ( pass ) { @@ -4087,24 +4087,24 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 7) Open the file. + + + /* 7) Open the file. * - * Verify that the file contains a metadata cache image + * Verify that the file contains a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4112,13 +4112,13 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 8) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -4139,7 +4139,7 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4153,22 +4153,22 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) failure_mssg = "H5Fclose() failed.\n"; } } - - - /* 10) Open the file. + + + /* 10) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4176,13 +4176,13 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 11) Open and close a dataset. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -4203,7 +4203,7 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4218,9 +4218,9 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 13) Delete the file */ @@ -4243,66 +4243,66 @@ cache_image_smoke_check_3(hbool_t single_file_vfd) } /* cache_image_smoke_check_3() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_4() * - * Purpose: This test attempts to mimic the typical "poor man's - * parallel use case in which the file is passed between - * processes, each of which open the file, write some data, - * close the file, and then pass control on to the next - * process. + * Purpose: This test attempts to mimic the typical "poor man's + * parallel use case in which the file is passed between + * processes, each of which open the file, write some data, + * close the file, and then pass control on to the next + * process. * - * In this case, we only write one dataset per process. + * In this case, we only write one dataset per process. * - * Cycle of operation + * Cycle of operation * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create and write a dataset in the file. + * 2) Create and write a dataset in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file with the cache image FAPL entry. + * 4) Open the file with the cache image FAPL entry. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 5 Create and write a new dataset + * 5 Create and write a new dataset * - * 6) Close the file. + * 6) Close the file. * - * If sufficient datasets have been created, continue to + * If sufficient datasets have been created, continue to * 7). Otherwise goto 4) * - * 7) Open the file. + * 7) Open the file. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 8) Open all datasets that have been created, and - * verify that they contain the expected data. + * 8) Open all datasets that have been created, and + * verify that they contain the expected data. * - * 9) Close the file. + * 9) Close the file. * - * 10) Open the file. + * 10) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 11) Open all datasets that have been created, and + * 11) Open all datasets that have been created, and * verify that they contain the expected data. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 12) Close the file. + * 12) Close the file. * - * 13) Delete the file. + * 13) Delete the file. * * Return: void * @@ -4336,7 +4336,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4351,13 +4351,13 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -4368,8 +4368,8 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -4377,10 +4377,10 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create a dataset in the file. */ if ( pass ) { @@ -4399,10 +4399,10 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -4415,26 +4415,26 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) ) { - - /* 4) Open the file. + + /* 4) Open the file. * - * Verify that the metadata cache is instructed to load the + * Verify that the metadata cache is instructed to load the * metadata cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -4442,11 +4442,11 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) - HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp, max_dset, pass); - + /* 5) Create a dataset in the file. */ if ( pass ) { @@ -4465,11 +4465,11 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) - HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 1, max_dset, pass); - + /* 6) Close the file. */ if ( pass ) { @@ -4482,27 +4482,27 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) - HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass); } /* end while */ cp += 3; - - - /* 7) Open the file. + + + /* 7) Open the file. * - * Verify that the file contains a metadata cache image + * Verify that the file contains a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4510,13 +4510,13 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 8) Open and close all datasets. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -4537,7 +4537,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4551,22 +4551,22 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) failure_mssg = "H5Fclose() failed.\n"; } } - - - /* 10) Open the file. + + + /* 10) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4574,13 +4574,13 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 11) Open and close all datasets. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ @@ -4601,7 +4601,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4616,7 +4616,7 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 13) Delete the file */ @@ -4639,79 +4639,79 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) return !pass; } /* cache_image_smoke_check_4() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_5() * - * Purpose: This test attempts to mimic the typical "poor man's - * parallel use case in which the file is passed between - * processes, each of which open the file, write some data, - * close the file, and then pass control on to the next - * process. + * Purpose: This test attempts to mimic the typical "poor man's + * parallel use case in which the file is passed between + * processes, each of which open the file, write some data, + * close the file, and then pass control on to the next + * process. * - * In this case, we create one group for each process, and - * populate it with a "zoo" of HDF5 objects selected to - * (ideally) exercise all HDF5 on disk data structures. + * In this case, we create one group for each process, and + * populate it with a "zoo" of HDF5 objects selected to + * (ideally) exercise all HDF5 on disk data structures. * - * Cycle of operation + * Cycle of operation * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create a process specific group. + * 2) Create a process specific group. * - * 3) Construct a "zoo" in the above group, and validate it. + * 3) Construct a "zoo" in the above group, and validate it. * - * 4) Close the file. + * 4) Close the file. * - * 5) Open the file with the cache image FAPL entry. + * 5) Open the file with the cache image FAPL entry. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 6) Validate the "zoo" created in the previous file open. + * 6) Validate the "zoo" created in the previous file open. * - * 7) Create a process specific group for this file open + * 7) Create a process specific group for this file open * - * 8) Construct a "zoo" in the above group, and validate it. - * - * 9) Close the file. + * 8) Construct a "zoo" in the above group, and validate it. * - * If sufficient zoos have been created, continue to + * 9) Close the file. + * + * If sufficient zoos have been created, continue to * 10). Otherwise goto 5) * - * 10) Open the file R/O. + * 10) Open the file R/O. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 11) Validate all the zoos. + * 11) Validate all the zoos. * - * 12) Close the file. + * 12) Close the file. * - * 13) Open the file. + * 13) Open the file. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 14) Validate all the zoos. + * 14) Validate all the zoos. * - * 15) Close the file. + * 15) Close the file. * - * 16) Open the file. + * 16) Open the file. * - * Verify that the file doesn't contain a metadata cache - * image superblock extension message. + * Verify that the file doesn't contain a metadata cache + * image superblock extension message. * - * 17) Validate all the zoos. + * 17) Validate all the zoos. * - * 18) Close the file. + * 18) Close the file. * - * 19) Delete the file. + * 19) Delete the file. * * Return: void * @@ -4750,7 +4750,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -4769,13 +4769,13 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) H5Pclose(fapl_id); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -4786,8 +4786,8 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -4795,31 +4795,31 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 2) Create a process specific group. */ if ( pass ) { - sprintf(process_group_name, "/process_%d", min_group); + HDsprintf(process_group_name, "/process_%d", min_group); - proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, + proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( proc_gid < 0 ) { - pass = FALSE; - failure_mssg = "H5Gcreate2() failed (1).\n"; + pass = FALSE; + failure_mssg = "H5Gcreate2() failed (1).\n"; } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 3) Construct a "zoo" in the above group, and validate it. */ - if ( pass ) + if ( pass ) create_zoo(file_id, process_group_name, min_group); #if H5C_COLLECT_CACHE_STATS @@ -4833,16 +4833,16 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 4) Close the file. */ if ( pass ) { - if ( H5Gclose(proc_gid) < 0 ) { - + if ( H5Gclose(proc_gid) < 0 ) { + pass = FALSE; failure_mssg = "H5Gclose(proc_gid) failed. (1)"; } @@ -4858,26 +4858,26 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); while ( ( pass ) && ( max_group < MAX_NUM_GROUPS ) ) { - - /* 5) Open the file. + + /* 5) Open the file. * - * Verify that the metadata cache is instructed to load the + * Verify that the metadata cache is instructed to load the * metadata cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -4885,13 +4885,13 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) - HDfprintf(stdout, "%s:L1 cp = %d, max_group = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp, max_group, pass); /* 6) Validate the "zoo" created in the previous file open. */ - if ( pass ) + if ( pass ) validate_zoo(file_id, process_group_name, max_group); #if H5C_COLLECT_CACHE_STATS @@ -4905,47 +4905,47 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) - HDfprintf(stdout, "%s:L2 cp = %d, max_group = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 1, max_group, pass); - /* 7) Create a process specific group for this file open */ + /* 7) Create a process specific group for this file open */ if ( pass ) { - max_group++; - sprintf(process_group_name, "/process_%d", max_group); + max_group++; + HDsprintf(process_group_name, "/process_%d", max_group); - proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, + proc_gid = H5Gcreate2(file_id, process_group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if ( proc_gid < 0 ) { - pass = FALSE; - failure_mssg = "H5Gcreate2() failed (2).\n"; + pass = FALSE; + failure_mssg = "H5Gcreate2() failed (2).\n"; } } - if ( show_progress ) - HDfprintf(stdout, "%s:L3 cp = %d, max_group = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 2, max_group, pass); - - /* 8) Construct a "zoo" in the above group, and validate it. */ - if ( pass ) + + /* 8) Construct a "zoo" in the above group, and validate it. */ + if ( pass ) create_zoo(file_id, process_group_name, max_group); - if ( show_progress ) - HDfprintf(stdout, "%s:L4 cp = %d, max_group = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L4 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 3, max_group, pass); - + /* 9) Close the file. */ if ( pass ) { - if ( H5Gclose(proc_gid) < 0 ) { - + if ( H5Gclose(proc_gid) < 0 ) { + pass = FALSE; failure_mssg = "H5Gclose(process_gid) failed. (2)"; } @@ -4961,24 +4961,24 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } } - if ( show_progress ) - HDfprintf(stdout, "%s:L5 cp = %d, max_group = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L5 cp = %d, max_group = %d, pass = %d.\n", fcn_name, cp + 4, max_group, pass); } /* end while */ cp += 5; - - /* 10) Open the file read only. + + /* 10) Open the file read only. * - * Verify that the file contains a metadata cache image + * Verify that the file contains a metadata cache image * superblock extension message. */ if(pass) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -4993,10 +4993,10 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* 11) Validate all the zoos. */ i = min_group; while(pass && i <= max_group) { - sprintf(process_group_name, "/process_%d", i); + HDsprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } - + #if H5C_COLLECT_CACHE_STATS if( pass) { if(cache_ptr->images_loaded == 0) { @@ -5017,20 +5017,20 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } } - /* 13) Open the file R/W. + /* 13) Open the file R/W. * - * Verify that the file contains a metadata cache image + * Verify that the file contains a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5038,7 +5038,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5046,10 +5046,10 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) i = min_group; while ( ( pass ) && ( i <= max_group ) ) { - sprintf(process_group_name, "/process_%d", i); + HDsprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } - + #if H5C_COLLECT_CACHE_STATS if ( pass ) { @@ -5062,7 +5062,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5076,22 +5076,22 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) failure_mssg = "H5Fclose() failed.\n"; } } - - - /* 16) Open the file. + + + /* 16) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5099,21 +5099,21 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 17) Validate all the zoos. * - * Verify that the metadata cache image superblock + * Verify that the metadata cache image superblock * extension message has been deleted. */ i = min_group; while ( ( pass ) && ( i <= max_group ) ) { - sprintf(process_group_name, "/process_%d", i); + HDsprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } - + #if H5C_COLLECT_CACHE_STATS if ( pass ) { @@ -5126,7 +5126,7 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5141,9 +5141,9 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 19) Delete the file */ @@ -5167,78 +5167,78 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) } /* cache_image_smoke_check_5() */ - + /*------------------------------------------------------------------------- * Function: cache_image_smoke_check_6() * * Purpose: As the free space manager metadata is now included in the - * cache image, a smoke check to verify generally correct - * behaviour of the persistent free space managers seems - * prudent. + * cache image, a smoke check to verify generally correct + * behaviour of the persistent free space managers seems + * prudent. * - * The basic idea of this test is to construct a long - * sequence of dataset creations and deletions, all separated - * by file open/close cycles with cache image enabled. If the - * perisistant free space managers are performing as expected, - * the size of the file should stabilize. + * The basic idea of this test is to construct a long + * sequence of dataset creations and deletions, all separated + * by file open/close cycles with cache image enabled. If the + * perisistant free space managers are performing as expected, + * the size of the file should stabilize. * - * To implement this, proceed as outlined in the cycle of - * operation below: + * To implement this, proceed as outlined in the cycle of + * operation below: * - * Cycle of operation + * Cycle of operation * - * 1) Create a HDF5 file with the cache image FAPL entry. + * 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image - * FAPL entry. + * Verify that the cache is informed of the cache image + * FAPL entry. * - * Set all cache image flags, forcing full functionality. + * Set all cache image flags, forcing full functionality. * - * 2) Create and write a dataset in the file. + * 2) Create and write a dataset in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file with the cache image FAPL entry. + * 4) Open the file with the cache image FAPL entry. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 5) Create and write a new dataset. + * 5) Create and write a new dataset. * - * 6) Verify and delete the old dataset. + * 6) Verify and delete the old dataset. * - * 7) Close the file. + * 7) Close the file. * - * If sufficient datasets have been created, and then - * deleteded continue to 8). Otherwise goto 4) + * If sufficient datasets have been created, and then + * deleteded continue to 8). Otherwise goto 4) * - * 8) Open the file. + * 8) Open the file. * - * Verify that the file contains a metadata cache - * image superblock extension message. + * Verify that the file contains a metadata cache + * image superblock extension message. * - * 9) Verify the last dataset created. + * 9) Verify the last dataset created. * - * 10) Close the file. + * 10) Close the file. * - * 11) Open the file. + * 11) Open the file. * - * 12) Verify and delete the last dataset. + * 12) Verify and delete the last dataset. * - * Verify that a metadata cache image is not loaded. + * Verify that a metadata cache image is not loaded. * - * 13) Close the file. + * 13) Close the file. * - * 14) Get the size of the file. Verify that it is less - * than 20 KB. Without deletions and persistent free - * space managers, size size is about 167 MB, so this - * is sufficient to verify that the persistent free - * space managers are more or less doing their job. + * 14) Get the size of the file. Verify that it is less + * than 20 KB. Without deletions and persistent free + * space managers, size size is about 167 MB, so this + * is sufficient to verify that the persistent free + * space managers are more or less doing their job. * * Note that in the absence of paged allocation, file * size gets below 1 KB. * - * 15) Delete the file. + * 15) Delete the file. * * Return: void * @@ -5273,7 +5273,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5288,13 +5288,13 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a HDF5 file with the cache image FAPL entry. + /* 1) Create a HDF5 file with the cache image FAPL entry. * - * Verify that the cache is informed of the cache image FAPL entry. + * Verify that the cache is informed of the cache image FAPL entry. * * Set flags forcing full function of the cache image feature. */ @@ -5305,8 +5305,8 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -5314,10 +5314,10 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create a dataset in the file. */ if ( pass ) { @@ -5336,10 +5336,10 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -5352,26 +5352,26 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); while ( ( pass ) && ( max_dset < MAX_NUM_DSETS ) ) { - - /* 4) Open the file. + + /* 4) Open the file. * - * Verify that the metadata cache is instructed to load the + * Verify that the metadata cache is instructed to load the * metadata cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -5379,11 +5379,11 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) - HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L1 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp, max_dset, pass); - + /* 5) Create a dataset in the file. */ if ( pass ) { @@ -5402,22 +5402,22 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) - HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L2 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 1, max_dset, pass); - /* 6) Verify and delete the old dataset. */ - if ( pass ) { + /* 6) Verify and delete the old dataset. */ + if ( pass ) { - delete_datasets(file_id, min_dset - 2, max_dset - 2); - } + delete_datasets(file_id, min_dset - 2, max_dset - 2); + } - if ( show_progress ) - HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass); - + /* 7) Close the file. */ if ( pass ) { @@ -5430,27 +5430,27 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } } - if ( show_progress ) - HDfprintf(stdout, "%s:L4 cp = %d, max_dset = %d, pass = %d.\n", + if ( show_progress ) + HDfprintf(stdout, "%s:L4 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 3, max_dset, pass); } /* end while */ cp += 4; - - - /* 8) Open the file. + + + /* 8) Open the file. * - * Verify that the file contains a metadata cache image + * Verify that the file contains a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5458,10 +5458,10 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 9) Verify the last dataset created. */ if ( pass ) { @@ -5481,7 +5481,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5495,22 +5495,22 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) failure_mssg = "H5Fclose() failed.\n"; } } - - - /* 11) Open the file. + + + /* 11) Open the file. * - * Verify that the file doesn't contain a metadata cache image + * Verify that the file doesn't contain a metadata cache image * superblock extension message. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5518,13 +5518,13 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 12) Verify and delete the last dataset. * - * Verify that a metadata cache image is not loaded. + * Verify that a metadata cache image is not loaded. */ if ( pass ) { @@ -5543,7 +5543,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - + /* 13) Close the file. */ @@ -5556,7 +5556,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5567,7 +5567,7 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) * space managers are more or less doing their job. * * Note that in the absence of paged allocation, file - * size gets below 1 KB, but since this test is run both + * size gets below 1 KB, but since this test is run both * with and without paged allocation, we must leave some * extra space for the paged allocation case. */ @@ -5581,9 +5581,9 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 15) Delete the file */ if ( pass ) { @@ -5606,56 +5606,56 @@ cache_image_smoke_check_6(hbool_t single_file_vfd) } /* cache_image_smoke_check_6() */ - + /*------------------------------------------------------------------------- * Function: cache_image_api_error_check_1() * * Purpose: This test is one of a sequence of tests intended - * to verify correct management of API errors. + * to verify correct management of API errors. * - * The object of this test is to verify that a file without - * a pre-existing cache image that is opened both read only - * and with a cache image requested is handle correctly - * (the cache image request should be ignored silently). + * The object of this test is to verify that a file without + * a pre-existing cache image that is opened both read only + * and with a cache image requested is handle correctly + * (the cache image request should be ignored silently). * - * The test is set up as follows: + * The test is set up as follows: * - * 1) Create a HDF5 file. + * 1) Create a HDF5 file. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file read only with a cache image FAPL entry - * requested. + * 4) Open the file read only with a cache image FAPL entry + * requested. * - * 5) Open a dataset. + * 5) Open a dataset. * - * Verify that it contains the expected data + * Verify that it contains the expected data * - * Verify that the cache image was not loaded. + * Verify that the cache image was not loaded. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file read only. + * 7) Open the file read only. * - * 8) Open a dataset. + * 8) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * Verify that the cache image was not loaded. + * Verify that the cache image was not loaded. * - * 9) Close the file. + * 9) Close the file. * - * 10) Open the file read write. + * 10) Open the file read write. * - * 11) Open a dataset. + * 11) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * 12) Close the file. + * 12) Close the file. * - * 13) Delete the file. + * 13) Delete the file. * * Return: void * @@ -5687,7 +5687,7 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5702,7 +5702,7 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5714,8 +5714,8 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5723,10 +5723,10 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -5747,10 +5747,10 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -5763,20 +5763,20 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 4) Open the file read only with a cache image FAPL entry requested. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ TRUE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -5784,10 +5784,10 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open and close a dataset. * * Verify that it contains the expected data. @@ -5811,9 +5811,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -5826,20 +5826,20 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 7) Open the file read only. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -5847,10 +5847,10 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 8) Open and close a dataset. * * Verify that it contains the expected data. @@ -5875,7 +5875,7 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -5890,20 +5890,20 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Open the file read / write. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -5911,9 +5911,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Open and close a dataset. * * Verify that it contains the expected data. @@ -5937,9 +5937,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 12) Close the file. */ @@ -5952,9 +5952,9 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 13) Delete the file */ @@ -5977,68 +5977,68 @@ cache_image_api_error_check_1(hbool_t single_file_vfd) } /* cache_image_api_error_check_1() */ - + /*------------------------------------------------------------------------- * Function: cache_image_api_error_check_2() * * Purpose: This test is one of a sequence of tests intended - * to verify correct management of API errors. + * to verify correct management of API errors. * - * The object of this test is to verify that a file with - * a pre-existing cache image that is opened both read only - * and with a cache image requested is handled correctly - * (the cache image request should be ignored silently). + * The object of this test is to verify that a file with + * a pre-existing cache image that is opened both read only + * and with a cache image requested is handled correctly + * (the cache image request should be ignored silently). * - * The test is set up as follows: + * The test is set up as follows: * - * 1) Create a HDF5 file with a cache image requested.. + * 1) Create a HDF5 file with a cache image requested.. * - * 2) Create some datasets in the file. + * 2) Create some datasets in the file. * - * 3) Close the file. + * 3) Close the file. * - * 4) Open the file read only with a cache image FAPL entry - * requested. + * 4) Open the file read only with a cache image FAPL entry + * requested. * - * 5) Open a dataset. + * 5) Open a dataset. * - * Verify that it contains the expected data + * Verify that it contains the expected data * - * Verify that the cache image was loaded. + * Verify that the cache image was loaded. * - * 6) Close the file. + * 6) Close the file. * - * 7) Open the file read only. + * 7) Open the file read only. * - * 8) Open a dataset. + * 8) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * Verify that the cache image was loaded. + * Verify that the cache image was loaded. * - * 9) Close the file. + * 9) Close the file. * - * 10) Open the file read write. + * 10) Open the file read write. * - * 11) Open a dataset. + * 11) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * Verify that the cache image was loaded. + * Verify that the cache image was loaded. * - * 12) Close the file. + * 12) Close the file. * - * 13) Open the file read write. + * 13) Open the file read write. * - * 14) Open a dataset. + * 14) Open a dataset. * - * Verify that it contains the expected data. + * Verify that it contains the expected data. * - * Verify that the cache image was NOT loaded. + * Verify that the cache image was NOT loaded. * - * 15) Close the file. + * 15) Close the file. * - * 16) Delete the file. + * 16) Delete the file. * * Return: void * @@ -6070,7 +6070,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6085,7 +6085,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6097,8 +6097,8 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6106,10 +6106,10 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Create some datasets in the file. */ if ( pass ) { @@ -6130,10 +6130,10 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 3) Close the file. */ if ( pass ) { @@ -6146,20 +6146,20 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 4) Open the file read only with a cache image FAPL entry requested. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6167,10 +6167,10 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open and close a dataset. * * Verify that it contains the expected data. @@ -6194,9 +6194,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Close the file. */ @@ -6209,20 +6209,20 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 7) Open the file read only. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ 0, /* file_id_ptr */ &file_id, @@ -6230,10 +6230,10 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 8) Open and close a dataset. * * Verify that it contains the expected data. @@ -6258,7 +6258,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6273,20 +6273,20 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Open the file read / write. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ TRUE, + /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6294,9 +6294,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Open and close a dataset. * * Verify that it contains the expected data. @@ -6320,9 +6320,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 12) Close the file. */ @@ -6335,7 +6335,7 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6344,11 +6344,11 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6356,9 +6356,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 14) Open and close a dataset. * * Verify that it contains the expected data. @@ -6382,9 +6382,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 15) Close the file. */ @@ -6397,9 +6397,9 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 13) Delete the file */ @@ -6422,36 +6422,36 @@ cache_image_api_error_check_2(hbool_t single_file_vfd) } /* cache_image_api_error_check_2() */ - + /*------------------------------------------------------------------------- * Function: cache_image_api_error_check_3() * * Purpose: This test is one of a sequence of tests intended - * to verify correct management of API errors. + * to verify correct management of API errors. * - * At present, SWMR and cache image may not be active - * at the same time. The purpose of this test is to - * verify that attempts to run SWMR and cache image - * at the same time will fail. + * At present, SWMR and cache image may not be active + * at the same time. The purpose of this test is to + * verify that attempts to run SWMR and cache image + * at the same time will fail. * - * The test is set up as follows: + * The test is set up as follows: * - * 1) Create a HDF5 file with a cache image requested.. + * 1) Create a HDF5 file with a cache image requested.. * - * 2) Try to start SWMR write -- should fail. + * 2) Try to start SWMR write -- should fail. * * 3) Discard the file if necessary * - * 4) Attempt to create a HDF5 file with SWMR write - * access and cache image requested -- should fail. + * 4) Attempt to create a HDF5 file with SWMR write + * access and cache image requested -- should fail. * * 5) Discard the file if necessary * * 6) Create a HDF5 file with a cache image requested. * - * 7) Create some datasets in the file. + * 7) Create some datasets in the file. * - * 8) Close the file. + * 8) Close the file. * * 9) Attempt to open the file with SWMR write access -- * should fail. @@ -6488,7 +6488,7 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6503,7 +6503,7 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6515,8 +6515,8 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6524,9 +6524,9 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 2) Try to start SWMR write -- should fail. */ @@ -6541,9 +6541,9 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } H5E_END_TRY; } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 3) Discard the file if necessary */ @@ -6563,19 +6563,19 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 4) Attempt to create a HDF5 file with SWMR write + + /* 4) Attempt to create a HDF5 file with SWMR write * access and cache image requested -- should fail. */ - + attempt_swmr_open_hdf5_file(/* create_file */ TRUE, - /* set_mdci_fapl */ TRUE, + /* set_mdci_fapl */ TRUE, /* hdf_file_name */ filename); - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6583,16 +6583,16 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) if ( pass ) { - /* file probably doesn't exist, so don't + /* file probably doesn't exist, so don't * error check the remove call. */ HDremove(filename); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Create a HDF5 file with a cache image requested. */ if ( pass ) { @@ -6601,8 +6601,8 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6610,10 +6610,10 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Create some datasets in the file. */ if ( pass ) { @@ -6632,9 +6632,9 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 8) Close the file. */ @@ -6648,20 +6648,20 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 9) Attempt to open the file with SWMR write access -- should fail. */ - + attempt_swmr_open_hdf5_file(/* create_file */ FALSE, - /* set_mdci_fapl */ TRUE, + /* set_mdci_fapl */ TRUE, /* hdf_file_name */ filename); - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Discard the file if necessary. */ if ( pass ) { @@ -6673,7 +6673,7 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6687,67 +6687,67 @@ cache_image_api_error_check_3(hbool_t single_file_vfd) } /* cache_image_api_error_check_3() */ - + /*------------------------------------------------------------------------- * Function: cache_image_api_error_check_4() * * Purpose: This test is one of a sequence of tests intended - * to verify correct management of API errors. + * to verify correct management of API errors. + * + * The object of this test is to verify that a request for + * a cache image when a version 2 superblock is not available/ + * not requested is handled correctly. + * (the cache image request should be ignored silently). * - * The object of this test is to verify that a request for - * a cache image when a version 2 superblock is not available/ - * not requested is handled correctly. - * (the cache image request should be ignored silently). + * The test is set up as follows: * - * The test is set up as follows: + * 1) Create a FAPL requesting a cache image, but WITHOUT + * specifying the latest file format. * - * 1) Create a FAPL requesting a cache image, but WITHOUT - * specifying the latest file format. + * 2) Create a HDF5 file using the above FAPL. * - * 2) Create a HDF5 file using the above FAPL. + * 3) Create some datasets in the file. * - * 3) Create some datasets in the file. + * 4) Close the file. * - * 4) Close the file. + * 5) Open the file read only. Verify that the file doesn't + * contain a cache image. * - * 5) Open the file read only. Verify that the file doesn't - * contain a cache image. + * 6) Verify that the datasets exist and contain the + * expected data * - * 6) Verify that the datasets exist and contain the - * expected data + * Verify that the cache image was not loaded. * - * Verify that the cache image was not loaded. + * 7) Close the file. * - * 7) Close the file. + * 8) Open the file R/W using the FAPL defined in 1) above. + * Verify that the file does not contain a cache image. * - * 8) Open the file R/W using the FAPL defined in 1) above. - * Verify that the file does not contain a cache image. + * 9) Close the file. * - * 9) Close the file. + * 10) Open the file R/W using the FAPL defined in 1) above. + * Verify that the file does not contain a cache image. * - * 10) Open the file R/W using the FAPL defined in 1) above. - * Verify that the file does not contain a cache image. + * 11) Verify that the data sets contain the expected data * - * 11) Verify that the data sets contain the expected data + * Verify that a cache image was not loaded. * - * Verify that a cache image was not loaded. + * 12) Create several more data sets. * - * 12) Create several more data sets. + * 13) Close the file. * - * 13) Close the file. + * 14) Open the file read write. * - * 14) Open the file read write. - * - * Verify that the file does not contain a cache image. + * Verify that the file does not contain a cache image. * - * 15) Verify the data sets exist and contain the expected - * data. + * 15) Verify the data sets exist and contain the expected + * data. * - * Verify that a cache image was not loaded. + * Verify that a cache image was not loaded. * - * 16) Close the file. + * 16) Close the file. * - * 17) Delete the file. + * 17) Delete the file. * * Return: void * @@ -6781,7 +6781,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6796,11 +6796,11 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 1) Create a FAPL requesting a cache image, but WITHOUT - * specifying the latest file format. + /* 1) Create a FAPL requesting a cache image, but WITHOUT + * specifying the latest file format. */ if ( pass ) { @@ -6813,7 +6813,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -6831,7 +6831,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -6859,7 +6859,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* get a pointer to the files internal data structure and then @@ -6878,10 +6878,10 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 3) Create some datasets in the file. */ if ( pass ) { @@ -6902,10 +6902,10 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 4) Close the file. */ if ( pass ) { @@ -6918,20 +6918,20 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 5) Open the file read only. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -6939,11 +6939,11 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 6) Verify that the datasets exist and contain the + + + /* 6) Verify that the datasets exist and contain the * expected data */ @@ -6963,9 +6963,9 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Close the file. */ @@ -6978,11 +6978,11 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - - /* 8) Open the file R/W using the FAPL defined in 1) above. + + + /* 8) Open the file R/W using the FAPL defined in 1) above. * * Verify that the file does not contain a cache image. */ @@ -7009,7 +7009,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* get a pointer to the files internal data structure and then @@ -7028,7 +7028,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7041,7 +7041,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7056,9 +7056,9 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Open the file R/W using the FAPL defined in 1) above. @@ -7087,7 +7087,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* get a pointer to the files internal data structure and then @@ -7106,7 +7106,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7119,7 +7119,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7144,7 +7144,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7155,7 +7155,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) create_datasets(file_id, 6, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7170,23 +7170,23 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 14) Open the file read write. - * + * * Verify that the file does not contain a cache image. */ if ( pass ) { open_hdf5_file(/* create_file */ FALSE, - /* mdci_sbem_expected */ FALSE, + /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7194,10 +7194,10 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - + + /* 15) Verify the data sets exist and contain the expected data. * * Verify that a cache image was not loaded. @@ -7219,7 +7219,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } #endif /* H5C_COLLECT_CACHE_STATS */ - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7234,9 +7234,9 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 17) Delete the file */ @@ -7249,7 +7249,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7268,36 +7268,36 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) } /* cache_image_api_error_check_4() */ - + /*------------------------------------------------------------------------- * Function: get_free_sections_test() * * Purpose: It is possible that H5Fget_free_sections() to be - * called before any activity on the metadata cache. - * This is a potential problem, as satisfying the - * H5Fget_free_sections() call requires access to all - * free space managers. When persistent free space + * called before any activity on the metadata cache. + * This is a potential problem, as satisfying the + * H5Fget_free_sections() call requires access to all + * free space managers. When persistent free space * managers are enabled, this will require calling - * H5MF_tidy_self_referential_fsm_hack(). This is a + * H5MF_tidy_self_referential_fsm_hack(). This is a * non issue in the absence of a cache image. However, - * this is a problem if a cache image exists, as - * the call to H5MF_tidy_self_referential_fsm_hack() - * will free the file space allocated to the cache - * image. - * - * The objective of this test is to create a test file - * with both non-empty self referential presistant - * free space managers, and a cache image, and then - * verify that this situation is handled correctly if + * this is a problem if a cache image exists, as + * the call to H5MF_tidy_self_referential_fsm_hack() + * will free the file space allocated to the cache + * image. + * + * The objective of this test is to create a test file + * with both non-empty self referential presistant + * free space managers, and a cache image, and then + * verify that this situation is handled correctly if * H5Fget_free_sections() is called before the metadata * cache image is loaded. * - * The test is set up as follows: + * The test is set up as follows: * - * 1) Create a HDF5 file with a cache image requested - * and persistent free space managers enabled. + * 1) Create a HDF5 file with a cache image requested + * and persistent free space managers enabled. * - * 2) Create some data sets, and then delete some of + * 2) Create some data sets, and then delete some of * of those near the beginning of the file. * * 3) Close the file. @@ -7308,12 +7308,12 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) * been loaded. * * 6) Verify that one or more self referential FSMs - * have been stored at the end of the file just + * have been stored at the end of the file just * before the cache image. * * 7) Call H5Fget_free_sections(). * - * 8) Verify that the cache image has been loaded and + * 8) Verify that the cache image has been loaded and * that the self referential FSMs have been floated. * * 9) Verify that the remaining data sets contain the @@ -7327,12 +7327,12 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) * been loaded. * * 13) Verify that one or more self referential FSMs - * have been stored at the end of the file just + * have been stored at the end of the file just * before the cache image. * * 14) Call H5Fget_free_sections(). * - * 15) Verify that the cache image has been loaded and + * 15) Verify that the cache image has been loaded and * that the self referential FSMs have been floated. * * 16) Verify that the remaining data sets contain the @@ -7340,7 +7340,7 @@ cache_image_api_error_check_4(hbool_t single_file_vfd) * * 17) Delete the remaining data sets. * - * 18) Close the file. + * 18) Close the file. * * 19) Verify that file space has been reclaimed. * @@ -7376,7 +7376,7 @@ get_free_sections_test(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7391,12 +7391,12 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 1) Create a HDF5 file with a cache image requested - * and persistent free space managers enabled. + * and persistent free space managers enabled. */ if ( pass ) { @@ -7405,8 +7405,8 @@ get_free_sections_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7414,11 +7414,11 @@ get_free_sections_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - /* 2) Create some data sets, and then delete some of + /* 2) Create some data sets, and then delete some of * of those near the beginning of the file. */ @@ -7427,7 +7427,7 @@ get_free_sections_test(hbool_t single_file_vfd) create_datasets(file_id, 1, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7435,7 +7435,7 @@ get_free_sections_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7443,10 +7443,10 @@ get_free_sections_test(hbool_t single_file_vfd) delete_datasets(file_id, 1, 5); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 3) Close the file. */ if ( pass ) { @@ -7459,10 +7459,10 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 4) Open the file read only. */ if ( pass ) { @@ -7471,8 +7471,8 @@ get_free_sections_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7480,10 +7480,10 @@ get_free_sections_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 5) Verify that a cache image exists, and has not been loaded. */ if ( pass ) { @@ -7496,18 +7496,18 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Verify that one or more self referential FSMs - * have been stored at the end of the file just + * have been stored at the end of the file just * before the cache image. */ if ( pass ) { - /* file_ptr->shared->first_alloc_dealloc is set to FALSE if the + /* file_ptr->shared->first_alloc_dealloc is set to FALSE if the * file is opened R/O. */ if ( ( ! H5F_addr_defined(file_ptr->shared->eoa_fsm_fsalloc) ) || @@ -7520,15 +7520,15 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Call H5Fget_free_sections(). */ if ( pass ) { - if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) + if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) < 0 ){ pass = FALSE; @@ -7536,11 +7536,11 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 8) Verify that the cache image has been loaded and + + /* 8) Verify that the cache image has been loaded and * that the self referential FSMs have been floated. */ if ( pass ) { @@ -7550,11 +7550,11 @@ get_free_sections_test(hbool_t single_file_vfd) pass = FALSE; failure_mssg = "cache image not loaded (1).\n"; - } + } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7565,10 +7565,10 @@ get_free_sections_test(hbool_t single_file_vfd) verify_datasets(file_id, 6, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 10) Close the file. */ if ( pass ) { @@ -7580,10 +7580,10 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Open the file R/W. */ if ( pass ) { @@ -7592,8 +7592,8 @@ get_free_sections_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7601,10 +7601,10 @@ get_free_sections_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 12) Verify that a cache image exists, and has not been loaded. */ if ( pass ) { @@ -7617,12 +7617,12 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 13) Verify that one or more self referential FSMs - * have been stored at the end of the file just + * have been stored at the end of the file just * before the cache image. */ if ( pass ) { @@ -7637,15 +7637,15 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 14) Call H5Fget_free_sections(). */ if ( pass ) { - if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) + if ( H5Fget_free_sections(file_id, H5FD_MEM_DEFAULT, (size_t)0, NULL) < 0 ){ pass = FALSE; @@ -7653,11 +7653,11 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - - /* 15) Verify that the cache image has been loaded and + + /* 15) Verify that the cache image has been loaded and * that the self referential FSMs have been floated. */ if ( pass ) { @@ -7667,11 +7667,11 @@ get_free_sections_test(hbool_t single_file_vfd) pass = FALSE; failure_mssg = "cache image not loaded (2).\n"; - } + } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7682,10 +7682,10 @@ get_free_sections_test(hbool_t single_file_vfd) verify_datasets(file_id, 6, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 17) Delete the remaining data sets. */ if ( pass ) { @@ -7693,10 +7693,10 @@ get_free_sections_test(hbool_t single_file_vfd) delete_datasets(file_id, 6, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 18) Close the file. */ if ( pass ) { @@ -7708,7 +7708,7 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7728,10 +7728,10 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 20) Discard the file. */ if ( pass ) { @@ -7743,7 +7743,7 @@ get_free_sections_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -7756,40 +7756,40 @@ get_free_sections_test(hbool_t single_file_vfd) } /* get_free_sections_test() */ - + /*------------------------------------------------------------------------- * Function: evict_on_close_test() * - * Purpose: If a file containing a cache image which in turn - * contains dirty entries is opened R/O, the metadata - * cache must refuse to evict the dirty entries, as + * Purpose: If a file containing a cache image which in turn + * contains dirty entries is opened R/O, the metadata + * cache must refuse to evict the dirty entries, as * it will not be able to reload them from file. This * is a bit tricky, as the dirty entries must marked as - * clean in the metadata cache so that the MDC will not + * clean in the metadata cache so that the MDC will not * attempt to flush then on file close. * - * The objective of this test is to verify that the + * The objective of this test is to verify that the * metadata will not evict dirty entries in the above * context when the file is opened with the evict on close * FAPL entry. * - * Do this by creating a HDF5 file with a cache image - * containing dirty metadata. + * Do this by creating a HDF5 file with a cache image + * containing dirty metadata. * - * Then close the file, re-open it R/O, and scan its + * Then close the file, re-open it R/O, and scan its * contents twice. If evict on close succeeds in evicting - * the dirty metadata, the second scan will fail, as valid + * the dirty metadata, the second scan will fail, as valid * versions of the dirty metadata will not be available. * - * To make the test more useful, enable persistent free + * To make the test more useful, enable persistent free * space managers. * - * The test is set up as follows: + * The test is set up as follows: * - * 1) Create a HDF5 file without a cache image requested - * and persistent free space managers enabled. + * 1) Create a HDF5 file without a cache image requested + * and persistent free space managers enabled. * - * 2) Create some data sets and verify them. + * 2) Create some data sets and verify them. * * 3) Close the file. * @@ -7855,7 +7855,7 @@ evict_on_close_test(hbool_t single_file_vfd) pass = TRUE; - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7870,12 +7870,12 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); /* 1) Create a HDF5 file without a cache image requested - * and persistent free space managers enabled. + * and persistent free space managers enabled. */ if ( pass ) { @@ -7883,8 +7883,8 @@ evict_on_close_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ TRUE, - /* set_eoc */ FALSE, + /* config_fsm */ TRUE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7892,7 +7892,7 @@ evict_on_close_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7903,7 +7903,7 @@ evict_on_close_test(hbool_t single_file_vfd) create_datasets(file_id, 1, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7911,10 +7911,10 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 3) Close the file. */ if ( pass ) { @@ -7927,10 +7927,10 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 4) Open the file R/W, and with cache image requested. */ if ( pass ) { @@ -7939,8 +7939,8 @@ evict_on_close_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ FALSE, /* read_only */ FALSE, /* set_mdci_fapl */ TRUE, - /* config_fsm */ FALSE, - /* set_eoc */ FALSE, + /* config_fsm */ FALSE, + /* set_eoc */ FALSE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -7948,7 +7948,7 @@ evict_on_close_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -7962,10 +7962,10 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 10); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 6) Create some more datasets and verify them */ if ( pass ) { @@ -7973,7 +7973,7 @@ evict_on_close_test(hbool_t single_file_vfd) create_datasets(file_id, 11, 20); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -7986,15 +7986,15 @@ evict_on_close_test(hbool_t single_file_vfd) HDassert(cache_ptr); HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDfprintf(stdout, "index size / index dirty size = %lld / %lld\n", + HDfprintf(stdout, "index size / index dirty size = %lld / %lld\n", (long long)(cache_ptr->index_size), (long long)(cache_ptr->dirty_index_size)); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 7) Close the file. */ if ( pass ) { @@ -8006,10 +8006,10 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 8) Open the file R/O and with evict on close enabled. */ if ( pass ) { @@ -8018,8 +8018,8 @@ evict_on_close_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ TRUE, /* read_only */ TRUE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ TRUE, + /* config_fsm */ FALSE, + /* set_eoc */ TRUE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -8027,7 +8027,7 @@ evict_on_close_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -8038,7 +8038,7 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 20); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -8046,7 +8046,7 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 20); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -8061,10 +8061,10 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); - + /* 11) Open the file R/w and with evict on close enabled. */ if ( pass ) { @@ -8073,8 +8073,8 @@ evict_on_close_test(hbool_t single_file_vfd) /* mdci_sbem_expected */ TRUE, /* read_only */ FALSE, /* set_mdci_fapl */ FALSE, - /* config_fsm */ FALSE, - /* set_eoc */ TRUE, + /* config_fsm */ FALSE, + /* set_eoc */ TRUE, /* hdf_file_name */ filename, /* cache_image_flags */ H5C_CI__ALL_FLAGS, /* file_id_ptr */ &file_id, @@ -8082,7 +8082,7 @@ evict_on_close_test(hbool_t single_file_vfd) /* cache_ptr_ptr */ &cache_ptr); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -8093,7 +8093,7 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 20); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { @@ -8101,7 +8101,7 @@ evict_on_close_test(hbool_t single_file_vfd) verify_datasets(file_id, 1, 20); } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -8116,7 +8116,7 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); @@ -8131,7 +8131,7 @@ evict_on_close_test(hbool_t single_file_vfd) } } - if ( show_progress ) + if ( show_progress ) HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass); if ( pass ) { PASSED(); } else { H5_FAILED(); } @@ -8145,7 +8145,7 @@ evict_on_close_test(hbool_t single_file_vfd) } /* evict_on_close_test() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -8177,10 +8177,10 @@ main(void) express_test = GetTestExpress(); - printf("=========================================\n"); - printf("Cache image tests\n"); - printf(" express_test = %d\n", express_test); - printf("=========================================\n"); + HDprintf("=========================================\n"); + HDprintf("Cache image tests\n"); + HDprintf(" express_test = %d\n", express_test); + HDprintf("=========================================\n"); /* Check for VFD which stores data in multiple files */ single_file_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")); diff --git a/test/cache_tagging.c b/test/cache_tagging.c index dd886eb..7ce4e88 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -15,7 +15,7 @@ * * This file contains tests for metadata tagging. */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" @@ -47,7 +47,7 @@ #define TEST_DEFAULT 0 #define TEST_SHMESG 1 #define NUM_TEST_TYPES 2 - + /* ===================== */ /* Function Declarations */ /* ===================== */ @@ -98,7 +98,7 @@ static unsigned check_invalid_tag_application(void); #ifndef NDEBUG - + /*------------------------------------------------------------------------- * Function: dump_cache() * @@ -127,19 +127,19 @@ static int dump_cache(hid_t fid) TEST_ERROR; return 0; - + error: return -1; } /* dump_cache */ #endif /* NDEBUG */ /* end debugging functions */ - + /*------------------------------------------------------------------------- * Function: verify_no_unknown_tags() * * Purpose: Verifies that all tags in the provided cache have the - * 'dirtied' flag set. Other verification functions in this - * test file set this flag after checking them, so + * 'dirtied' flag set. Other verification functions in this + * test file set this flag after checking them, so * this is handy to verify that tests have checked all entries * in the cache. * @@ -181,7 +181,7 @@ error: return -1; } /* verify_no_unknown_tags */ - + /*------------------------------------------------------------------------- * Function: mark_all_entries_investigated() * @@ -229,7 +229,7 @@ error: return -1; } /* mark_all_entries_investigated */ - + /*------------------------------------------------------------------------- * Function: reset_all_entries_investigated() * @@ -275,15 +275,15 @@ error: return -1; } /* reset_all_entries_investigated */ - + /*------------------------------------------------------------------------- * Function: verify_tag() * * Purpose: Asserts that there is an entry in the specified cache with * the provided entry id and provided tag. The function will - * fail if this is not the case. If found, this function will - * set the entry's flush_marker flag, so future verification - * attempts can skip over this entry, knowing it has already been + * fail if this is not the case. If found, this function will + * set the entry's flush_marker flag, so future verification + * attempts can skip over this entry, knowing it has already been * checked. * * Return: 0 on Success, -1 on Failure @@ -327,7 +327,7 @@ verify_tag(hid_t fid, int id, haddr_t tag) /* Didn't find the tagged entry, throw an error */ TEST_ERROR; - + done: return 0; @@ -358,7 +358,7 @@ error: return -1; } /* evict entries */ - + /*------------------------------------------------------------------------- * Function: get_object_header_tag() * @@ -389,7 +389,7 @@ error: return -1; } /* get_object_header_tag */ - + /*------------------------------------------------------------------------- * Function: get_sbe_tag() * @@ -420,7 +420,7 @@ error: /* Test Functions */ /* ============== */ - + /*------------------------------------------------------------------------- * Function: check_file_creation_tags * @@ -434,7 +434,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_file_creation_tags(hid_t fcpl_id, int type) { /* Variable Declarations */ @@ -507,7 +507,7 @@ error: return 1; } /* check_file_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_file_open_tags * @@ -521,7 +521,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_file_open_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -551,12 +551,12 @@ check_file_open_tags(hid_t fcpl, int type) /* Retrieve various tags */ if ( type == TEST_SHMESG ) { - + /* determine tag value of superblock extension object header */ if ( get_sbe_tag(fid, &sbe_tag) < 0 ) TEST_ERROR; } /* end if */ - + /* Close the file */ if ( H5Fclose(fid) < 0 ) TEST_ERROR; @@ -619,7 +619,7 @@ error: return 1; } /* check_file_open_tags */ - + /*------------------------------------------------------------------------- * Function: check_group_creation_tags * @@ -633,7 +633,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_group_creation_tags(void) { /* Variable Declarations */ @@ -646,7 +646,7 @@ check_group_creation_tags(void) /* Testing Macro */ TESTING("tag application during group creation"); - + /* ===== */ /* Setup */ /* ===== */ @@ -683,7 +683,7 @@ check_group_creation_tags(void) /* if verbose, print cache index to screen for visual verification */ if ( verbose ) dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - + /* Verify root group's tagged metadata */ if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_SNODE_ID, root_tag) < 0 ) TEST_ERROR; @@ -720,7 +720,7 @@ error: return 1; } /* check_group_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_multi_group_creation_tags * @@ -734,7 +734,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_multi_group_creation_tags(void) { /* Variable Declarations */ @@ -774,7 +774,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { - sprintf(gname, "%d", i); + HDsprintf(gname, "%d", i); if ( (gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( H5Gclose(gid) < 0 ) TEST_ERROR; @@ -793,7 +793,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { /* Re-open the group */ - sprintf(gname, "%d", i); + HDsprintf(gname, "%d", i); if ( (gid = H5Gopen2(fid, gname, H5P_DEFAULT)) < 0 ) TEST_ERROR; /* Verify object header for root group */ @@ -848,7 +848,7 @@ error: return 1; } /* check_multi_group_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_link_iteration_tags * @@ -862,7 +862,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_link_iteration_tags(void) { /* Variable Declarations */ @@ -899,7 +899,7 @@ check_link_iteration_tags(void) /* Create many datasets in root group */ for (i=0;i<500;i++) { - sprintf(dsetname, "Dset %d", i); + HDsprintf(dsetname, "Dset %d", i); if ( (did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( H5Dclose(did) < 0 ) TEST_ERROR; } @@ -966,7 +966,7 @@ error: return 1; } /* check_link_iteration_tags */ - + /*------------------------------------------------------------------------- * Function: check_dense_attribute_tags * @@ -980,7 +980,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dense_attribute_tags(void) { /* Variable Declarations */ @@ -994,7 +994,7 @@ check_dense_attribute_tags(void) hid_t fapl = -1; /* File access property list */ haddr_t d_tag = 0; /* Dataset tag value */ haddr_t root_tag = 0; /* Root group tag value */ - char attrname[500]; /* Name of attribute */ + char attrname[500]; /* Name of attribute */ /* Testing Macro */ TESTING("tag application during dense attribute manipulation"); @@ -1022,10 +1022,10 @@ check_dense_attribute_tags(void) /* Create dataset */ if ( (did = H5Dcreate2(fid, DATASETNAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( H5Pclose(dcpl) < 0 ) TEST_ERROR; - + /* get dataset object header */ if ( get_object_header_tag(did, &d_tag) < 0 ) TEST_ERROR; - + /* Clear Metadata Tags (don't care about them for this test */ mark_all_entries_investigated(fid); @@ -1035,7 +1035,7 @@ check_dense_attribute_tags(void) for (i=0;i<50;i++) { - sprintf(attrname, "attr %d", i); + HDsprintf(attrname, "attr %d", i); if ( (aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0 ) TEST_ERROR; if ( H5Aclose(aid) < 0 ) TEST_ERROR; @@ -1151,7 +1151,7 @@ error: return 1; } /* check_dense_attribute_tags */ - + /*------------------------------------------------------------------------- * Function: check_group_open_tags * @@ -1165,7 +1165,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_group_open_tags(void) { /* Variable Declarations */ @@ -1178,7 +1178,7 @@ check_group_open_tags(void) /* Testing Macro */ TESTING("tag application during group open"); - + /* ===== */ /* Setup */ /* ===== */ @@ -1258,7 +1258,7 @@ error: return 1; } /* check_group_open_tags */ - + /*------------------------------------------------------------------------- * Function: check_attribute_creation_tags * @@ -1272,7 +1272,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_attribute_creation_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -1349,7 +1349,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* verify shared message index tagged with sohm */ if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - + /* verify fractal heap header belonging to group */ if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; @@ -1368,7 +1368,7 @@ check_attribute_creation_tags(hid_t fcpl, int type) /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; - + /* Reset the changes we've made to the cache's data structures */ if(reset_all_entries_investigated(fid) < 0) TEST_ERROR; @@ -1392,7 +1392,7 @@ error: return 1; } /* check_attribute_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_attribute_open_tags * @@ -1406,7 +1406,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_attribute_open_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -1483,7 +1483,7 @@ check_attribute_open_tags(hid_t fcpl, int type) /* verify object header chunk belonging to group */ if ( verify_tag(fid, H5AC_OHDR_CHK_ID, g_tag) < 0 ) TEST_ERROR; - + if ( type == TEST_SHMESG ) { /* verify (another) object header chunk belonging to group */ @@ -1529,7 +1529,7 @@ error: return 1; } /* check_attribute_open_tags */ - + /*------------------------------------------------------------------------- * Function: check_attribute_rename_tags * @@ -1543,7 +1543,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_attribute_rename_tags(hid_t fcpl, int type) { /* Variable declarations */ @@ -1597,7 +1597,7 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Create attribute */ if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; - + /* fill out data buffer */ for(i = 0; i < DIMS; i++) for(j = 0; j < DIMS; j++) @@ -1663,9 +1663,9 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* verify shared header message stored as a list */ if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - /* - * one freespace header tag for H5FD_MEM_DRAW manager, - * one freespace header tag for H5FD_MEM_SUPER manager + /* + * one freespace header tag for H5FD_MEM_DRAW manager, + * one freespace header tag for H5FD_MEM_SUPER manager */ if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; @@ -1704,7 +1704,7 @@ error: return 1; } /* check_attribute_rename_tags */ - + /*------------------------------------------------------------------------- * Function: check_attribute_delete_tags * @@ -1718,7 +1718,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_attribute_delete_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -1772,7 +1772,7 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* Create attribute */ if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; - + /* fill out data buffer */ for(i = 0;i < DIMS; i++) for(j = 0;j < DIMS; j++) @@ -1810,33 +1810,33 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* verify object header belonging to group */ if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; - + if ( type == TEST_SHMESG ) { /* verify shared header message master table */ if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - /* - * 2 calls to verify_tag() for verifying free space: + /* + * 2 calls to verify_tag() for verifying free space: * one freespace header tag for free-space header raw data * one freespace header tag for free-space section info raw data * one freespace header tag for free-space header metadata */ - if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; - if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) + if ( verify_tag(fid, H5AC_FSPACE_SINFO_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; - if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) + if ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) TEST_ERROR; #if 0 - /* If the free space managers are persistent, the + /* If the free space managers are persistent, the * H5MF_tidy_self_referential_fsm_hack() must have been run. - * Since this function floats all self referential free space - * managers, the H5FD_MEM_SUPER FSM will not be in the metadata + * Since this function floats all self referential free space + * managers, the H5FD_MEM_SUPER FSM will not be in the metadata * cache. */ - if ( ( ! persistent_fsms ) && + if ( ( ! persistent_fsms ) && ( verify_tag(fid, H5AC_FSPACE_HDR_ID, H5AC__FREESPACE_TAG) < 0 ) ) TEST_ERROR; #endif @@ -1871,7 +1871,7 @@ error: return 1; } /* check_attribute_delete_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_creation_tags * @@ -1885,7 +1885,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_creation_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -1929,10 +1929,10 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* ============================ */ /* Create Dataset in Root Group */ /* ============================ */ - + /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -1974,7 +1974,7 @@ check_dataset_creation_tags(hid_t fcpl, int type) /* Verify dataset's tagged metadata */ if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - + /* Verify shared object header message tags */ if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; @@ -2004,7 +2004,7 @@ error: return 1; } /* check_dataset_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_creation_earlyalloc_tags * @@ -2018,7 +2018,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -2107,7 +2107,7 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type) /* Verify dataset's tagged metadata */ if ( verify_tag(fid, H5AC_FHEAP_HDR_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; - + /* Verify shared object header message tags */ if ( verify_tag(fid, H5AC_SOHM_LIST_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; @@ -2141,7 +2141,7 @@ error: return 1; } /* check_dataset_creation_earlyalloc_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_open_tags * @@ -2155,7 +2155,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_open_tags(void) { /* Variable Declarations */ @@ -2192,7 +2192,7 @@ check_dataset_open_tags(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -2222,7 +2222,7 @@ check_dataset_open_tags(void) /* ========================== */ /* Open Dataset in Root Group */ /* ========================== */ - + if (( did = H5Dopen2(fid, DATASETNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; /* =================================== */ @@ -2267,7 +2267,7 @@ error: return 1; } /* check_dataset_open_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_write_tags * @@ -2281,7 +2281,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_write_tags(void) { /* Variable Declarations */ @@ -2323,7 +2323,7 @@ check_dataset_write_tags(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -2372,7 +2372,7 @@ check_dataset_write_tags(void) /* if verbose, print cache index to screen for visual verification */ if ( verbose ) dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - + /* Verify 10 b-tree nodes belonging to dataset */ for (i=0; i<10; i++) if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; @@ -2408,7 +2408,7 @@ error: return 1; } /* check_dataset_write_tags */ - + /*------------------------------------------------------------------------- * Function: check_attribute_write_tags * @@ -2422,7 +2422,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_attribute_write_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -2503,7 +2503,7 @@ check_attribute_write_tags(hid_t fcpl, int type) /* if verbose, print cache index to screen for visual verification */ if ( verbose ) dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - + /* Verify object header of group */ if ( verify_tag(fid, H5AC_OHDR_ID, g_tag) < 0 ) TEST_ERROR; @@ -2562,7 +2562,7 @@ error: return 1; } /* check_attribute_write_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_read_tags * @@ -2576,7 +2576,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_read_tags(void) { /* Variable Declarations */ @@ -2618,7 +2618,7 @@ check_dataset_read_tags(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -2666,7 +2666,7 @@ check_dataset_read_tags(void) /* if verbose, print cache index to screen for visual verification */ if ( verbose ) dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - + /* Verify 19 b-tree nodes belonging to dataset */ for (i=0; i<19; i++) if ( verify_tag(fid, H5AC_BT_ID, d_tag) < 0 ) TEST_ERROR; @@ -2699,7 +2699,7 @@ error: return 1; } /* check_dataset_read_tags */ - + /*------------------------------------------------------------------------- * Function: check_dataset_size_retrieval * @@ -2713,7 +2713,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_size_retrieval(void) { /* Variable Declarations */ @@ -2756,7 +2756,7 @@ check_dataset_size_retrieval(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -2837,7 +2837,7 @@ error: return 1; } /* check_dataset_size_retrieval */ - + /*------------------------------------------------------------------------- * Function: check_dataset_extend_tags * @@ -2851,7 +2851,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_dataset_extend_tags(void) { @@ -2895,7 +2895,7 @@ check_dataset_extend_tags(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -2976,7 +2976,7 @@ error: return 1; } /* check_dataset_extend_tags */ - + /*------------------------------------------------------------------------- * Function: check_object_info_tags * @@ -2990,7 +2990,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_object_info_tags(void) { /* Variable Declarations */ @@ -3000,7 +3000,7 @@ check_object_info_tags(void) hid_t fapl = -1; /* File access prop list */ haddr_t root_tag = HADDR_UNDEF; haddr_t g_tag; - H5O_info_t oinfo; /* Object info struct */ + H5O_info_t oinfo; /* Object info struct */ /* Testing Macro */ TESTING("tag application during object info retrieval"); @@ -3085,7 +3085,7 @@ error: return 1; } /* check_object_info_tags */ - + /*------------------------------------------------------------------------- * Function: check_object_copy_tags * @@ -3099,7 +3099,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_object_copy_tags(void) { /* Variable Declarations */ @@ -3155,7 +3155,7 @@ check_object_copy_tags(void) if ( (gid = H5Gopen2(fid, GROUPNAMECOPY, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( get_object_header_tag(gid, ©_tag) < 0 ) TEST_ERROR; if (H5Gclose(gid) < 0) TEST_ERROR; - + /* =================================== */ /* Verification of Metadata Tag Values */ /* =================================== */ @@ -3204,7 +3204,7 @@ error: return 1; } /* check_object_copy_tags */ - + /*------------------------------------------------------------------------- * Function: check_link_removal_tags * @@ -3218,7 +3218,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_link_removal_tags(hid_t fcpl, int type) { /* Variable Declarations */ @@ -3271,7 +3271,7 @@ check_link_removal_tags(hid_t fcpl, int type) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -3334,7 +3334,7 @@ check_link_removal_tags(hid_t fcpl, int type) if ( verify_tag(fid, H5AC_SOHM_TABLE_ID, H5AC__SOHM_TAG) < 0 ) TEST_ERROR; } /* end if */ - + /* verify no other entries present */ if ( verify_no_unknown_tags(fid) < 0 ) TEST_ERROR; @@ -3362,7 +3362,7 @@ error: return 1; } /* check_link_removal_tags */ - + /*------------------------------------------------------------------------- * Function: check_link_getname_tags * @@ -3376,7 +3376,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_link_getname_tags(void) { /* Variable Declarations */ @@ -3430,7 +3430,7 @@ check_link_getname_tags(void) /* Set up creation property list */ dcpl = H5Pcreate(H5P_DATASET_CREATE); - + /* Enable chunking */ if ( H5Pset_chunk(dcpl, RANK, cdims) < 0 ) TEST_ERROR; @@ -3513,7 +3513,7 @@ error: return 1; } /* check_link_getname_tags */ - + /*------------------------------------------------------------------------- * Function: check_external_link_creation_tags * @@ -3527,7 +3527,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_external_link_creation_tags(void) { /* Variable Declarations */ @@ -3576,7 +3576,7 @@ check_external_link_creation_tags(void) /* ==================== */ /* Create External Link */ /* ==================== */ - + if (H5Lcreate_external(FILENAME2, GROUPNAMEPATH, fid, LINKNAME, H5P_DEFAULT, H5P_DEFAULT) < 0 ) TEST_ERROR; /* =================================== */ @@ -3587,7 +3587,7 @@ check_external_link_creation_tags(void) /* if verbose, print cache index to screen for visual verification */ if ( verbose ) dump_cache(fid); #endif /* NDEBUG */ /* end debugging functions */ - + /* Verify root group metadata */ if ( verify_tag(fid, H5AC_OHDR_ID, root_tag) < 0 ) TEST_ERROR; if ( verify_tag(fid, H5AC_OHDR_CHK_ID, root_tag) < 0 ) TEST_ERROR; @@ -3617,7 +3617,7 @@ error: return 1; } /* check_external_link_creation_tags */ - + /*------------------------------------------------------------------------- * Function: check_external_link_open_tags * @@ -3631,7 +3631,7 @@ error: * *------------------------------------------------------------------------- */ -static unsigned +static unsigned check_external_link_open_tags(void) { /* Variable Declarations */ @@ -3689,11 +3689,11 @@ check_external_link_open_tags(void) /* ================== */ /* Open External Link */ /* ================== */ - + if ( (xid = H5Gopen2(fid, LINKNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR; if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR; if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR; - + /* =================================== */ /* Verification of Metadata Tag Values */ /* =================================== */ @@ -3747,12 +3747,12 @@ error: return 1; } /* check_external_link_open_tags */ - + /*------------------------------------------------------------------------- * Function: check_invalid_tag_application * * Purpose: This function verifies that an error occurs if a tag - * has not been set up during a protect or set of + * has not been set up during a protect or set of * a new piece of metadata. * * Return: 0 on Success, 1 on Failure @@ -3777,7 +3777,7 @@ check_invalid_tag_application(void) /* Testing Macro */ TESTING("failure on invalid tag application"); - + #if H5C_DO_TAGGING_SANITY_CHECKS /* Create Fapl */ if ( (fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0 ) TEST_ERROR; @@ -3844,7 +3844,7 @@ error: return 1; } /* check_invalid_tag_application */ - + /*------------------------------------------------------------------------- * Function: main * @@ -3857,8 +3857,8 @@ error: * *------------------------------------------------------------------------- */ -int -main(void) +int +main(void) { /* Variable Declarations */ hid_t fcpl_default = -1; /* file creation prop list */ @@ -3866,13 +3866,13 @@ main(void) hid_t fcpl = -1; /* file creation prop list */ unsigned nerrs = 0; /* Error Encountered */ int test_type = 0; /* test type iterator */ - + /* Open the HDF5 Library */ H5open(); - - /* ========== */ + + /* ========== */ /* Test Setup */ - /* ========== */ + /* ========== */ /* Create a standard file creation property list */ fcpl_default = H5Pcreate(H5P_FILE_CREATE); @@ -3888,13 +3888,13 @@ main(void) /* ========= */ for (test_type=0; test_typea != ps1->a || - ps8->b != ps1->b || - ps8->c[0] != ps1->c[0] || - ps8->c[1] != ps1->c[1] || - ps8->c[2] != ps1->c[2] || - ps8->c[3] != ps1->c[3] || - ps8->d != ps1->d || - ps8->e != ps1->e) { - H5_FAILED(); - puts(" Incorrect values read from file"); - goto error; - } - } + for (j=0; ja != ps1->a || + ps8->b != ps1->b || + ps8->c[0] != ps1->c[0] || + ps8->c[1] != ps1->c[1] || + ps8->c[2] != ps1->c[2] || + ps8->c[3] != ps1->c[3] || + ps8->d != ps1->d || + ps8->e != ps1->e) { + H5_FAILED(); + puts(" Incorrect values read from file"); + goto error; + } + } } HDfree (s8); @@ -668,51 +668,51 @@ test_compound (char *filename, hid_t fapl) /* Initialize */ for (i=0; i=f_offset[0] && - i=f_offset[1] && - ja != ps1->a || - ps2->b != ps1->b || - ps2->c[0] != ps1->c[0] || - ps2->c[1] != ps1->c[1] || - ps2->c[2] != ps1->c[2] || - ps2->c[3] != ps1->c[3] || - ps2->d != ps1->d || - ps2->e != ps1->e) { - H5_FAILED(); - puts(" Memory values clobbered"); - goto error; - } - } else { - if (ps2->a != (unsigned)(-1) || - ps2->b != (unsigned)(-1) || - ps2->c[0] != (unsigned)(-1) || - ps2->c[1] != (unsigned)(-1) || - ps2->c[2] != (unsigned)(-1) || - ps2->c[3] != (unsigned)(-1) || - ps2->d != (unsigned)(-1) || - ps2->e != (unsigned)(-1)) { - H5_FAILED(); - puts(" Incorrect values read from file"); - goto error; - } - } - } + for (j=0; j=f_offset[0] && + i=f_offset[1] && + ja != ps1->a || + ps2->b != ps1->b || + ps2->c[0] != ps1->c[0] || + ps2->c[1] != ps1->c[1] || + ps2->c[2] != ps1->c[2] || + ps2->c[3] != ps1->c[3] || + ps2->d != ps1->d || + ps2->e != ps1->e) { + H5_FAILED(); + puts(" Memory values clobbered"); + goto error; + } + } else { + if (ps2->a != (unsigned)(-1) || + ps2->b != (unsigned)(-1) || + ps2->c[0] != (unsigned)(-1) || + ps2->c[1] != (unsigned)(-1) || + ps2->c[2] != (unsigned)(-1) || + ps2->c[3] != (unsigned)(-1) || + ps2->d != (unsigned)(-1) || + ps2->e != (unsigned)(-1)) { + H5_FAILED(); + puts(" Incorrect values read from file"); + goto error; + } + } + } } PASSED(); @@ -725,60 +725,60 @@ test_compound (char *filename, hid_t fapl) /* Initialize */ for (i=0; i=f_offset[0] && - i=f_offset[1] && - jpre != (unsigned)(-1) || - ps5->a != ps1->a || - ps5->b != ps1->b || - ps5->mid1 != (unsigned)(-1) || - ps5->c[0] != ps1->c[0] || - ps5->c[1] != ps1->c[1] || - ps5->c[2] != ps1->c[2] || - ps5->c[3] != ps1->c[3] || - ps5->mid2 != (unsigned)(-1) || - ps5->d != ps1->d || - ps5->e != ps1->e || - ps5->post != (unsigned)(-1)) { - H5_FAILED(); - puts(" Memory values clobbered"); - goto error; - } - } else { - if (ps5->pre != (unsigned)(-1) || - ps5->a != (unsigned)(-1) || - ps5->b != (unsigned)(-1) || - ps5->mid1 != (unsigned)(-1) || - ps5->c[0] != (unsigned)(-1) || - ps5->c[1] != (unsigned)(-1) || - ps5->c[2] != (unsigned)(-1) || - ps5->c[3] != (unsigned)(-1) || - ps5->mid2 != (unsigned)(-1) || - ps5->d != (unsigned)(-1) || - ps5->e != (unsigned)(-1) || - ps5->post != (unsigned)(-1)) { - H5_FAILED(); - puts(" Incorrect values read from file"); - goto error; - } - } - } + for (j=0; j=f_offset[0] && + i=f_offset[1] && + jpre != (unsigned)(-1) || + ps5->a != ps1->a || + ps5->b != ps1->b || + ps5->mid1 != (unsigned)(-1) || + ps5->c[0] != ps1->c[0] || + ps5->c[1] != ps1->c[1] || + ps5->c[2] != ps1->c[2] || + ps5->c[3] != ps1->c[3] || + ps5->mid2 != (unsigned)(-1) || + ps5->d != ps1->d || + ps5->e != ps1->e || + ps5->post != (unsigned)(-1)) { + H5_FAILED(); + puts(" Memory values clobbered"); + goto error; + } + } else { + if (ps5->pre != (unsigned)(-1) || + ps5->a != (unsigned)(-1) || + ps5->b != (unsigned)(-1) || + ps5->mid1 != (unsigned)(-1) || + ps5->c[0] != (unsigned)(-1) || + ps5->c[1] != (unsigned)(-1) || + ps5->c[2] != (unsigned)(-1) || + ps5->c[3] != (unsigned)(-1) || + ps5->mid2 != (unsigned)(-1) || + ps5->d != (unsigned)(-1) || + ps5->e != (unsigned)(-1) || + ps5->post != (unsigned)(-1)) { + H5_FAILED(); + puts(" Incorrect values read from file"); + goto error; + } + } + } } PASSED(); @@ -799,56 +799,56 @@ test_compound (char *filename, hid_t fapl) /* Initialize */ for (i=0; ia != 8*(i*NY+j)+0 || - ps1->c[0] != 8*(i*NY+j)+2 || - ps1->c[1] != 8*(i*NY+j)+3 || - ps1->c[2] != 8*(i*NY+j)+4 || - ps1->c[3] != 8*(i*NY+j)+5 || - ps1->e != 8*(i*NY+j)+7) { - H5_FAILED(); - puts(" Write clobbered values"); - goto error; - } - - if (i>=f_offset[0] && - i=f_offset[1] && - jb != (unsigned)(-1) || - ps1->d != (unsigned)(-1)) { - H5_FAILED(); - puts(" Wrong values written or read"); - goto error; - } - } else { - if (ps1->b != 8*(i*NY+j)+1 || - ps1->d != 8*(i*NY+j)+6) { - H5_FAILED(); - puts(" Write clobbered values"); - goto error; - } - } - } + for (j=0; ja != 8*(i*NY+j)+0 || + ps1->c[0] != 8*(i*NY+j)+2 || + ps1->c[1] != 8*(i*NY+j)+3 || + ps1->c[2] != 8*(i*NY+j)+4 || + ps1->c[3] != 8*(i*NY+j)+5 || + ps1->e != 8*(i*NY+j)+7) { + H5_FAILED(); + puts(" Write clobbered values"); + goto error; + } + + if (i>=f_offset[0] && + i=f_offset[1] && + jb != (unsigned)(-1) || + ps1->d != (unsigned)(-1)) { + H5_FAILED(); + puts(" Wrong values written or read"); + goto error; + } + } else { + if (ps1->b != 8*(i*NY+j)+1 || + ps1->d != 8*(i*NY+j)+6) { + H5_FAILED(); + puts(" Write clobbered values"); + goto error; + } + } + } } /* @@ -873,29 +873,29 @@ error: puts("*** DATASET TESTS FAILED ***"); /* Release resources */ - if(s1) + if(s1) HDfree(s1); - if(s2) + if(s2) HDfree(s2); - if(s3) + if(s3) HDfree(s3); - if(s4) + if(s4) HDfree(s4); - if(s5) + if(s5) HDfree(s5); - if(s6) + if(s6) HDfree(s6); return 1; } - + /*------------------------------------------------------------------------- - * Function: initialize_stype1 + * Function: initialize_stype1 * - * Purpose: Initialize data buffer. + * Purpose: Initialize data buffer. * - * Return: void + * Return: void * * Programmer: Raymond Lu * Friday, 15 June 2007 @@ -906,22 +906,22 @@ error: static void initialize_stype1(unsigned char *buf, size_t num) { - int i, j; + int i, j; stype1 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype1 *)((void *)buf) + i; - s_ptr->a = i * 8 + 0; - s_ptr->b = i * 8 + 1; + s_ptr = (stype1 *)((void *)buf) + i; + s_ptr->a = i * 8 + 0; + s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) - s_ptr->c[j] = i * 8 + j; - s_ptr->d = i * 8 + 6; - s_ptr->e = i * 8 + 7; + s_ptr->c[j] = i * 8 + j; + s_ptr->d = i * 8 + 6; + s_ptr->e = i * 8 + 7; s_ptr->f = (float)(i * 2 / 3); s_ptr->g = (float)(i * 2 / 3 + 1); for(j = 0; j < 16; j++) - s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->h[j] = (float)(i * j / 5 + j); s_ptr->i = (float)(i * 2 / 3 + 2); s_ptr->j = (float)(i * 2 / 3 + 3); @@ -932,13 +932,13 @@ initialize_stype1(unsigned char *buf, size_t num) } } - + /*------------------------------------------------------------------------- - * Function: initialize_stype2 + * Function: initialize_stype2 * - * Purpose: Initialize data buffer. + * Purpose: Initialize data buffer. * - * Return: void + * Return: void * * Programmer: Raymond Lu * Friday, 15 June 2007 @@ -953,18 +953,18 @@ initialize_stype2(unsigned char *buf, size_t num) stype2 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype2 *)((void *)buf) + i; - s_ptr->a = (int)(i * 8 + 0); - s_ptr->b = (int)(i * 8 + 1); + s_ptr = (stype2 *)((void *)buf) + i; + s_ptr->a = (int)(i * 8 + 0); + s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) - s_ptr->c[j] = (int)(i * 8 + j); - s_ptr->d = (int)(i * 8 + 6); - s_ptr->e = (int)(i * 8 + 7); + s_ptr->c[j] = (int)(i * 8 + j); + s_ptr->d = (int)(i * 8 + 6); + s_ptr->e = (int)(i * 8 + 7); s_ptr->f = (float)(i * 2 / 3); s_ptr->g = (float)(i * 2 / 3 + 1); for(j = 0; j < 16; j++) - s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->h[j] = (float)(i * j / 5 + j); s_ptr->i = (float)(i * 2 / 3 + 2); s_ptr->j = (float)(i * 2 / 3 + 3); @@ -979,13 +979,13 @@ initialize_stype2(unsigned char *buf, size_t num) } } - + /*------------------------------------------------------------------------- - * Function: initialize_stype3 + * Function: initialize_stype3 * - * Purpose: Initialize data buffer. + * Purpose: Initialize data buffer. * - * Return: Success: + * Return: Success: * * Programmer: Raymond Lu * Friday, 15 June 2007 @@ -996,27 +996,27 @@ initialize_stype2(unsigned char *buf, size_t num) static void initialize_stype3(unsigned char *buf, size_t num) { - int i, j; + int i, j; stype3 *s_ptr; for(i = 0; i < (int)num; i++) { - s_ptr = (stype3 *)((void *)buf) + i; - s_ptr->a = i * 8 + 0; - s_ptr->b = i * 8 + 1; + s_ptr = (stype3 *)((void *)buf) + i; + s_ptr->a = i * 8 + 0; + s_ptr->b = i * 8 + 1; for(j = 0; j < 8; j++) - s_ptr->c[j] = i * 8 + j; - s_ptr->d = i * 8 + 6; - s_ptr->e = i * 8 + 7; + s_ptr->c[j] = i * 8 + j; + s_ptr->d = i * 8 + 6; + s_ptr->e = i * 8 + 7; } } - + /*------------------------------------------------------------------------- - * Function: initialize_stype4 + * Function: initialize_stype4 * - * Purpose: Initialize data buffer. + * Purpose: Initialize data buffer. * - * Return: void + * Return: void * * Programmer: Raymond Lu * Friday, 15 June 2007 @@ -1031,18 +1031,18 @@ initialize_stype4(unsigned char *buf, size_t num) stype4 *s_ptr; for(i = 0; i < num; i++) { - s_ptr = (stype4 *)((void *)buf) + i; - s_ptr->a = (int)(i * 8 + 0); - s_ptr->b = (int)(i * 8 + 1); + s_ptr = (stype4 *)((void *)buf) + i; + s_ptr->a = (int)(i * 8 + 0); + s_ptr->b = (int)(i * 8 + 1); for(j = 0; j < 8; j++) - s_ptr->c[j] = (int)(i * 8 + j); - s_ptr->d = (int)(i * 8 + 6); - s_ptr->e = (int)(i * 8 + 7); + s_ptr->c[j] = (int)(i * 8 + j); + s_ptr->d = (int)(i * 8 + 6); + s_ptr->e = (int)(i * 8 + 7); s_ptr->f = (float)(i * 2 / 3); s_ptr->g = (float)(i * 2 / 3 + 1); for(j = 0; j < 16; j++) - s_ptr->h[j] = (float)(i * j / 5 + j); + s_ptr->h[j] = (float)(i * j / 5 + j); s_ptr->i = (float)(i * 2 / 3 + 2); s_ptr->j = (float)(i * 2 / 3 + 3); @@ -1061,13 +1061,13 @@ initialize_stype4(unsigned char *buf, size_t num) } } - + /*------------------------------------------------------------------------- - * Function: create_stype1 + * Function: create_stype1 * - * Purpose: Create HDF5 compound datatype for stype1. + * Purpose: Create HDF5 compound datatype for stype1. * - * Return: Success: datatype ID + * Return: Success: datatype ID * * Failure: negative * @@ -1081,7 +1081,7 @@ static hid_t create_stype1(void) { hid_t array_dt1, array_dt2, tid; - const hsize_t eight = 8, sixteen = 16; + const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) @@ -1117,13 +1117,13 @@ error: return FAIL; } - + /*------------------------------------------------------------------------- - * Function: create_stype2 + * Function: create_stype2 * - * Purpose: Create HDF5 compound datatype for stype2. + * Purpose: Create HDF5 compound datatype for stype2. * - * Return: Success: datatype ID + * Return: Success: datatype ID * * Failure: negative * @@ -1137,7 +1137,7 @@ static hid_t create_stype2(void) { hid_t array_dt1, array_dt2, tid; - const hsize_t eight = 8, sixteen = 16; + const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) @@ -1176,13 +1176,13 @@ error: return FAIL; } - + /*------------------------------------------------------------------------- - * Function: create_stype3 + * Function: create_stype3 * - * Purpose: Create HDF5 compound datatype for stype3. + * Purpose: Create HDF5 compound datatype for stype3. * - * Return: Success: datatype ID + * Return: Success: datatype ID * * Failure: negative * @@ -1196,7 +1196,7 @@ static hid_t create_stype3(void) { hid_t array_dt1, tid; - const hsize_t eight = 8; + const hsize_t eight = 8; /* Build hdf5 datatypes */ if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) @@ -1219,13 +1219,13 @@ error: return FAIL; } - + /*------------------------------------------------------------------------- - * Function: create_stype4 + * Function: create_stype4 * - * Purpose: Create HDF5 compound datatype for stype4. + * Purpose: Create HDF5 compound datatype for stype4. * - * Return: Success: datatype ID + * Return: Success: datatype ID * * Failure: negative * @@ -1239,7 +1239,7 @@ static hid_t create_stype4(void) { hid_t array_dt1, array_dt2, tid; - const hsize_t eight = 8, sixteen = 16; + const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) @@ -1281,13 +1281,13 @@ error: return FAIL; } - + /*------------------------------------------------------------------------- - * Function: compare_data + * Function: compare_data * - * Purpose: Compare data of stype1 and stype2. + * Purpose: Compare data of stype1 and stype2. * - * Return: Success: 0 + * Return: Success: 0 * * Failure: negative * @@ -1306,21 +1306,21 @@ compare_data(void *src_data, void *dst_data, hbool_t src_subset) for(i = 0; i < (int)(NX * NY); i++) { if(src_subset) { - s_ptr = ((stype1 *)src_data) + i; - d_ptr = ((stype2 *)dst_data) + i; + s_ptr = ((stype1 *)src_data) + i; + d_ptr = ((stype2 *)dst_data) + i; } else { - s_ptr = (stype1 *)(((stype2 *)src_data) + i); - d_ptr = (stype2 *)(((stype1 *)dst_data) + i); + s_ptr = (stype1 *)(((stype2 *)src_data) + i); + d_ptr = (stype2 *)(((stype1 *)dst_data) + i); } - if (s_ptr->a != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e || + if (s_ptr->a != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e || !H5_FLT_ABS_EQUAL(s_ptr->f, d_ptr->f) || !H5_FLT_ABS_EQUAL(s_ptr->g, d_ptr->g) || !H5_FLT_ABS_EQUAL(s_ptr->h[0], d_ptr->h[0]) || @@ -1332,25 +1332,25 @@ compare_data(void *src_data, void *dst_data, hbool_t src_subset) !H5_DBL_ABS_EQUAL(s_ptr->m, d_ptr->m) || !H5_DBL_ABS_EQUAL(s_ptr->n, d_ptr->n) ) { - H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->c[4], s_ptr->c[5], s_ptr->c[6], s_ptr->c[7], + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->c[4], s_ptr->c[5], s_ptr->c[6], s_ptr->c[7], s_ptr->d, s_ptr->e, (double)s_ptr->f, (double)s_ptr->g,(double)s_ptr->h[0],(double)s_ptr->h[1],(double)s_ptr->h[2], (double)s_ptr->h[3],(double)s_ptr->h[4],(double)s_ptr->h[5],(double)s_ptr->h[6],(double)s_ptr->h[7],(double)s_ptr->h[8], (double)s_ptr->h[9],(double)s_ptr->h[10],(double)s_ptr->h[11],(double)s_ptr->h[12],(double)s_ptr->h[13],(double)s_ptr->h[14], (double)s_ptr->h[15], (double)s_ptr->i,(double)s_ptr->j,s_ptr->k,s_ptr->l,s_ptr->m,s_ptr->n); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", - d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->c[4], d_ptr->c[5], d_ptr->c[6], d_ptr->c[7], + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d,%d,%d,%d,%d], d=%d, e=%d, f=%f, g=%f, h=[%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f], i=%f, j=%f, k=%f, l=%f, m=%f, n=%f}\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->c[4], d_ptr->c[5], d_ptr->c[6], d_ptr->c[7], d_ptr->d, d_ptr->e, (double)d_ptr->f, (double)d_ptr->g,(double)d_ptr->h[0],(double)d_ptr->h[1],(double)d_ptr->h[2], (double)d_ptr->h[3],(double)d_ptr->h[4],(double)d_ptr->h[5],(double)d_ptr->h[6],(double)d_ptr->h[7],(double)d_ptr->h[8], (double)d_ptr->h[9],(double)d_ptr->h[10],(double)d_ptr->h[11],(double)d_ptr->h[12],(double)d_ptr->h[13], (double)d_ptr->h[14],(double)d_ptr->h[15],(double)d_ptr->i,(double)d_ptr->j,d_ptr->k,d_ptr->l, d_ptr->m,d_ptr->n); - goto error; - } + goto error; + } } return SUCCEED; @@ -1359,11 +1359,11 @@ error: return FAIL; } - + /*------------------------------------------------------------------------- - * Function: test_hdf5_src_subset + * Function: test_hdf5_src_subset * - * Purpose: Test the optimization of compound data writing, rewriting, + * Purpose: Test the optimization of compound data writing, rewriting, * and reading when the source type is a subset of destination * type. For example: * struct source { struct destination { @@ -1375,11 +1375,11 @@ error: * }; * This optimization is for the Chicago company. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, 15 June 2007 * * Modifications: @@ -1399,7 +1399,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Create the file for this test */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; /* Build hdf5 datatypes */ if ((src_tid=create_stype1()) < 0) @@ -1413,7 +1413,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Create the data space */ if((space = H5Screate_simple(2, dims, NULL)) < 0) - goto error; + goto error; /* Allocate space and initialize data */ orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype1)); @@ -1441,7 +1441,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1456,7 +1456,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1482,7 +1482,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR @@ -1493,7 +1493,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR @@ -1559,15 +1559,15 @@ test_hdf5_src_subset(char *filename, hid_t fapl) return 0; error: - puts("*** DATASET TESTS FAILED ***"); + HDputs("*** DATASET TESTS FAILED ***"); return 1; } - + /*------------------------------------------------------------------------- - * Function: test_hdf5_dst_subset + * Function: test_hdf5_dst_subset * - * Purpose: Test the optimization of compound data writing, rewriting, + * Purpose: Test the optimization of compound data writing, rewriting, * and reading when the destination type is a subset of the * source type. For example: * struct source { struct destination { @@ -1580,11 +1580,11 @@ error: * This optimization is for the Chicago company. This test * is in opposite of test_hdf5_src_subset. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Friday, 15 June 2007 * * Modifications: @@ -1604,7 +1604,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Create the file for this test */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; /* Build hdf5 datatypes */ if ((src_tid=create_stype2()) < 0) @@ -1618,7 +1618,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Create the data space */ if((space = H5Screate_simple(2, dims, NULL)) < 0) - goto error; + goto error; /* Allocate space and initialize data */ orig = (unsigned char*)HDmalloc(NX * NY * sizeof(stype2)); @@ -1645,7 +1645,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1660,7 +1660,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, src_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1686,7 +1686,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1697,7 +1697,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) /* Write the data to the dataset */ if(H5Dwrite(dataset, rew_tid, H5S_ALL, H5S_ALL, dxpl, rew_buf) < 0) - goto error; + goto error; if(H5Dclose(dataset) < 0) goto error; @@ -1773,27 +1773,27 @@ error: { \ int _i; \ H5_FAILED(); AT(); \ - printf(" Insertion order ="); \ + HDprintf(" Insertion order ="); \ for(_i=0; _i1) { - if (argc>2 || strcmp("--noopt", argv[1])) { - fprintf(stderr, "usage: %s [--noopt]\n", argv[0]); - exit(EXIT_FAILURE); - } - H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); + if (argc>2 || strcmp("--noopt", argv[1])) { + HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); + exit(EXIT_FAILURE); + } + H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); } /* Create the file */ @@ -2227,33 +2227,33 @@ main (int argc, char *argv[]) h5_fixname(FILENAME[0], fapl_id, fname, sizeof(fname)); - puts("Testing compound dataset:"); + HDputs("Testing compound dataset:"); nerrors += test_compound(fname, fapl_id); - puts("Testing the optimization of when the source type is a subset of the dest:"); + HDputs("Testing the optimization of when the source type is a subset of the dest:"); h5_fixname(FILENAME[1], fapl_id, fname, sizeof(fname)); nerrors += test_hdf5_src_subset(fname, fapl_id); - puts("Testing the optimization of when the dest type is a subset of the source:"); + HDputs("Testing the optimization of when the dest type is a subset of the source:"); h5_fixname(FILENAME[2], fapl_id, fname, sizeof(fname)); nerrors += test_hdf5_dst_subset(fname, fapl_id); - puts("Testing that compound types can be packed out of order:"); + HDputs("Testing that compound types can be packed out of order:"); nerrors += test_pack_ooo(); - puts("Testing compound member ordering:"); + HDputs("Testing compound member ordering:"); nerrors += test_ooo_order(fname, fapl_id); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); if (nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } h5_cleanup(FILENAME, fapl_id); - puts("All compound dataset tests passed."); + HDputs("All compound dataset tests passed."); return 0; } diff --git a/test/cork.c b/test/cork.c index 240be77..09076d2 100644 --- a/test/cork.c +++ b/test/cork.c @@ -24,9 +24,9 @@ * This file needs to access private information from the H5C package. * This file also needs to access the metadata cache testing code. */ -#define H5C_FRIEND /*suppress error about including H5Cpkg */ -#define H5C_TESTING /*suppress warning about H5C testing funcs*/ -#include "H5Cpkg.h" /* Cache */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5C_TESTING /*suppress warning about H5C testing funcs*/ +#include "H5Cpkg.h" /* Cache */ /* ============ */ @@ -74,7 +74,7 @@ static unsigned verify_group_cork(hbool_t swmr); static unsigned verify_named_cork(hbool_t swmr); static unsigned verify_multiple_cork(hbool_t swmr); - + /*------------------------------------------------------------------------- * Function: verify_old_dset_cork * @@ -120,15 +120,15 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR /* Create chunked dataset with v1-btree indexing: DSET_BT1 */ - if((sid = H5Screate_simple(2, dims, max_dims)) < 0) + if((sid = H5Screate_simple(2, dims, max_dims)) < 0) TEST_ERROR if((did = H5Dcreate2(fid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR - + /* Get dataset object header address: DSET_BT1 */ if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - + /* Cork the dataset: DSET_BT1 */ if(H5Odisable_mdc_flushes(did) < 0) TEST_ERROR @@ -159,13 +159,13 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0) FAIL_STACK_ERROR - if((did2 = H5Dcreate2(fid, DSET_COMPACT, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0) + if((did2 = H5Dcreate2(fid, DSET_COMPACT, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get dataset object address */ if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - + /* Cork the dataset: DSET_COMPACT */ if(H5Odisable_mdc_flushes(did2) < 0) TEST_ERROR @@ -212,7 +212,7 @@ verify_old_dset_cork(void) FAIL_STACK_ERROR if(H5Pset_layout(dcpl3, H5D_CONTIGUOUS) < 0) FAIL_STACK_ERROR - if((did3 = H5Dcreate2(fid, DSET_CONTIG, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl3, H5P_DEFAULT)) < 0) + if((did3 = H5Dcreate2(fid, DSET_CONTIG, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl3, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get dataset object address: DSET_CONTIG */ @@ -224,11 +224,11 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR /* Verify the cork status for DSET_BT1 */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) TEST_ERROR /* Un-cork the dataset: DSET_CONTIG */ @@ -236,7 +236,7 @@ verify_old_dset_cork(void) TEST_ERROR /* Verify the cork status for DSET_CONTIG */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) TEST_ERROR /* Closing */ @@ -268,7 +268,7 @@ error: return 1; } /* verify_old_dset_cork */ - + /*------------------------------------------------------------------------- * Function: verify_obj_dset_cork * @@ -325,23 +325,23 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Create dataset: DSET */ - if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Get dataset object header address */ if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - + /* Verify cork status of the dataset: DSET */ if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) TEST_ERROR - + /* Cork the dataset: DSET */ if(H5Odisable_mdc_flushes(did) < 0) TEST_ERROR /* Attach and write to an attribute to the dataset: DSET */ - if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -349,24 +349,24 @@ verify_obj_dset_cork(hbool_t swmr) TEST_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) TEST_ERROR - + /* Create dcpl */ if((dcpl2 = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR /* Set to early allocation for dataset space */ - if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0) + if(H5Pset_alloc_time(dcpl2, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR /* Create chunked dataset with implicit indexing: DSET_NONE */ if(H5Pset_chunk(dcpl2, 1, chunk_dim) < 0) FAIL_STACK_ERROR - if((sid2 = H5Screate_simple(1, dim, NULL)) < 0) + if((sid2 = H5Screate_simple(1, dim, NULL)) < 0) TEST_ERROR if((did2 = H5Dcreate2(fid, DSET_NONE, H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl2, H5P_DEFAULT)) < 0) TEST_ERROR @@ -391,7 +391,7 @@ verify_obj_dset_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the dataset: DSET_NONE */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) TEST_ERROR /* Closing */ @@ -412,11 +412,11 @@ verify_obj_dset_cork(hbool_t swmr) flags = H5F_ACC_RDWR; if(swmr) flags |= H5F_ACC_SWMR_WRITE; - if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) + if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) TEST_ERROR /* Open the dataset object: DSET_NONE */ - if((oid = H5Oopen(fid, DSET_NONE, H5P_DEFAULT)) < 0) + if((oid = H5Oopen(fid, DSET_NONE, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ @@ -469,7 +469,7 @@ error: return 1; } /* verify_obj_dset_cork */ - + /*------------------------------------------------------------------------- * Function: verify_dset_cork * @@ -540,15 +540,15 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) FAIL_STACK_ERROR /* Create chunked dataset with extensive array indexing: DSET_EA */ - if((sid = H5Screate_simple(2, dims, max_dims)) < 0) + if((sid = H5Screate_simple(2, dims, max_dims)) < 0) TEST_ERROR if((did = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR - + /* Get dataset object header address: DSET_EA */ if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR - + /* Cork the dataset: DSET_EA */ if(H5Odisable_mdc_flushes(did) < 0) TEST_ERROR @@ -558,7 +558,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Create chunked dataset with fixed array indexing: DSET_FA */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR if((did2 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -566,7 +566,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Get dataset object header address: DSET_FA */ if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - + /* Cork the dataset: DSET_FA */ if(H5Odisable_mdc_flushes(did2) < 0) TEST_ERROR @@ -585,7 +585,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format) /* Create chunked dataset with v2-Btree indexing */ max_dims[0] = H5S_UNLIMITED; - if((sid3 = H5Screate_simple(2, dims, max_dims)) < 0) + if((sid3 = H5Screate_simple(2, dims, max_dims)) < 0) TEST_ERROR if((did3 = H5Dcreate2(fid, DSET_BT2, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR @@ -708,7 +708,7 @@ error: } /* verify_dset_cork */ - + /*------------------------------------------------------------------------- * Function: verify_group_cork * @@ -758,11 +758,11 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Create 3 groups */ - if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid3 = H5Gcreate2(gid2, GRP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid3 = H5Gcreate2(gid2, GRP3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Cork the second group: GRP2 */ @@ -778,23 +778,23 @@ verify_group_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the groups */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) TEST_ERROR - + /* Close the second group: GRP2 */ if(H5Gclose(gid2) < 0) TEST_ERROR /* Re-open the second group: GRP2 */ - if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) + if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify cork status of the second group: GRP2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) TEST_ERROR /* Closing */ @@ -813,11 +813,11 @@ verify_group_cork(hbool_t swmr) flags |= H5F_ACC_SWMR_WRITE; if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0) + if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) + if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid3 = H5Gopen2(gid2, GRP3, H5P_DEFAULT)) < 0) + if((gid3 = H5Gopen2(gid2, GRP3, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create dataspace */ @@ -826,7 +826,7 @@ verify_group_cork(hbool_t swmr) /* Attach 8 attributes to the third group: GRP3 */ for(i = 0;i < 8; i++) { - sprintf(attrname, "attr %d", i); + HDsprintf(attrname, "attr %d", i); if((aid = H5Acreate2(gid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) @@ -835,7 +835,7 @@ verify_group_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(gid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -843,7 +843,7 @@ verify_group_cork(hbool_t swmr) } /* end for */ /* Verify cork status of the third group: GRP3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR /* Closing */ @@ -875,7 +875,7 @@ error: return 1; } /* verify_group_cork */ - + /*------------------------------------------------------------------------- * Function: verify_named_cork * @@ -935,21 +935,21 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Commit datatype /DT */ - if(H5Tcommit2(fid, DT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Tcommit2(fid, DT, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create /GRP */ - if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Commit datatype /GRP/DT2 */ - if(H5Tcommit2(gid, DT2, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Tcommit2(gid, DT2, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create /GRP/GRP2 */ - if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid2 = H5Gcreate2(gid, GRP2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Commit datatype /GRP/GRP2/DT3 */ - if(H5Tcommit2(gid2, DT3, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) + if(H5Tcommit2(gid2, DT3, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Cork 2 named datatypes: /DT and /GRP/GRP2/DT3 */ @@ -967,11 +967,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR /* Close the datatypes */ @@ -983,19 +983,19 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Re-open the named datatypes */ - if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0) + if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0) + if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0) + if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify cork status of the named datatypes */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1019,17 +1019,17 @@ verify_named_cork(hbool_t swmr) flags |= H5F_ACC_SWMR_WRITE; if((fid = H5Fopen(FILENAME, flags, fapl)) < 0) FAIL_STACK_ERROR - if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0) + if((gid = H5Gopen2(fid, GRP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) + if((gid2 = H5Gopen2(gid, GRP2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Re-open the named datatypes */ - if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0) + if((tid = H5Topen2(fid, DT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0) + if((tid2 = H5Topen2(gid, DT2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0) + if((tid3 = H5Topen2(gid2, DT3, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Cork the datatype: DT2 */ @@ -1042,7 +1042,7 @@ verify_named_cork(hbool_t swmr) /* Attach 8 attributes to datatype: DT3 */ for(i = 0;i < 8; i++) { - sprintf(attrname, "attr %d", i); + HDsprintf(attrname, "attr %d", i); if((aid = H5Acreate2(tid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) @@ -1051,7 +1051,7 @@ verify_named_cork(hbool_t swmr) if(i == 3) { if(H5Odisable_mdc_flushes(tid3) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR } if(H5Aclose(aid) < 0) @@ -1059,7 +1059,7 @@ verify_named_cork(hbool_t swmr) } /* end for */ /* Create a dataset with named datatype: DT */ - if((did = H5Dcreate2(fid, DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DSET, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get dataset object header address */ @@ -1071,20 +1071,20 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0) TEST_ERROR /* Un-cork the datatype: DT3 */ if(H5Oenable_mdc_flushes(tid3) < 0) TEST_ERROR /* Verify cork status of the datatype: DT3 */ - if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0) TEST_ERROR /* Cork the datatype: DT */ @@ -1092,14 +1092,14 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) TEST_ERROR /* Verify cork status of the datatype: DT2 */ - if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0) TEST_ERROR /* Close the dataset */ @@ -1107,11 +1107,11 @@ verify_named_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the datatype: DT */ - if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0) TEST_ERROR /* Verify cork status of the dataset: DSET */ - if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0) TEST_ERROR /* Closing */ @@ -1149,7 +1149,7 @@ error: return 1; } /* verify_named_cork */ - + /*------------------------------------------------------------------------- * Function: verify_multiple_cork * @@ -1279,7 +1279,7 @@ verify_multiple_cork(hbool_t swmr) /* Verify cork status of the group: gid2 */ if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0) TEST_ERROR /* Check cork status of the group: gid1 */ @@ -1307,7 +1307,7 @@ verify_multiple_cork(hbool_t swmr) /* Verify cork status of the dataset: did1 */ if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0) TEST_ERROR /* Check cork status of the dataset: did2 */ @@ -1335,7 +1335,7 @@ verify_multiple_cork(hbool_t swmr) /* Verify cork status of the datatype: tid2 */ if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0) TEST_ERROR /* Check cork status of the datatype: tid1 */ @@ -1351,7 +1351,7 @@ verify_multiple_cork(hbool_t swmr) /* Verify cork status of the group: gid1 */ if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) TEST_ERROR /* Check cork status of the group: gid2 */ @@ -1371,7 +1371,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the group: gid1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0) TEST_ERROR /* Close the group: gid1 */ @@ -1385,7 +1385,7 @@ verify_multiple_cork(hbool_t swmr) /* Verify cork status of the dataset: did2 */ if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR - if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0) TEST_ERROR /* Check cork status of the dataset: did1 */ @@ -1405,7 +1405,7 @@ verify_multiple_cork(hbool_t swmr) TEST_ERROR /* Verify cork status of the dataset: did1 */ - if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0) + if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0) TEST_ERROR /* Close the dataset: did1 */ @@ -1517,7 +1517,7 @@ error: /*------------------------------------------------------------------------- * Function: test_objs_cork * - * Purpose: This function verifies H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled public + * Purpose: This function verifies H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled public * routines are working as specified. * * Return: 0 on Success, 1 on Failure @@ -1723,7 +1723,7 @@ test_objs_cork(hbool_t swmr, hbool_t new_format) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - + /* Cork the named datatype */ if(H5Odisable_mdc_flushes(tid) < 0) TEST_ERROR @@ -1796,7 +1796,7 @@ error: return 1; } /* test_objs_cork() */ - + /*------------------------------------------------------------------------- * Function: test_dset_cork * @@ -1847,7 +1847,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) } /* end if */ /* Create fapl */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR /* Set to use latest format */ @@ -1880,7 +1880,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) /* Set up dataset creation property list */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - + /* Enable chunking */ if(H5Pset_chunk(dcpl, RANK, cdims) < 0) TEST_ERROR @@ -2003,7 +2003,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR if(!corked) TEST_ERROR - + /* Close the dataset */ if(H5Dclose(did1) < 0) TEST_ERROR @@ -2053,7 +2053,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format) TEST_ERROR /* Second open of the named datatype */ - if((tid2 = H5Topen2(gid, "datatype", H5P_DEFAULT)) < 0) + if((tid2 = H5Topen2(gid, "datatype", H5P_DEFAULT)) < 0) TEST_ERROR /* Check cork status of the second opened named datatype */ @@ -2124,7 +2124,7 @@ error: } /* test_dset_cork() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -2138,12 +2138,12 @@ error: * *------------------------------------------------------------------------- */ -int -main(void) +int +main(void) { unsigned swmr; /* Loop over SWMR/non-SWMR */ unsigned nerrs = 0; /* Error Encountered */ - + /* Test for dataset created with old library format */ nerrs += verify_old_dset_cork(); @@ -2158,10 +2158,10 @@ main(void) /* Tests with/without SWMR access */ nerrs += verify_obj_dset_cork(swmr); - nerrs += verify_dset_cork(swmr, TRUE); - nerrs += verify_dset_cork(swmr, FALSE); - nerrs += verify_group_cork(swmr); - nerrs += verify_named_cork(swmr); + nerrs += verify_dset_cork(swmr, TRUE); + nerrs += verify_dset_cork(swmr, FALSE); + nerrs += verify_group_cork(swmr); + nerrs += verify_named_cork(swmr); nerrs += verify_multiple_cork(swmr); } /* end for */ diff --git a/test/cross_read.c b/test/cross_read.c index 2219151..5444aae 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -109,7 +109,7 @@ check_data_i(const char *dsetname, hid_t fid) if(data_out[i][j] != data_in[i][j]) if(!nerrors++) { H5_FAILED(); - printf("element [%d][%d] is %lld but should have been %lld\n", + HDprintf("element [%d][%d] is %lld but should have been %lld\n", (int)i, (int)j, data_out[i][j], data_in[i][j]); } /* end if */ @@ -119,7 +119,7 @@ check_data_i(const char *dsetname, hid_t fid) /* Failure */ if(nerrors) { - printf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY)); + HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY)); return 1; } /* end if */ @@ -182,7 +182,7 @@ check_data_f(const char *dsetname, hid_t fid) if(!H5_DBL_REL_EQUAL(data_out[i][j], data_in[i][j], (double)0.001F)) if(!nerrors++) { H5_FAILED(); - printf("element [%d][%d] is %g but should have been %g\n", + HDprintf("element [%d][%d] is %g but should have been %g\n", (int)i, (int)j, data_out[i][j], data_in[i][j]); } /* end if */ @@ -192,7 +192,7 @@ check_data_f(const char *dsetname, hid_t fid) /* Failure */ if(nerrors) { - printf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY)); + HDprintf("total of %d errors out of %d elements\n", nerrors, (int)(NX*NY)); return 1; } /* end if */ @@ -369,11 +369,11 @@ main(void) nerrors += check_file(filename); if(nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end if */ - printf("All data type tests passed.\n"); + HDprintf("All data type tests passed.\n"); return EXIT_SUCCESS; } /* end main() */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 447e827..7b17043 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2192,40 +2192,40 @@ int main( void ) continue; /* Print configuration */ - printf("Configuration: "); + HDprintf("Configuration: "); if(config == 0) - printf(""); + HDprintf(""); if(config & CONFIG_LATEST) { if(need_comma) - printf(", "); - printf("latest format"); + HDprintf(", "); + HDprintf("latest format"); need_comma = TRUE; } /* end if */ if(config & CONFIG_REOPEN_FILE) { if(need_comma) - printf(", "); - printf("reopen file"); + HDprintf(", "); + HDprintf("reopen file"); need_comma = TRUE; } /* end if */ else if(config & CONFIG_REOPEN_DSET) { if(need_comma) - printf(", "); - printf("reopen dataset"); + HDprintf(", "); + HDprintf("reopen dataset"); need_comma = TRUE; } /* end if */ if(config & CONFIG_DIRECT_WRITE) { if(need_comma) - printf(", "); - printf("direct write"); + HDprintf(", "); + HDprintf("direct write"); need_comma = TRUE; } /* end if */ if(config & CONFIG_DIRECT_READ) { if(need_comma) - printf(", "); - printf("direct read"); + HDprintf(", "); + HDprintf("direct read"); need_comma = TRUE; } /* end if */ - printf(":\n"); + HDprintf(":\n"); fflush(stdout); nerrors += test_single_chunk(config); diff --git a/test/dtransform.c b/test/dtransform.c index f022699..6f7e8a4 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -34,17 +34,17 @@ hid_t dset_id_float_chunk = -1; const float windchillFfloat[ROWS][COLS] = { {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f, -46.0f, -52.0f, -57.0f, -63.0f}, - {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f, -53.0f, -59.0f, -66.0f, -72.0f} , - {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f, -58.0f, -64.0f, -71.0f, -77.0f}, - {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f, -61.0f, -68.0f, -74.0f, -81.0f}, - {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f, -64.0f, -71.0f, -78.0f, -84.0f}, - {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f, -67.0f, -73.0f, -80.0f, -87.0f}, - {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -82.0f, -89.0f}, - {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f, -71.0f, -78.0f, -84.0f, -91.0f}, - {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f, -72.0f, -79.0f, -86.0f, -93.0f}, - {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f, -74.0f, -81.0f, -88.0f, -95.0f}, - {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f, -75.0f, -82.0f, -89.0f, -97.0f}, - {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -84.0f, -91.0f, -98.0f} + {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f, -53.0f, -59.0f, -66.0f, -72.0f} , + {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f, -58.0f, -64.0f, -71.0f, -77.0f}, + {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f, -61.0f, -68.0f, -74.0f, -81.0f}, + {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f, -64.0f, -71.0f, -78.0f, -84.0f}, + {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f, -67.0f, -73.0f, -80.0f, -87.0f}, + {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -82.0f, -89.0f}, + {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f, -71.0f, -78.0f, -84.0f, -91.0f}, + {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f, -72.0f, -79.0f, -86.0f, -93.0f}, + {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f, -74.0f, -81.0f, -88.0f, -95.0f}, + {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f, -75.0f, -82.0f, -89.0f, -97.0f}, + {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f, -76.0f, -84.0f, -91.0f, -98.0f} }; const int transformData[ROWS][COLS] = @@ -62,202 +62,202 @@ const int transformData[ROWS][COLS] = {25, 17, 10, 3, 4, 11, 19, 26, 33, 40, 48, 55, 62, 69, 4, 12, 19, 26} }; -#define UCOMPARE(TYPE,VAR1,VAR2,TOL) \ -{ \ - size_t i,j; \ - \ - for(i=0; i= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \ - { \ - H5_FAILED(); \ - fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ - goto error; \ - } \ - } \ - PASSED(); \ +#define UCOMPARE(TYPE,VAR1,VAR2,TOL) \ +{ \ + size_t i,j; \ + \ + for(i=0; i= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || ( ((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && ( ((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) \ + { \ + H5_FAILED(); \ + HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ + goto error; \ + } \ + } \ + PASSED(); \ } -#define COMPARE(TYPE,VAR1,VAR2,TOL) \ -{ \ - size_t i,j; \ - \ - for(i=0; i= ((TYPE)(VAR2)[i][j] - TOL))) ) \ - { \ - H5_FAILED(); \ - fprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ - goto error; \ - } \ - } \ - PASSED(); \ +#define COMPARE(TYPE,VAR1,VAR2,TOL) \ +{ \ + size_t i,j; \ + \ + for(i=0; i= ((TYPE)(VAR2)[i][j] - TOL))) ) \ + { \ + H5_FAILED(); \ + HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \ + goto error; \ + } \ + } \ + PASSED(); \ } -#define COMPARE_INT(VAR1,VAR2) \ -{ \ - size_t i,j; \ - \ - for(i=0; i"TEST_STR")") \ - \ - if(H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ - if(SIGNED) \ - COMPARE(TYPE, array, COMPARE_DATA, 2) \ - else \ - UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ + \ + if(SIGNED) \ + { \ + if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \ + if(H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \ + if(H5Dwrite(dset_nn, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \ + } \ + else \ + { \ + if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \ + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \ + if(H5Dwrite(dset_nn, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \ + } \ + \ + \ + TESTING("contiguous, no data type conversion ("TEST_STR"->"TEST_STR")") \ + \ + if(H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ + if(SIGNED) \ + COMPARE(TYPE, array, COMPARE_DATA, 2) \ + else \ + UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ \ - TESTING("contiguous, byte order conversion ("TEST_STR"->"TEST_STR")") \ - \ - if(H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ - if(SIGNED) \ - COMPARE(TYPE, array, COMPARE_DATA, 2) \ - else \ - UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ - \ - if(SIGNED) \ - { \ - TESTING("contiguous, with type conversion (float->"TEST_STR")") \ - \ - if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ - COMPARE(TYPE, array, COMPARE_DATA, 2) \ - } \ - \ - if(H5Dclose(dset) < 0) TEST_ERROR; \ - if(H5Sclose(dataspace) < 0) TEST_ERROR; \ + TESTING("contiguous, byte order conversion ("TEST_STR"->"TEST_STR")") \ + \ + if(H5Dread(dset_nn, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ + if(SIGNED) \ + COMPARE(TYPE, array, COMPARE_DATA, 2) \ + else \ + UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ + \ + if(SIGNED) \ + { \ + TESTING("contiguous, with type conversion (float->"TEST_STR")") \ + \ + if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array) < 0) TEST_ERROR; \ + COMPARE(TYPE, array, COMPARE_DATA, 2) \ + } \ + \ + if(H5Dclose(dset) < 0) TEST_ERROR; \ + if(H5Sclose(dataspace) < 0) TEST_ERROR; \ } -#define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \ -{ \ - TYPE array[ROWS][COLS]; \ - const char* f_to_c = "(5/9.0)*(x-32)"; \ +#define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \ +{ \ + TYPE array[ROWS][COLS]; \ + const char* f_to_c = "(5/9.0)*(x-32)"; \ /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ \ - const char* utrans = "((x+100)/4)*3"; \ - \ - hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \ - hsize_t dim[2] = {ROWS, COLS}; \ - hsize_t offset[2] = {0, 0}; \ - \ - \ - if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \ - \ - if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; \ - if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \ - \ - if((dset_chunk = H5Dcreate2(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR; \ - if((filespace = H5Dget_space(dset_chunk)) < 0) TEST_ERROR \ - if((memspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR \ - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \ - \ - if(SIGNED) \ - { \ - if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ - if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \ - if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \ - if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \ - } \ - else \ - { \ - if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ - if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \ - if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \ - if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \ - } \ - \ - \ - TESTING("chunked, no data type conversion ("TEST_STR"->"TEST_STR")") \ - \ - if(H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \ - if(SIGNED) \ - COMPARE(TYPE, array, COMPARE_DATA, 2) \ - else \ - UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ - \ - if(SIGNED) \ - { \ - TESTING("chunked, with type conversion (float->"TEST_STR")") \ - \ - if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \ - COMPARE(TYPE, array, COMPARE_DATA, 2) \ - } \ - \ - \ - if(H5Pclose(cparms) < 0) TEST_ERROR; \ - if(H5Dclose(dset_chunk) < 0) TEST_ERROR; \ - if(H5Sclose(dataspace) < 0) TEST_ERROR; \ - if(H5Sclose(memspace) < 0) TEST_ERROR; \ + const char* utrans = "((x+100)/4)*3"; \ + \ + hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \ + hsize_t dim[2] = {ROWS, COLS}; \ + hsize_t offset[2] = {0, 0}; \ + \ + \ + if((dataspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR; \ + \ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; \ + if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \ + \ + if((dset_chunk = H5Dcreate2(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR; \ + if((filespace = H5Dget_space(dset_chunk)) < 0) TEST_ERROR \ + if((memspace = H5Screate_simple(2, dim, NULL)) < 0) TEST_ERROR \ + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \ + \ + if(SIGNED) \ + { \ + if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c) < 0) TEST_ERROR; \ + if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat) < 0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_f_to_c) < 0) TEST_ERROR; \ + } \ + else \ + { \ + if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_utrans, utrans) < 0) TEST_ERROR; \ + if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData) < 0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_utrans) < 0) TEST_ERROR; \ + } \ + \ + \ + TESTING("chunked, no data type conversion ("TEST_STR"->"TEST_STR")") \ + \ + if(H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \ + if(SIGNED) \ + COMPARE(TYPE, array, COMPARE_DATA, 2) \ + else \ + UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ + \ + if(SIGNED) \ + { \ + TESTING("chunked, with type conversion (float->"TEST_STR")") \ + \ + if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array) < 0) TEST_ERROR; \ + COMPARE(TYPE, array, COMPARE_DATA, 2) \ + } \ + \ + \ + if(H5Pclose(cparms) < 0) TEST_ERROR; \ + if(H5Dclose(dset_chunk) < 0) TEST_ERROR; \ + if(H5Sclose(dataspace) < 0) TEST_ERROR; \ + if(H5Sclose(memspace) < 0) TEST_ERROR; \ } -#define INVALID_SET_TEST(TRANSFORM) \ -{ \ - if(H5Pset_data_transform(dxpl_id, TRANSFORM) < 0) \ - { \ - PASSED(); \ - } \ - else \ - { \ - H5_FAILED(); \ - fprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \ - goto error; \ - } \ +#define INVALID_SET_TEST(TRANSFORM) \ +{ \ + if(H5Pset_data_transform(dxpl_id, TRANSFORM) < 0) \ + { \ + PASSED(); \ + } \ + else \ + { \ + H5_FAILED(); \ + HDfprintf(stderr, " ERROR: Data transform allowed invalid TRANSFORM transform to be set\n"); \ + goto error; \ + } \ } int main(void) { hid_t dxpl_id_c_to_f = -1; hid_t dxpl_id_c_to_f_copy = 1; - hid_t dxpl_id_simple = -1; + hid_t dxpl_id_simple = -1; hid_t dxpl_id_polynomial = -1; hid_t dxpl_id_polynomial_copy = -1; hid_t dxpl_id_utrans_inv = -1; @@ -440,8 +440,8 @@ init_test(hid_t file_id) PASSED(); return 0; - -error: + +error: H5E_BEGIN_TRY { H5Pclose(cparms); H5Pclose(dxpl_id_f_to_c); @@ -472,7 +472,7 @@ test_poly(const hid_t dxpl_id_polynomial) if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0) TEST_ERROR - + COMPARE(float, polyflread, polyflres, 2.0f) for(row = 0; row < ROWS; row++) @@ -485,12 +485,12 @@ test_poly(const hid_t dxpl_id_polynomial) if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread) < 0) TEST_ERROR - + COMPARE(int, polyintread, polyflres, 4) return 0; -error: +error: return -1; } @@ -533,7 +533,7 @@ test_specials(hid_t file) if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) TEST_ERROR - + COMPARE_INT(read_buf, data_res) if(H5Dclose(dset_id) < 0) @@ -557,7 +557,7 @@ test_specials(hid_t file) if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) TEST_ERROR - + COMPARE_INT(read_buf, data_res) if(H5Dclose(dset_id) < 0) @@ -581,7 +581,7 @@ test_specials(hid_t file) if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) TEST_ERROR - + COMPARE_INT(read_buf, data_res) if(H5Dclose(dset_id) < 0) @@ -605,7 +605,7 @@ test_specials(hid_t file) if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) TEST_ERROR - + COMPARE_INT(read_buf, data_res) if(H5Dclose(dset_id) < 0) @@ -629,7 +629,7 @@ test_specials(hid_t file) if(H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) < 0) TEST_ERROR - + COMPARE_INT(read_buf, data_res) if(H5Dclose(dset_id) < 0) @@ -644,7 +644,7 @@ test_specials(hid_t file) PASSED(); return 0; -error: +error: return -1; } @@ -667,19 +667,19 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy) if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread) < 0) TEST_ERROR - + COMPARE(int, windchillFintread, windchillFfloat, 2) TESTING("data transform, polynomial transform w/ copied property") if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread) < 0) TEST_ERROR - + COMPARE(int, polyintread, polyflres, 2) return 0; -error: +error: return -1; } @@ -696,7 +696,7 @@ test_trivial(const hid_t dxpl_id_simple) TEST_ERROR for(row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) { - if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) + if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n"); } @@ -708,7 +708,7 @@ test_trivial(const hid_t dxpl_id_simple) TEST_ERROR for(row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) { - if(windchillFintread[row][col] != 4) + if(windchillFintread[row][col] != 4) FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n") } @@ -740,7 +740,7 @@ test_getset(const hid_t dxpl_id_c_to_f) FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n") PASSED() - + HDfree(ptrgetTest); ptrgetTest = NULL; @@ -752,10 +752,10 @@ test_getset(const hid_t dxpl_id_c_to_f) if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread) < 0) TEST_ERROR - + for(row = 0; row < ROWS; row++) for(col = 0; col < COLS; col++) { - if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) + if((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL) FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n") } @@ -767,7 +767,7 @@ test_getset(const hid_t dxpl_id_c_to_f) TEST_ERROR if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0) TEST_ERROR - if(HDstrcmp(simple, ptrgetTest) != 0) + if(HDstrcmp(simple, ptrgetTest) != 0) FAIL_PUTS_ERROR(" ERROR: Data transform failed to match what was set\n") PASSED() @@ -793,11 +793,11 @@ test_set(void) char *ptrgetTest = NULL; TESTING("H5Pget_data_transform (get before set)") - + if(NULL == (ptrgetTest = (char *)HDmalloc(HDstrlen(str) + 1))) TEST_ERROR - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR /* Test get before set */ @@ -807,7 +807,7 @@ test_set(void) if(H5Pget_data_transform(dxpl_id, ptrgetTest, HDstrlen(str) + 1) < 0) PASSED() - else + else FAIL_PUTS_ERROR(" ERROR: Data transform get before set succeeded (it shouldn't have)\n"); HDfree(ptrgetTest); diff --git a/test/dtypes.c b/test/dtypes.c index 39fad9f..5eaa77c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -23,7 +23,7 @@ #include "H5Iprivate.h" /* For checking that datatype id's don't leak */ /* Number of elements in each test */ -#define NTESTELEM 100000 +#define NTESTELEM 100000 /* For test_compound_8 and test_compound_10 */ #define ARRAY_DIM 4 @@ -32,7 +32,7 @@ * Offset from alinged memory returned by malloc(). This can be used to test * that type conversions handle non-aligned buffers correctly. */ -#define ALIGNMENT 1 +#define ALIGNMENT 1 /* * Define if you want to test alignment code on a machine that doesn't @@ -43,7 +43,7 @@ /* Alignment test stuff */ #ifdef TEST_ALIGNMENT -#define H5T_FRIEND /*suppress error about including H5Tpkg */ +#define H5T_FRIEND /*suppress error about including H5Tpkg */ #include "H5Tpkg.h" #endif @@ -71,7 +71,7 @@ FAIL_STACK_ERROR \ if((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \ H5_FAILED(); \ - printf(" #dtype ids expected: %lld; found: %lld\n", \ + HDprintf(" #dtype ids expected: %lld; found: %lld\n", \ (long long)NMEMBS, (long long)H5I_nmembers(H5I_DATATYPE)); \ goto error; \ } @@ -136,22 +136,22 @@ static int num_opaque_conversions_g = 0; static int opaque_check(int tag_it); static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata, - size_t nelmts, size_t buf_stride, + size_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf, - void *bkg, hid_t dset_xfer_plid); + void *bkg, hid_t dset_xfer_plid); static int opaque_long(void); static int opaque_funcs(void); - + /*------------------------------------------------------------------------- - * Function: reset_hdf5 + * Function: reset_hdf5 * - * Purpose: Reset the hdf5 library. This causes statistics to be printed - * and counters to be reset. + * Purpose: Reset the hdf5 library. This causes statistics to be printed + * and counters to be reset. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 16, 1998 * * Modifications: @@ -182,7 +182,7 @@ reset_hdf5(void) } - + /*------------------------------------------------------------------------- * Function: test_classes * @@ -283,7 +283,7 @@ test_classes(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_copy * @@ -304,7 +304,7 @@ static int test_copy(void) { hid_t a_copy; - herr_t status; + herr_t status; TESTING("H5Tcopy()"); @@ -313,12 +313,12 @@ test_copy(void) /* We should not be able to close a built-in byte */ H5E_BEGIN_TRY { - status = H5Tclose (H5T_NATIVE_SCHAR); + status = H5Tclose (H5T_NATIVE_SCHAR); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - HDputs (" Should not be able to close a predefined type!"); - goto error; + H5_FAILED(); + HDputs (" Should not be able to close a predefined type!"); + goto error; } PASSED(); @@ -328,7 +328,7 @@ test_copy(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_detect * @@ -505,7 +505,7 @@ error: return 1; } - + /*------------------------------------------------------------------------- * Function: test_compound_1 * @@ -669,19 +669,19 @@ error: return retval; } - + /*------------------------------------------------------------------------- - * Function: test_compound_2 + * Function: test_compound_2 * - * Purpose: Tests a compound type conversion where the source and - * destination are the same except for the order of the - * elements. + * Purpose: Tests a compound type conversion where the source and + * destination are the same except for the order of the + * elements. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 * * Modifications: @@ -692,19 +692,19 @@ static int test_compound_2(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; struct dt { - int e, d, c[4], b, a; + int e, d, c[4], b, a; } *d_ptr; - const size_t nelmts = NTESTELEM; - const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; - hid_t st=-1, dt=-1; + const size_t nelmts = NTESTELEM; + const hsize_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; hid_t array_dt; - int64_t nmembs; - int i; + int64_t nmembs; + int i; TESTING("compound element reordering"); @@ -716,15 +716,15 @@ test_compound_2(void) bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt)); orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st)); for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - s_ptr->a = i*8+0; - s_ptr->b = i*8+1; - s_ptr->c[0] = i*8+2; - s_ptr->c[1] = i*8+3; - s_ptr->c[2] = i*8+4; - s_ptr->c[3] = i*8+5; - s_ptr->d = i*8+6; - s_ptr->e = i*8+7; + s_ptr = ((struct st*)((void *)orig)) + i; + s_ptr->a = i*8+0; + s_ptr->b = i*8+1; + s_ptr->c[0] = i*8+2; + s_ptr->c[1] = i*8+3; + s_ptr->c[2] = i*8+4; + s_ptr->c[3] = i*8+5; + s_ptr->d = i*8+6; + s_ptr->e = i*8+7; } HDmemcpy(buf, orig, nelmts*sizeof(struct st)); @@ -754,26 +754,26 @@ test_compound_2(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->d, d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } } /* Release resources */ @@ -800,19 +800,19 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_compound_3 + * Function: test_compound_3 * - * Purpose: Tests compound conversions where the source and destination - * are the same except the destination is missing a couple - * members which appear in the source. + * Purpose: Tests compound conversions where the source and destination + * are the same except the destination is missing a couple + * members which appear in the source. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 * * Modifications: @@ -823,19 +823,19 @@ static int test_compound_3(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; struct dt { - int a, c[4], e; + int a, c[4], e; } *d_ptr; - const size_t nelmts = NTESTELEM; - const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; - hid_t st=-1, dt=-1; + const size_t nelmts = NTESTELEM; + const hsize_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; hid_t array_dt; - int64_t nmembs; - int i; + int64_t nmembs; + int i; TESTING("compound subset conversions"); @@ -884,24 +884,24 @@ test_compound_3(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", - d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n", + d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->e); + goto error; + } } /* Release resources */ @@ -927,19 +927,19 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_compound_4 + * Function: test_compound_4 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * smaller. + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * smaller. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 * * Modifications: @@ -951,22 +951,22 @@ test_compound_4(void) { struct st { - int a, b, c[4], d, e; + int a, b, c[4], d, e; } *s_ptr; struct dt { - short b; - int a, c[4]; - short d; - int e; + short b; + int a, c[4]; + short d; + int e; } *d_ptr; - const size_t nelmts = NTESTELEM; - const hsize_t four = 4; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; - hid_t st=-1, dt=-1; + const size_t nelmts = NTESTELEM; + const hsize_t four = 4; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; hid_t array_dt; - int64_t nmembs; - int i; + int64_t nmembs; + int i; TESTING("compound element shrinking & reordering"); @@ -1017,26 +1017,26 @@ test_compound_4(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->a != d_ptr->a || - s_ptr->b != d_ptr->b || - s_ptr->c[0] != d_ptr->c[0] || - s_ptr->c[1] != d_ptr->c[1] || - s_ptr->c[2] != d_ptr->c[2] || - s_ptr->c[3] != d_ptr->c[3] || - s_ptr->d != d_ptr->d || - s_ptr->e != d_ptr->e) { - H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], - s_ptr->c[3], s_ptr->d, s_ptr->e); - printf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", - d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], - d_ptr->c[3], d_ptr->d, d_ptr->e); - goto error; - } + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->a != d_ptr->a || + s_ptr->b != d_ptr->b || + s_ptr->c[0] != d_ptr->c[0] || + s_ptr->c[1] != d_ptr->c[1] || + s_ptr->c[2] != d_ptr->c[2] || + s_ptr->c[3] != d_ptr->c[3] || + s_ptr->d != d_ptr->d || + s_ptr->e != d_ptr->e) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2], + s_ptr->c[3], s_ptr->d, s_ptr->e); + HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n", + d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2], + d_ptr->c[3], d_ptr->d, d_ptr->e); + goto error; + } } /* Release resources */ @@ -1062,20 +1062,20 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_compound_5 + * Function: test_compound_5 * - * Purpose: Many versions of HDF5 have a bug in the optimized compound + * Purpose: Many versions of HDF5 have a bug in the optimized compound * datatype conversion function, H5T_conv_struct_opt(), which * is triggered when the top-level type contains a struct * which must undergo a conversion. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, June 17, 1999 * * Modifications: @@ -1167,19 +1167,19 @@ test_compound_5(void) return retval; } - + /*------------------------------------------------------------------------- - * Function: test_compound_6 + * Function: test_compound_6 * - * Purpose: Tests compound conversions when the destination has the same - * fields as the source but one or more of the fields are - * larger. + * Purpose: Tests compound conversions when the destination has the same + * fields as the source but one or more of the fields are + * larger. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, December 13, 2000 * * Modifications: @@ -1199,11 +1199,11 @@ test_compound_6(void) long d; } *d_ptr; - const size_t nelmts = NTESTELEM; - unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; - hid_t st=-1, dt=-1; - int64_t nmembs; - int i; + const size_t nelmts = NTESTELEM; + unsigned char *buf=NULL, *orig=NULL, *bkg=NULL; + hid_t st=-1, dt=-1; + int64_t nmembs; + int i; TESTING("compound element growing"); @@ -1244,18 +1244,18 @@ test_compound_6(void) /* Compare results */ for (i=0; i<(int)nelmts; i++) { - s_ptr = ((struct st*)((void *)orig)) + i; - d_ptr = ((struct dt*)((void *)buf)) + i; - if (s_ptr->b != d_ptr->b || - s_ptr->d != d_ptr->d) { - H5_FAILED(); - printf(" i=%d\n", i); - printf(" src={b=%d, d=%d\n", + s_ptr = ((struct st*)((void *)orig)) + i; + d_ptr = ((struct dt*)((void *)buf)) + i; + if (s_ptr->b != d_ptr->b || + s_ptr->d != d_ptr->d) { + H5_FAILED(); + HDprintf(" i=%d\n", i); + HDprintf(" src={b=%d, d=%d\n", (int)s_ptr->b, (int)s_ptr->d); - printf(" dst={b=%ld, d=%ld\n", + HDprintf(" dst={b=%ld, d=%ld\n", d_ptr->b, d_ptr->d); - goto error; - } + goto error; + } } /* Release resources */ @@ -1282,17 +1282,17 @@ error: } /*------------------------------------------------------------------------- - * Function: test_compound_7 + * Function: test_compound_7 * - * Purpose: Tests inserting fields into compound datatypes when the field + * Purpose: Tests inserting fields into compound datatypes when the field * overlaps the end of the compound datatype. Also, tests * increasing compound type size. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, December 18, 2001 * * Modifications: @@ -1325,43 +1325,43 @@ test_compound_7(void) if((tid1= H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_INT) < 0) { H5_FAILED(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"c",HOFFSET(struct s1,c),H5T_NATIVE_LONG) < 0) { H5_FAILED(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ if(H5Tget_size(tid1)!=sizeof(struct s1)) { H5_FAILED(); - printf("Incorrect size for struct 1\n"); + HDprintf("Incorrect size for struct 1\n"); goto error; } /* end if */ if((tid2= H5Tcopy(tid1)) < 0) { H5_FAILED(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ if(H5Tget_size(tid2)==sizeof(struct s2)) { H5_FAILED(); - printf("Incorrect size for struct 2\n"); + HDprintf("Incorrect size for struct 2\n"); goto error; } /* end if */ @@ -1371,7 +1371,7 @@ test_compound_7(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Inserted field 'd'?\n"); + HDprintf("Inserted field 'd'?\n"); goto error; } /* end if */ @@ -1381,33 +1381,33 @@ test_compound_7(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Shrunk compound type?\n"); + HDprintf("Shrunk compound type?\n"); goto error; } /* end if */ /* Increase compound type size and try inserting field again */ if(H5Tset_size(tid2, sizeof(struct s2)) < 0) { H5_FAILED(); - printf("Can't increase size for compound type\n"); + HDprintf("Can't increase size for compound type\n"); goto error; } /* end if */ if( H5Tinsert(tid2,"d",HOFFSET(struct s2,d),H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); - printf("Can't expand compound datatype\n"); + HDprintf("Can't expand compound datatype\n"); goto error; } /* end if */ if(H5Tget_size(tid2)!=sizeof(struct s2)) { H5_FAILED(); - printf("Incorrect size for struct 2\n"); + HDprintf("Incorrect size for struct 2\n"); goto error; } /* end if */ /* Release resources */ if (H5Tclose(tid1) < 0 || H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatypes\n"); + HDprintf("Can't close datatypes\n"); goto error; } /* end if */ @@ -1428,7 +1428,7 @@ error: return 1; } - + /*------------------------------------------------------------------------- * Function: test_compound_8 * @@ -1473,59 +1473,59 @@ test_compound_8(void) /* Create first compound datatype */ if((tid1 = H5Tcreate( H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"a",HOFFSET(struct s1,a),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1,"b",HOFFSET(struct s1,b),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ /* Make a copy of the type for later use */ if((tid1_copy = H5Tcopy(tid1)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #1\n"); + HDprintf("Can't copy type #1\n"); goto error; } /* end if */ /* Test H5Tpack for the first compound type */ if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype\n"); + HDprintf("Can't pack the compound datatype\n"); goto error; } /* end if */ if(H5Tlock(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ if(H5Tpack(tid1) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype for second time\n"); + HDprintf("Can't pack the compound datatype for second time\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(tid1)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the compound datatype\n"); + HDprintf("Can't get size of the compound datatype\n"); goto error; } /* end if */ if(tsize != (sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect\n"); + HDprintf("The size of the packed compound datatype is incorrect\n"); goto error; } /* end if */ @@ -1535,61 +1535,61 @@ test_compound_8(void) /* Create second compound datatype */ if((tid2 = H5Tcreate( H5T_COMPOUND, sizeof(struct s2))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid2,"c",HOFFSET(struct s2,c),H5T_NATIVE_CHAR) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ /* Insert the member of unpacked compound type */ if(H5Tinsert(tid2,"d",HOFFSET(struct s2,d),tid1_copy) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'd'\n"); + HDprintf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Make a copy of the type for later */ if((tid3=H5Tcopy(tid2)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #2\n"); + HDprintf("Can't copy type #2\n"); goto error; } /* end if */ /* Make a copy of the type for later */ if((tid2_copy = H5Tcopy(tid2)) < 0) { H5_FAILED(); AT(); - printf("Can't copy type #2\n"); + HDprintf("Can't copy type #2\n"); goto error; } /* end if */ /* Test H5Tpack for the second compound type */ if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype\n"); + HDprintf("Can't pack the compound datatype\n"); goto error; } /* end if */ if(H5Tlock(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ /* If the type is already packed, packing a locked type is OK */ if(H5Tpack(tid2) < 0) { H5_FAILED(); AT(); - printf("Can't pack the compound datatype for second time\n"); + HDprintf("Can't pack the compound datatype for second time\n"); goto error; } /* end if */ /* Lock unpacked type */ if(H5Tlock(tid3) < 0) { H5_FAILED(); AT(); - printf("Can't lock the compound datatype\n"); + HDprintf("Can't lock the compound datatype\n"); goto error; } /* end if */ @@ -1599,20 +1599,20 @@ test_compound_8(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); AT(); - printf("Packing locked datatype worked?\n"); + HDprintf("Packing locked datatype worked?\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(tid2)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the compound datatype\n"); + HDprintf("Can't get size of the compound datatype\n"); goto error; } /* end if */ if(tsize != (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); + HDprintf("The size of the packed compound datatype is incorrect: tsize = %zu\n", tsize); goto error; } /* end if */ @@ -1622,46 +1622,46 @@ test_compound_8(void) /* Create an array type of compound type */ if((arr_tid = H5Tarray_create2(tid2_copy, 1, dims)) < 0) { H5_FAILED(); AT(); - printf("Can't create an array datatype\n"); + HDprintf("Can't create an array datatype\n"); goto error; } /* end if */ /* Test H5Tpack for the array type */ if(H5Tpack(arr_tid) < 0) { H5_FAILED(); AT(); - printf("Can't pack the array datatype\n"); + HDprintf("Can't pack the array datatype\n"); goto error; } /* end if */ /* Verify the size of packed compound type */ if((tsize = H5Tget_size(arr_tid)) == 0) { H5_FAILED(); AT(); - printf("Can't get size of the array datatype\n"); + HDprintf("Can't get size of the array datatype\n"); goto error; } /* end if */ if(tsize != ARRAY_DIM * (sizeof(char) + sizeof(char) + sizeof(int))) { H5_FAILED(); AT(); - printf("The size of the packed array datatype is incorrect\n"); + HDprintf("The size of the packed array datatype is incorrect\n"); goto error; } /* end if */ if(H5Tclose(tid1_copy) < 0) { H5_FAILED(); AT(); - printf("Can't close the compound datatype\n"); + HDprintf("Can't close the compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2_copy) < 0) { H5_FAILED(); AT(); - printf("Can't close the compound datatype\n"); + HDprintf("Can't close the compound datatype\n"); goto error; } /* end if */ if(H5Tclose(arr_tid) < 0) { H5_FAILED(); AT(); - printf("Can't close the array datatype\n"); + HDprintf("Can't close the array datatype\n"); goto error; } /* end if */ @@ -1674,7 +1674,7 @@ test_compound_8(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_compound_9 * @@ -1721,51 +1721,51 @@ test_compound_9(void) h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct_w))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct_w, i1), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ str_id = H5Tcopy(H5T_C_S1); if(H5Tset_size(str_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); - printf("Can't set size for VL string\n"); + HDprintf("Can't set size for VL string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct_w, str), str_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct_w, i2), H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i2'\n"); + HDprintf("Can't insert field 'i2'\n"); goto error; } /* end if */ if(H5Tcommit2(file, "compound", cmpd_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); AT(); - printf("Can't commit datatype\n"); + HDprintf("Can't commit datatype\n"); goto error; } /* end if */ if(H5Tclose(cmpd_tid) < 0) { H5_FAILED(); AT(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ @@ -1774,44 +1774,44 @@ test_compound_9(void) if((dup_tid = H5Tcopy(cmpd_tid)) < 0) { H5_FAILED(); AT(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ dim1[0] = 1; if((space_id = H5Screate_simple(1, dim1, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset_id = H5Dcreate2(file, "Dataset", dup_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ rdata.str = NULL; @@ -1832,31 +1832,31 @@ test_compound_9(void) if((file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open file\n"); + HDprintf("cannot open file\n"); goto error; } /* end if */ if((dset_id = H5Dopen2(file, "Dataset", H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((space_id = H5Dget_space(dset_id)) < 0) { H5_FAILED(); AT(); - printf("Can't get space\n"); + HDprintf("Can't get space\n"); goto error; } /* end if */ if((cmpd_tid = H5Dget_type(dset_id)) < 0) { H5_FAILED(); AT(); - printf("cannot open dataset\n"); + HDprintf("cannot open dataset\n"); goto error; } /* end if */ if((dup_tid = H5Tcopy(cmpd_tid)) < 0) { H5_FAILED(); AT(); - printf("Can't copy datatype\n"); + HDprintf("Can't copy datatype\n"); goto error; } /* end if */ @@ -1865,19 +1865,19 @@ test_compound_9(void) if(H5Dread(dset_id, dup_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ if(rdata.i1!=wdata.i1 || rdata.i2!=wdata.i2 || strcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ rdata.str = NULL; @@ -1902,7 +1902,7 @@ test_compound_9(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_compound_10 * @@ -1960,84 +1960,84 @@ test_compound_10(void) h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create file!\n"); + HDprintf("Can't create file!\n"); goto error; } /* end if */ /* Create first compound datatype */ if((cmpd_tid = H5Tcreate( H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) { H5_FAILED(); AT(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"i1",HOFFSET(struct cmpd_struct,i1),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i1'\n"); + HDprintf("Can't insert field 'i1'\n"); goto error; } /* end if */ cstr_id = H5Tcopy(H5T_C_S1); if(H5Tset_size(cstr_id,H5T_VARIABLE) < 0) { H5_FAILED(); AT(); - printf("Can't set size for C string\n"); + HDprintf("Can't set size for C string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"c_string",HOFFSET(cmpd_struct,str),cstr_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'str'\n"); + HDprintf("Can't insert field 'str'\n"); goto error; } /* end if */ /* Create vl-string datatype */ if((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) { H5_FAILED(); AT(); - printf("Can't create VL string\n"); + HDprintf("Can't create VL string\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid, "vl_string",HOFFSET(cmpd_struct, text), vlstr_id) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'text'\n"); + HDprintf("Can't insert field 'text'\n"); goto error; } /* end if */ if(H5Tinsert(cmpd_tid,"i2",HOFFSET(struct cmpd_struct,i2),H5T_NATIVE_INT) < 0) { H5_FAILED(); AT(); - printf("Can't insert field 'i2'\n"); + HDprintf("Can't insert field 'i2'\n"); goto error; } /* end if */ /* Create the array datatype for c_string data */ if((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) { H5_FAILED(); AT(); - printf("Can't create array type\n"); + HDprintf("Can't create array type\n"); goto error; } /* end if */ dim1[0] = 1; if((space_id = H5Screate_simple(1,dim1,NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ if((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); AT(); - printf("Can't create dataset\n"); + HDprintf("Can't create dataset\n"); goto error; } /* end if */ if(H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't write data\n"); + HDprintf("Can't write data\n"); goto error; } /* end if */ if(H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't read data\n"); + HDprintf("Can't read data\n"); goto error; } /* end if */ @@ -2045,13 +2045,13 @@ test_compound_10(void) if(rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 || HDstrcmp(rdata[i].str, wdata[i].str)) { H5_FAILED(); AT(); - printf("incorrect read data\n"); + HDprintf("incorrect read data\n"); goto error; } /* end if */ if(rdata[i].text.len!=wdata[i].text.len) { H5_FAILED(); AT(); - printf("incorrect VL length\n"); + HDprintf("incorrect VL length\n"); goto error; } /* end if */ @@ -2059,18 +2059,18 @@ test_compound_10(void) t2 = wdata[i].text.p; if(strcmp((char*)t1, (char*)t2)) { H5_FAILED(); AT(); - printf("incorrect VL read data\n"); + HDprintf("incorrect VL read data\n"); goto error; } } /* end for */ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) { H5_FAILED(); AT(); - printf("Can't reclaim read data\n"); + HDprintf("Can't reclaim read data\n"); goto error; } /* end if */ @@ -2096,7 +2096,7 @@ test_compound_10(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_compound_11 * @@ -2181,7 +2181,7 @@ test_compound_11(void) ((big_t *)buf)[u].i1 = (int)(u * 3); ((big_t *)buf)[u].i2 = (int)(u * 5); ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); - sprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); + HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); } /* end for */ /* Make copy of buffer before conversion */ @@ -2190,7 +2190,7 @@ test_compound_11(void) dim[0] = NTESTELEM; if((space_id = H5Screate_simple(1, dim, NULL)) < 0) { H5_FAILED(); AT(); - printf("Can't create space\n"); + HDprintf("Can't create space\n"); goto error; } /* end if */ @@ -2206,29 +2206,29 @@ test_compound_11(void) /* Verify converted buffer is correct */ for(u=0; u=0) { - H5_FAILED(); - HDputs (" Predefined types should not be modifiable!"); - goto error; + H5_FAILED(); + HDputs (" Predefined types should not be modifiable!"); + goto error; } H5E_BEGIN_TRY { - status = H5Tclose (H5T_NATIVE_INT); + status = H5Tclose (H5T_NATIVE_INT); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - HDputs (" Predefined types should not be closable!"); - goto error; + H5_FAILED(); + HDputs (" Predefined types should not be closable!"); + goto error; } /* Copying a predefined type results in a modifiable copy */ @@ -3735,29 +3735,29 @@ test_transient (hid_t fapl) /* It should not be possible to create an attribute for a transient type */ H5E_BEGIN_TRY { - ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); + ret_id = H5Acreate2(type, "attr1", H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; if (ret_id>=0) { - H5_FAILED(); - HDputs (" Attributes should not be allowed for transient types!"); - goto error; + H5_FAILED(); + HDputs (" Attributes should not be allowed for transient types!"); + goto error; } /* Create a dataset from a transient datatype */ if(H5Tclose(type) < 0) goto error; if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) goto error; if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* The type returned from a dataset should not be modifiable */ if((t2 = H5Dget_type(dset)) < 0) goto error; H5E_BEGIN_TRY { - status = H5Tset_precision(t2, (size_t)256); + status = H5Tset_precision(t2, (size_t)256); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs (" Dataset datatypes should not be modifiable!"); - goto error; + H5_FAILED(); + HDputs (" Dataset datatypes should not be modifiable!"); + goto error; } if(H5Tclose(t2) < 0) goto error; @@ -3769,12 +3769,12 @@ test_transient (hid_t fapl) if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; if((t2 = H5Dget_type(dset)) < 0) goto error; H5E_BEGIN_TRY { - status = H5Tset_precision(t2, (size_t)256); + status = H5Tset_precision(t2, (size_t)256); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs (" Dataset datatypes should not be modifiable!"); - goto error; + H5_FAILED(); + HDputs (" Dataset datatypes should not be modifiable!"); + goto error; } if(H5Tclose(t2) < 0) goto error; @@ -3797,26 +3797,26 @@ test_transient (hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose (t2); - H5Tclose (type); - H5Sclose (space); - H5Dclose (dset); - H5Fclose (file); + H5Tclose (t2); + H5Tclose (type); + H5Sclose (space); + H5Dclose (dset); + H5Fclose (file); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- - * Function: test_named + * Function: test_named * - * Purpose: Tests named datatypes. + * Purpose: Tests named datatypes. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, June 1, 1998 * * Modifications: @@ -3826,29 +3826,29 @@ test_transient (hid_t fapl) static int test_named (hid_t fapl) { - hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1; - herr_t status; - static hsize_t ds_size[2] = {10, 20}; - size_t i,j; - unsigned attr_data[10][20]; - char filename[1024]; + hid_t file=-1, type=-1, space=-1, dset=-1, t2=-1, t3=-1, attr1=-1; + herr_t status; + static hsize_t ds_size[2] = {10, 20}; + size_t i,j; + unsigned attr_data[10][20]; + char filename[1024]; TESTING("named datatypes"); h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if ((file=H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { - goto error; + goto error; } if ((space = H5Screate_simple (2, ds_size, ds_size)) < 0) goto error; /* Predefined types cannot be committed */ H5E_BEGIN_TRY { - status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Tcommit2(file, "test_named_1 (should not exist)", H5T_NATIVE_INT, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs (" Predefined types should not be committable!"); - goto error; + H5_FAILED(); + HDputs (" Predefined types should not be committable!"); + goto error; } /* Copy a predefined datatype and commit the copy */ @@ -3856,34 +3856,34 @@ test_named (hid_t fapl) if(H5Tcommit2(file, "native-int", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) goto error; if((status = H5Tcommitted(type)) < 0) goto error; if(0 == status) { - H5_FAILED(); - HDputs (" H5Tcommitted() returned false!"); - goto error; + H5_FAILED(); + HDputs (" H5Tcommitted() returned false!"); + goto error; } /* We should not be able to modify a type after it has been committed. */ H5E_BEGIN_TRY { - status = H5Tset_precision (type, (size_t)256); + status = H5Tset_precision (type, (size_t)256); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - HDputs (" Committed type is not constant!"); - goto error; + H5_FAILED(); + HDputs (" Committed type is not constant!"); + goto error; } /* We should not be able to re-commit a committed type */ H5E_BEGIN_TRY { - status = H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Tcommit2(file, "test_named_2 (should not exist)", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs (" Committed types should not be recommitted!"); - goto error; + H5_FAILED(); + HDputs (" Committed types should not be recommitted!"); + goto error; } /* It should be possible to define an attribute for the named type */ if((attr1 = H5Acreate2(type, "attr1", H5T_NATIVE_UCHAR, space, - H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; for(i = 0; i < (size_t)ds_size[0]; i++) for(j = 0; j < (size_t)ds_size[1]; j++) attr_data[i][j] = (unsigned)(i * ds_size[1] + j); @@ -3897,9 +3897,9 @@ test_named (hid_t fapl) if((t2 = H5Tcopy(type)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(status) { - H5_FAILED(); - HDputs (" Copying a named type should result in a transient type!"); - goto error; + H5_FAILED(); + HDputs (" Copying a named type should result in a transient type!"); + goto error; } if(H5Tset_precision(t2, (size_t)256) < 0) goto error; if(H5Tclose(t2) < 0) goto error; @@ -3912,22 +3912,22 @@ test_named (hid_t fapl) FAIL_STACK_ERROR if((status = H5Tcommitted(type)) < 0) goto error; if(!status) { - H5_FAILED(); - HDputs (" Opened named types should be named types!"); - goto error; + H5_FAILED(); + HDputs (" Opened named types should be named types!"); + goto error; } /* Create a dataset that uses the named type */ if((dset = H5Dcreate2(file, "dset1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; + goto error; /* Get the dataset's datatype and make sure it's a named type */ if((t2 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(!status) { - H5_FAILED(); - HDputs (" Dataset type should be a named type!"); - goto error; + H5_FAILED(); + HDputs (" Dataset type should be a named type!"); + goto error; } /* Close the dataset, then close its type, then reopen the dataset */ @@ -3939,9 +3939,9 @@ test_named (hid_t fapl) if((t2 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(!status) { - H5_FAILED(); - HDputs (" Dataset type should be a named type!"); - goto error; + H5_FAILED(); + HDputs (" Dataset type should be a named type!"); + goto error; } /* @@ -3958,9 +3958,9 @@ test_named (hid_t fapl) if((t2 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(!status) { - H5_FAILED(); - HDputs (" Dataset type should be a named type!"); - goto error; + H5_FAILED(); + HDputs (" Dataset type should be a named type!"); + goto error; } if(H5Tclose(t2) < 0) goto error; @@ -3979,17 +3979,17 @@ test_named (hid_t fapl) if((t2 = H5Tcopy(type)) < 0) goto error; if((status = H5Tcommitted(t2)) < 0) goto error; if(status) { - H5_FAILED(); - HDputs (" Copied type should not be a named type!"); - goto error; + H5_FAILED(); + HDputs (" Copied type should not be a named type!"); + goto error; } if((dset = H5Dcreate2(file, "dset3", t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if((t3 = H5Dget_type(dset)) < 0) goto error; if((status = H5Tcommitted(t3)) < 0) goto error; if(status) { - H5_FAILED(); - HDputs (" Datatype from dataset using copied type should not be a named type!"); - goto error; + H5_FAILED(); + HDputs (" Datatype from dataset using copied type should not be a named type!"); + goto error; } if(H5Tclose(t3) < 0) goto error; if(H5Dclose(dset) < 0) goto error; @@ -4034,26 +4034,26 @@ test_named (hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(t3); - H5Tclose(t2); - H5Tclose(type); - H5Sclose(space); - H5Dclose(dset); - H5Fclose(file); + H5Tclose(t3); + H5Tclose(t2); + H5Tclose(type); + H5Sclose(space); + H5Dclose(dset); + H5Fclose(file); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- - * Function: mkstr + * Function: mkstr * - * Purpose: Create a new string datatype + * Purpose: Create a new string datatype * - * Return: Success: New type - * Failure: -1 + * Return: Success: New type + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 10, 1998 * *------------------------------------------------------------------------- @@ -4061,7 +4061,7 @@ error: static hid_t mkstr(size_t len, H5T_str_t strpad) { - hid_t t; + hid_t t; if((t = H5Tcopy(H5T_C_S1)) < 0) return -1; @@ -4073,16 +4073,16 @@ mkstr(size_t len, H5T_str_t strpad) return t; } - + /*------------------------------------------------------------------------- - * Function: test_str_create + * Function: test_str_create * - * Purpose: Test string type creation using H5Tcreate + * Purpose: Test string type creation using H5Tcreate * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 19 May 2011 * *------------------------------------------------------------------------- @@ -4123,10 +4123,10 @@ test_str_create(void) if(!H5Tequal(vlen_str1, vlen_str2)) goto error; if((is_vl_str = H5Tis_variable_str(vlen_str1)) < 0) goto error; - if(!is_vl_str) goto error; + if(!is_vl_str) goto error; if((is_vl_str = H5Tis_variable_str(vlen_str2)) < 0) goto error; - if(!is_vl_str) goto error; + if(!is_vl_str) goto error; if(H5Tclose(vlen_str1) < 0) goto error; if(H5Tclose(vlen_str2) < 0) goto error; @@ -4139,16 +4139,16 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_conv_str_1 + * Function: test_conv_str_1 * - * Purpose: Test string conversions + * Purpose: Test string conversions * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 10, 1998 * *------------------------------------------------------------------------- @@ -4156,8 +4156,8 @@ error: static int test_conv_str_1(void) { - char *buf = NULL; - hid_t src_type = -1; + char *buf = NULL; + hid_t src_type = -1; hid_t dst_type = -1; TESTING("string conversions"); @@ -4172,15 +4172,15 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghi\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Truncated C-string test failed"); - goto error; + H5_FAILED(); + HDputs(" Truncated C-string test failed"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0\0\0\0\0\0abcd\0\0\0\0\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Extended C-string test failed"); - goto error; + H5_FAILED(); + HDputs(" Extended C-string test failed"); + goto error; } HDfree(buf); buf = NULL; @@ -4196,15 +4196,15 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" Truncated C buffer test failed"); - goto error; + H5_FAILED(); + HDputs(" Truncated C buffer test failed"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Extended C buffer test failed"); - goto error; + H5_FAILED(); + HDputs(" Extended C buffer test failed"); + goto error; } HDfree(buf); buf = NULL; @@ -4220,15 +4220,15 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" Truncated Fortran-string test failed"); - goto error; + H5_FAILED(); + HDputs(" Truncated Fortran-string test failed"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde abcde ", (size_t)20)) { - H5_FAILED(); - HDputs(" Extended Fortran-string test failed"); - goto error; + H5_FAILED(); + HDputs(" Extended Fortran-string test failed"); + goto error; } HDfree(buf); buf = NULL; @@ -4247,25 +4247,25 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" Non-terminated string test 1"); - goto error; + H5_FAILED(); + HDputs(" Non-terminated string test 1"); + goto error; } H5Tclose(dst_type); if((dst_type = mkstr((size_t)5, H5T_STR_NULLTERM)) < 0) goto error; HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" Non-terminated string test 2"); - goto error; + H5_FAILED(); + HDputs(" Non-terminated string test 2"); + goto error; } HDmemcpy(buf, "abcdeabcdexxxxxxxxxx", (size_t)20); if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Non-terminated string test 2"); - goto error; + H5_FAILED(); + HDputs(" Non-terminated string test 2"); + goto error; } HDfree(buf); buf = NULL; @@ -4281,30 +4281,30 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghi\0abcdefghi\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi abcdefghi ", (size_t)20)) { - H5_FAILED(); - HDputs(" C string to Fortran test 1"); - goto error; + H5_FAILED(); + HDputs(" C string to Fortran test 1"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghi\0abcdefghi\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C string test 1"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C string test 1"); + goto error; } if (H5Tclose(dst_type) < 0) goto error; if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error; HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" C string to Fortran test 2"); - goto error; + H5_FAILED(); + HDputs(" C string to Fortran test 2"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C string test 2"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C string test 2"); + goto error; } if (H5Tclose(src_type) < 0) goto error; if (H5Tclose(dst_type) < 0) goto error; @@ -4313,15 +4313,15 @@ test_conv_str_1(void) HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) { - H5_FAILED(); - HDputs(" C string to Fortran test 3"); - goto error; + H5_FAILED(); + HDputs(" C string to Fortran test 3"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C string test 3"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C string test 3"); + goto error; } HDfree(buf); buf = NULL; @@ -4337,30 +4337,30 @@ test_conv_str_1(void) HDmemcpy(buf, "abcdefghijabcdefghij", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" C buffer to Fortran test 1"); - goto error; + H5_FAILED(); + HDputs(" C buffer to Fortran test 1"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdefghijabcdefghij", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C buffer test 1"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C buffer test 1"); + goto error; } if (H5Tclose(dst_type) < 0) goto error; if((dst_type = mkstr((size_t)5, H5T_STR_SPACEPAD)) < 0) goto error; HDmemcpy(buf, "abcdefgh\0\0abcdefgh\0\0", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcdeabcdeabcdefgh\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" C buffer to Fortran test 2"); - goto error; + H5_FAILED(); + HDputs(" C buffer to Fortran test 2"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcde\0\0\0\0\0abcde\0\0\0\0\0", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C buffer test 2"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C buffer test 2"); + goto error; } if (H5Tclose(src_type) < 0) goto error; if (H5Tclose(dst_type) < 0) goto error; @@ -4369,15 +4369,15 @@ test_conv_str_1(void) HDmemcpy(buf, "abcd\0abcd\0xxxxxxxxxx", (size_t)20); if (H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd abcd ", (size_t)20)) { - H5_FAILED(); - HDputs(" C buffer to Fortran test 3"); - goto error; + H5_FAILED(); + HDputs(" C buffer to Fortran test 3"); + goto error; } if (H5Tconvert(dst_type, src_type, (size_t)2, buf, NULL, H5P_DEFAULT) < 0) goto error; if (HDmemcmp(buf, "abcd\0abcd\0abcd ", (size_t)20)) { - H5_FAILED(); - HDputs(" Fortran to C buffer test 3"); - goto error; + H5_FAILED(); + HDputs(" Fortran to C buffer test 3"); + goto error; } if(H5Tclose(src_type) < 0) goto error; if(H5Tclose(dst_type) < 0) goto error; @@ -4393,7 +4393,7 @@ test_conv_str_1(void) error: H5E_BEGIN_TRY { - H5Tclose(src_type); + H5Tclose(src_type); H5Tclose(dst_type); } H5E_END_TRY; @@ -4408,16 +4408,16 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_conv_str_2 + * Function: test_conv_str_2 * - * Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed. + * Purpose: Tests C-to-Fortran and Fortran-to-C string conversion speed. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 10, 1998 * *------------------------------------------------------------------------- @@ -4425,12 +4425,12 @@ error: static int test_conv_str_2(void) { - char *buf = NULL, s[80]; - hid_t c_type = -1; - hid_t f_type = -1; - const size_t nelmts = NTESTELEM; - size_t i, j, nchars; - int ret_value = 1; + char *buf = NULL, s[80]; + hid_t c_type = -1; + hid_t f_type = -1; + const size_t nelmts = NTESTELEM; + size_t i, j, nchars; + int ret_value = 1; /* * Initialize types and buffer. @@ -4439,16 +4439,16 @@ test_conv_str_2(void) if((f_type = mkstr((size_t)8, H5T_STR_SPACEPAD)) < 0) goto error; if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) goto error; for(i = 0; i < nelmts; i++) { - nchars = (size_t)(HDrand() % 8); - for(j = 0; j < nchars; j++) - buf[i * 8 + j] = (char)('a' + HDrand() % 26); - while(j < nchars) + nchars = (size_t)(HDrand() % 8); + for(j = 0; j < nchars; j++) + buf[i * 8 + j] = (char)('a' + HDrand() % 26); + while(j < nchars) buf[i * 8 + j++] = '\0'; } /* end for */ /* Do the conversions */ - sprintf(s, "Testing random string conversion speed"); - printf("%-70s", s); + HDsprintf(s, "Testing random string conversion speed"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; @@ -4475,17 +4475,17 @@ error: return ret_value; } - + /*------------------------------------------------------------------------- - * Function: test_conv_str_3 + * Function: test_conv_str_3 * - * Purpose: Tests some functions that are or aren't supposed to work + * Purpose: Tests some functions that are or aren't supposed to work * for string type. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Tuesday, April 4, 2006 * *------------------------------------------------------------------------- @@ -4493,12 +4493,12 @@ error: static int test_conv_str_3(void) { - char *buf=NULL; - hid_t type = -1; - hid_t super = -1; - const size_t nelmts = NTESTELEM; - size_t i, j, nchars; - int ret_value = 1; + char *buf=NULL; + hid_t type = -1; + hid_t super = -1; + const size_t nelmts = NTESTELEM; + size_t i, j, nchars; + int ret_value = 1; size_t size; H5T_pad_t inpad; H5T_sign_t sign; @@ -4514,10 +4514,10 @@ test_conv_str_3(void) if(NULL == (buf = (char*)HDcalloc(nelmts, (size_t)8))) FAIL_PUTS_ERROR("Allocation failed."); for(i = 0; i < nelmts; i++) { - nchars = (size_t)(HDrand() % 8); - for(j = 0; j < nchars; j++) - buf[i * 8 + j] = (char)('a' + HDrand() % 26); - while(j < nchars) + nchars = (size_t)(HDrand() % 8); + for(j = 0; j < nchars; j++) + buf[i * 8 + j] = (char)('a' + HDrand() % 26); + while(j < nchars) buf[i * 8 + j++] = '\0'; } /* end for */ @@ -4580,7 +4580,7 @@ error: H5Tclose(super); } H5E_END_TRY; - if(buf) + if(buf) HDfree(buf); if(tag) H5free_memory(tag); /* Technically allocated by API call */ @@ -4593,17 +4593,17 @@ error: return ret_value; /* Number of errors */ } - + /*------------------------------------------------------------------------- - * Function: test_conv_enum_1 + * Function: test_conv_enum_1 * - * Purpose: Test conversion speed for enum datatypes + * Purpose: Test conversion speed for enum datatypes * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, January 5, 1999 * * Modifications: @@ -4614,11 +4614,11 @@ static int test_conv_enum_1(void) { const size_t nelmts=NTESTELEM; - int i, val, *buf=NULL; - hid_t t1 = -1; - hid_t t2 = -1; - char s[80]; - int ret_value = 1; + int i, val, *buf=NULL; + hid_t t1 = -1; + hid_t t2 = -1; + char s[80]; + int ret_value = 1; size_t u; /* Build the datatypes */ @@ -4626,9 +4626,9 @@ test_conv_enum_1(void) if((t2 = H5Tenum_create(H5T_NATIVE_INT)) < 0) goto error; s[1] = '\0'; for(i = 0; i < 26; i++) { - s[0] = (char)('A' + i); - H5Tenum_insert(t1, s, &i); - H5Tenum_insert(t2, s, (val = i * 1000 + i, &val)); + s[0] = (char)('A' + i); + H5Tenum_insert(t1, s, &i); + H5Tenum_insert(t2, s, (val = i * 1000 + i, &val)); } /* end for */ /* Initialize the buffer */ @@ -4638,14 +4638,14 @@ test_conv_enum_1(void) buf[u] = HDrand() % 26; /* Conversions */ - sprintf(s, "Testing random enum conversion O(N)"); - printf("%-70s", s); + HDsprintf(s, "Testing random enum conversion O(N)"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); - sprintf(s, "Testing random enum conversion O(N log N)"); - printf("%-70s", s); + HDsprintf(s, "Testing random enum conversion O(N log N)"); + HDprintf("%-70s", s); HDfflush(stdout); if(H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0) goto error; PASSED(); @@ -4669,7 +4669,7 @@ error: return ret_value; } - + /*------------------------------------------------------------------------- * Function: test_conv_enum_2 * @@ -4695,7 +4695,7 @@ test_conv_enum_2(void) "PURPLE", "ORANGE", "WHITE" }; - + TESTING("non-native enumeration type conversion"); /* Source enum type */ @@ -4731,7 +4731,7 @@ test_conv_enum_2(void) if (data[i] != i%8) { if (!nerrors++) { H5_FAILED(); - printf("element %d is %d but should have been %d\n", + HDprintf("element %d is %d but should have been %d\n", i, data[i], i%8); } } @@ -4745,7 +4745,7 @@ test_conv_enum_2(void) /* Failure */ if (nerrors) { - printf("total of %d conversion errors out of %d elements for enums\n", + HDprintf("total of %d conversion errors out of %d elements for enums\n", nerrors, NTESTELEM); return 1; } @@ -4754,17 +4754,17 @@ test_conv_enum_2(void) return 0; } - + /*------------------------------------------------------------------------- - * Function: test_conv_bitfield + * Function: test_conv_bitfield * - * Purpose: Test bitfield conversions. + * Purpose: Test bitfield conversions. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 * * Modifications: @@ -4774,8 +4774,8 @@ test_conv_enum_2(void) static int test_conv_bitfield(void) { - unsigned char buf[4]; - hid_t st=-1, dt=-1; + unsigned char buf[4]; + hid_t st=-1, dt=-1; TESTING("bitfield conversions"); @@ -4790,10 +4790,10 @@ test_conv_bitfield(void) buf[2] = buf[3] = 0x55; /*irrelevant*/ if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) { - H5_FAILED(); - printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", + buf[3], buf[2], buf[1], buf[0]); + goto error; } /* @@ -4809,10 +4809,10 @@ test_conv_bitfield(void) buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) { - H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", + buf[3], buf[2], buf[1], buf[0]); + goto error; } /* @@ -4823,10 +4823,10 @@ test_conv_bitfield(void) buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0; if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error; if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) { - H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", - buf[3], buf[2], buf[1], buf[0]); - goto error; + H5_FAILED(); + printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", + buf[3], buf[2], buf[1], buf[0]); + goto error; } H5Tclose(st); @@ -4851,18 +4851,18 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: test_bitfield_funcs + * Function: test_bitfield_funcs * - * Purpose: Test some datatype functions that are and aren't supposed + * Purpose: Test some datatype functions that are and aren't supposed * work for bitfield type. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 * * Modifications: @@ -4872,7 +4872,7 @@ error: static int test_bitfield_funcs(void) { - hid_t type=-1, ntype=-1, super=-1; + hid_t type=-1, ntype=-1, super=-1; size_t size; char* tag=0; H5T_pad_t inpad; @@ -4905,7 +4905,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (size>0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4914,7 +4914,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (inpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4923,7 +4923,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (cset>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4932,7 +4932,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (strpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4941,7 +4941,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4950,7 +4950,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (tag) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4959,7 +4959,7 @@ test_bitfield_funcs(void) } H5E_END_TRY; if (super>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -4980,17 +4980,17 @@ error: return retval; } - + /*------------------------------------------------------------------------- - * Function: convert_opaque + * Function: convert_opaque * - * Purpose: A fake opaque conversion functions + * Purpose: A fake opaque conversion functions * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, June 4, 1999 * * Modifications: @@ -4999,25 +4999,25 @@ error: */ static herr_t convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cdata, - size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride, + size_t H5_ATTR_UNUSED nelmts, size_t H5_ATTR_UNUSED buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf, - void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid) + void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid) { if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++; return 0; } - + /*------------------------------------------------------------------------- - * Function: test_opaque + * Function: test_opaque * - * Purpose: Driver function to test opaque datatypes + * Purpose: Driver function to test opaque datatypes * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * June 2, 2004 * * Modifications: @@ -5050,17 +5050,17 @@ test_opaque(void) return num_errors; } - + /*------------------------------------------------------------------------- - * Function: opaque_check + * Function: opaque_check * - * Purpose: Test opaque datatypes + * Purpose: Test opaque datatypes * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, May 20, 1999 * *------------------------------------------------------------------------- @@ -5069,10 +5069,10 @@ static int opaque_check(int tag_it) { #define OPAQUE_NELMTS 1000 - hid_t st=-1, dt=-1; - herr_t status; - char buf[1]; /*not really used*/ - int saved; + hid_t st=-1, dt=-1; + herr_t status; + char buf[1]; /*not really used*/ + int saved; saved = num_opaque_conversions_g = 0; @@ -5088,29 +5088,29 @@ opaque_check(int tag_it) /* Make sure that we can't convert between the types yet */ H5E_BEGIN_TRY { - status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); + status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT); } H5E_END_TRY; if (status>=0) { - H5_FAILED(); - printf(" opaque conversion should have failed but succeeded\n"); - goto error; + H5_FAILED(); + printf(" opaque conversion should have failed but succeeded\n"); + goto error; } /* Register a conversion function */ if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) - goto error; + goto error; /* Try the conversion again, this time it should work */ if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error; if (saved+1 != num_opaque_conversions_g) { - H5_FAILED(); - printf(" unexpected number of opaque conversions\n"); - goto error; + H5_FAILED(); + printf(" unexpected number of opaque conversions\n"); + goto error; } /* Unregister conversion function */ if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0) - goto error; + goto error; H5Tclose(st); H5Tclose(dt); @@ -5123,16 +5123,16 @@ opaque_check(int tag_it) return 1; } - + /*------------------------------------------------------------------------- - * Function: opaque_long + * Function: opaque_long * - * Purpose: Test named (committed) opaque datatypes w/very long tags + * Purpose: Test named (committed) opaque datatypes w/very long tags * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 14, 2005 * *------------------------------------------------------------------------- @@ -5140,8 +5140,8 @@ opaque_check(int tag_it) static int opaque_long(void) { - char *long_tag = NULL; - hid_t dt = -1; + char *long_tag = NULL; + hid_t dt = -1; herr_t ret; /* Build opaque type */ @@ -5154,7 +5154,7 @@ opaque_long(void) /* Set opaque type's tag */ H5E_BEGIN_TRY { - ret = H5Tset_tag(dt, long_tag); + ret = H5Tset_tag(dt, long_tag); } H5E_END_TRY; if(ret != FAIL) TEST_ERROR @@ -5175,18 +5175,18 @@ error: return 1; } - + /*------------------------------------------------------------------------- - * Function: opaque_funcs + * Function: opaque_funcs * - * Purpose: Test some type functions that are and aren't supposed to + * Purpose: Test some type functions that are and aren't supposed to * work with opaque type. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, April 5, 2006 * * Modifications: @@ -5196,7 +5196,7 @@ error: static int opaque_funcs(void) { - hid_t type = -1, super=-1; + hid_t type = -1, super=-1; size_t size; H5T_pad_t inpad; H5T_cset_t cset; @@ -5214,7 +5214,7 @@ opaque_funcs(void) ret=H5Tset_precision(type, (size_t)32); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5222,7 +5222,7 @@ opaque_funcs(void) ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5230,7 +5230,7 @@ opaque_funcs(void) size=H5Tget_ebias(type); } H5E_END_TRY; if (size>0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5238,7 +5238,7 @@ opaque_funcs(void) inpad=H5Tget_inpad(type); } H5E_END_TRY; if (inpad>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5246,7 +5246,7 @@ opaque_funcs(void) cset=H5Tget_cset(type); } H5E_END_TRY; if (cset>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5254,7 +5254,7 @@ opaque_funcs(void) strpad=H5Tget_strpad(type); } H5E_END_TRY; if (strpad>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5262,7 +5262,7 @@ opaque_funcs(void) ret=H5Tset_offset(type, (size_t)16); } H5E_END_TRY; if (ret>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5270,7 +5270,7 @@ opaque_funcs(void) sign = H5Tget_sign(type); } H5E_END_TRY; if (sign>-1) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5278,7 +5278,7 @@ opaque_funcs(void) super = H5Tget_super(type); } H5E_END_TRY; if (super>=0) { - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); TEST_ERROR } /* end if */ @@ -5291,7 +5291,7 @@ opaque_funcs(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_encode * @@ -5332,7 +5332,7 @@ test_encode(void) size_t enum_buf_size = 0; size_t vlstr_buf_size = 0; unsigned char *cmpd_buf=NULL, *enum_buf=NULL, *vlstr_buf=NULL; - hid_t ret_id; + hid_t ret_id; herr_t ret; TESTING("functions of encoding and decoding datatypes"); @@ -5349,71 +5349,71 @@ test_encode(void) /* Create a compound datatype */ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) { H5_FAILED(); - printf("Can't create datatype!\n"); + HDprintf("Can't create datatype!\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT) < 0) { H5_FAILED(); - printf("Can't insert field 'a'\n"); + HDprintf("Can't insert field 'a'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT) < 0) { H5_FAILED(); - printf("Can't insert field 'b'\n"); + HDprintf("Can't insert field 'b'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG) < 0) { H5_FAILED(); - printf("Can't insert field 'c'\n"); + HDprintf("Can't insert field 'c'\n"); goto error; } /* end if */ if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE) < 0) { H5_FAILED(); - printf("Can't insert field 'd'\n"); + HDprintf("Can't insert field 'd'\n"); goto error; } /* end if */ /* Create a enumerate datatype */ if((tid2=H5Tcreate(H5T_ENUM, sizeof(short))) < 0) { H5_FAILED(); - printf("Can't create enumerate type\n"); + HDprintf("Can't create enumerate type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val)) < 0) { H5_FAILED(); - printf("Can't insert field into enumeration type\n"); + HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ /* Create a variable-length string type */ if((tid3 = H5Tcopy(H5T_C_S1)) < 0) { H5_FAILED(); - printf("Can't copy a string type\n"); + HDprintf("Can't copy a string type\n"); goto error; } /* end if */ if(H5Tset_size(tid3, H5T_VARIABLE) < 0) { H5_FAILED(); - printf("Can't the string type to be variable-length\n"); + HDprintf("Can't the string type to be variable-length\n"); goto error; } /* end if */ @@ -5424,7 +5424,7 @@ test_encode(void) /* Encode compound type in a buffer */ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5433,17 +5433,17 @@ test_encode(void) /* Try decoding bogus buffer */ H5E_BEGIN_TRY { - ret_id = H5Tdecode(cmpd_buf); + ret_id = H5Tdecode(cmpd_buf); } H5E_END_TRY; if(ret_id!=FAIL) { H5_FAILED(); - printf("Decoded bogus buffer!\n"); + HDprintf("Decoded bogus buffer!\n"); goto error; } if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5454,19 +5454,19 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid1, tid1)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for compound type. */ if(H5Tget_nmembers(decoded_tid1)!=4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid1, "c")!=2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ @@ -5474,7 +5474,7 @@ test_encode(void) /* Encode enumerate type in a buffer */ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ @@ -5483,33 +5483,33 @@ test_encode(void) if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); - printf("Can't decode enumerate type\n"); + HDprintf("Can't decode enumerate type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid2, tid2)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type. */ if(H5Tget_nmembers(decoded_tid2)!=5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid2, "ORANGE") != 3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ @@ -5517,7 +5517,7 @@ test_encode(void) /* Encode VL string type in a buffer */ if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ @@ -5526,26 +5526,26 @@ test_encode(void) if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ /* Decode from the VL string buffer and return an object handle */ if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) { H5_FAILED(); - printf("Can't decode VL string type\n"); + HDprintf("Can't decode VL string type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid3, tid3)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ if(!H5Tis_variable_str(decoded_tid3)) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ @@ -5556,17 +5556,17 @@ test_encode(void) /* Commit compound datatype and close it */ if(H5Tcommit2(file, compnd_type, tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(cmpd_buf); @@ -5575,17 +5575,17 @@ test_encode(void) /* Commit enumeration datatype and close it */ if(H5Tcommit2(file, enum_type, tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit compound datatype\n"); + HDprintf("Can't commit compound datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(enum_buf); @@ -5594,17 +5594,17 @@ test_encode(void) /* Commit enumeration datatype and close it */ if(H5Tcommit2(file, vlstr_type, tid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Can't commit vl string datatype\n"); + HDprintf("Can't commit vl string datatype\n"); goto error; } /* end if */ if(H5Tclose(tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(decoded_tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ HDfree(vlstr_buf); @@ -5625,7 +5625,7 @@ test_encode(void) /* Encode compound type in a buffer */ if(H5Tencode(tid1, NULL, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5634,7 +5634,7 @@ test_encode(void) if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size) < 0) { H5_FAILED(); - printf("Can't encode compound type\n"); + HDprintf("Can't encode compound type\n"); goto error; } /* end if */ @@ -5645,26 +5645,26 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid1, tid1)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for compound type. */ if(H5Tget_nmembers(decoded_tid1)!=4) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid1, "c")!=2) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Encode enumerate type in a buffer */ if(H5Tencode(tid2, NULL, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ @@ -5673,40 +5673,40 @@ test_encode(void) if(H5Tencode(tid2, enum_buf, &enum_buf_size) < 0) { H5_FAILED(); - printf("Can't encode enumerate type\n"); + HDprintf("Can't encode enumerate type\n"); goto error; } /* end if */ /* Decode from the enumerate buffer and return an object handle */ if((decoded_tid2=H5Tdecode(enum_buf)) < 0) { H5_FAILED(); - printf("Can't decode enumerate type\n"); + HDprintf("Can't decode enumerate type\n"); goto error; } /* end if */ /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid2, tid2)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type. */ if(H5Tget_nmembers(decoded_tid2)!=5) { H5_FAILED(); - printf("Can't get member number\n"); + HDprintf("Can't get member number\n"); goto error; } /* end if */ if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { H5_FAILED(); - printf("Can't get correct index number\n"); + HDprintf("Can't get correct index number\n"); goto error; } /* end if */ /* Encode VL string type in a buffer */ if(H5Tencode(tid3, NULL, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ @@ -5715,14 +5715,14 @@ test_encode(void) if(H5Tencode(tid3, vlstr_buf, &vlstr_buf_size) < 0) { H5_FAILED(); - printf("Can't encode VL string type\n"); + HDprintf("Can't encode VL string type\n"); goto error; } /* end if */ /* Decode from the VL string buffer and return an object handle */ if((decoded_tid3=H5Tdecode(vlstr_buf)) < 0) { H5_FAILED(); - printf("Can't decode VL string type\n"); + HDprintf("Can't decode VL string type\n"); goto error; } /* end if */ HDfree(vlstr_buf); @@ -5730,12 +5730,12 @@ test_encode(void) /* Verify that the datatype was copied exactly */ if(H5Tequal(decoded_tid3, tid3)<=0) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ if(!H5Tis_variable_str(decoded_tid3)) { H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); + HDprintf("Datatype wasn't encoded & decoded identically\n"); goto error; } /* end if */ @@ -5745,69 +5745,69 @@ test_encode(void) */ /* Make sure the reference counts for the decoded datatypes are one. */ - if(H5Iget_ref(decoded_tid1) != 1) { + if(H5Iget_ref(decoded_tid1) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ - if(H5Iget_ref(decoded_tid2) != 1) { + if(H5Iget_ref(decoded_tid2) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ - if(H5Iget_ref(decoded_tid3) != 1) { + if(H5Iget_ref(decoded_tid3) != 1) { H5_FAILED(); - printf("Decoded datatype has incorrect reference count\n"); + HDprintf("Decoded datatype has incorrect reference count\n"); goto error; } /* end if */ - /* Make sure the reference counts for the decoded datatypes can be + /* Make sure the reference counts for the decoded datatypes can be * decremented and the datatypes are closed. */ - if(H5Idec_ref(decoded_tid1) != 0) { + if(H5Idec_ref(decoded_tid1) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ - if(H5Idec_ref(decoded_tid2) != 0) { + if(H5Idec_ref(decoded_tid2) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ - if(H5Idec_ref(decoded_tid3) != 0) { + if(H5Idec_ref(decoded_tid3) != 0) { H5_FAILED(); - printf("Decoded datatype can't close\n"); + HDprintf("Decoded datatype can't close\n"); goto error; } /* end if */ /* Make sure the decoded datatypes are already closed. */ H5E_BEGIN_TRY { - ret = H5Tclose(decoded_tid1); + ret = H5Tclose(decoded_tid1); } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } H5E_BEGIN_TRY { - ret = H5Tclose(decoded_tid2); + ret = H5Tclose(decoded_tid2); } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } H5E_BEGIN_TRY { - ret = H5Tclose(decoded_tid3); + ret = H5Tclose(decoded_tid3); } H5E_END_TRY; if(ret!=FAIL) { H5_FAILED(); - printf("Decoded datatype should have been closed\n"); + HDprintf("Decoded datatype should have been closed\n"); goto error; } @@ -5818,23 +5818,23 @@ test_encode(void) /* Close datatype and file */ if(H5Tclose(tid1) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(tid2) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Tclose(tid3) < 0) { H5_FAILED(); - printf("Can't close datatype\n"); + HDprintf("Can't close datatype\n"); goto error; } /* end if */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf("Can't close file\n"); + HDprintf("Can't close file\n"); goto error; } /* end if */ @@ -5857,7 +5857,7 @@ test_encode(void) return 1; } - + /*------------------------------------------------------------------------- * Function: test_latest * @@ -5884,7 +5884,7 @@ test_latest(void) hid_t file = (-1); /* File ID */ hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */ hid_t fapl = (-1); /* File access property list */ - H5O_info_t oi; /* Stat buffer for committed datatype */ + H5O_info_t oi; /* Stat buffer for committed datatype */ hsize_t old_dtype_oh_size; /* Size of object header with "old" format */ hsize_t new_dtype_oh_size; /* Size of object header with "new" format */ char filename[1024]; /* Buffer for filename */ @@ -6075,7 +6075,7 @@ conv_except(H5T_conv_except_t except_type, hid_t H5_ATTR_UNUSED src_id, hid_t H5 return(H5T_CONV_UNHANDLED); } - + /*------------------------------------------------------------------------- * Function: test_int_float_except * @@ -6218,7 +6218,7 @@ error: #endif /* H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4 */ } /* end test_int_float_except() */ - + /*------------------------------------------------------------------------- * Function: test_set_order * @@ -6379,11 +6379,11 @@ error: return 1; } /* end test_set_order() */ - + /*------------------------------------------------------------------------- * Function: test_set_order_compound * - * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound + * Purpose: Tests H5Tset_order/H5Tget_order for complicated compound * type. * * Return: Success: 0 @@ -6415,13 +6415,13 @@ test_set_order_compound(hid_t fapl) hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1; hid_t vl_id = -1; hsize_t dims[2] = {3, 4}; /* Array dimenstions */ - char filename[1024]; + char filename[1024]; herr_t ret; /* Generic return value */ TESTING("H5Tset/get_order for compound type"); if((memb_cmpd = H5Tcreate(H5T_COMPOUND, sizeof(atomic_cmpd))) < 0) FAIL_STACK_ERROR - if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR + if(H5Tinsert(memb_cmpd, "i", HOFFSET(atomic_cmpd, i), H5T_NATIVE_INT) < 0) FAIL_STACK_ERROR if(H5Tinsert(memb_cmpd, "c", HOFFSET(atomic_cmpd, c), H5T_NATIVE_CHAR) < 0) FAIL_STACK_ERROR if(H5Tinsert(memb_cmpd, "s", HOFFSET(atomic_cmpd, s), H5T_NATIVE_SHORT) < 0) FAIL_STACK_ERROR if(H5Tinsert(memb_cmpd, "f", HOFFSET(atomic_cmpd, f), H5T_NATIVE_FLOAT) < 0) FAIL_STACK_ERROR @@ -6441,19 +6441,19 @@ test_set_order_compound(hid_t fapl) /* Create a compound type using the types above. */ if((cmpd = H5Tcreate(H5T_COMPOUND, sizeof(complex_cmpd))) < 0) FAIL_STACK_ERROR - if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR - if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR - if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR - if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR + if(H5Tinsert(cmpd, "a", HOFFSET(complex_cmpd, a), memb_cmpd) < 0) FAIL_STACK_ERROR + if(H5Tinsert(cmpd, "vl_type", HOFFSET(complex_cmpd, vl), vl_id) < 0) FAIL_STACK_ERROR + if(H5Tinsert(cmpd, "b", HOFFSET(complex_cmpd, b), memb_array1) < 0) FAIL_STACK_ERROR + if(H5Tinsert(cmpd, "d", HOFFSET(complex_cmpd, d), memb_array2) < 0) FAIL_STACK_ERROR /* The order should be mixed now. */ - if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR + if(H5Tget_order(cmpd) != H5T_ORDER_MIXED) FAIL_STACK_ERROR /* Create an array of the compound type above */ cmpd_array = H5Tarray_create2(cmpd, 2, dims); /* The order of the array type should be the same as the compound type */ - if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR + if(H5Tget_order(cmpd_array) != H5T_ORDER_MIXED) FAIL_STACK_ERROR /* Verify that the order can't be 'none'. */ H5E_BEGIN_TRY @@ -6471,13 +6471,13 @@ test_set_order_compound(hid_t fapl) if(H5Tset_order(cmpd, H5T_ORDER_BE) < 0) FAIL_STACK_ERROR /* Verify that the order of the compound type is big-endian */ - if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR + if(H5Tget_order(cmpd) != H5T_ORDER_BE) FAIL_STACK_ERROR /* Change the order of the array type to little-endian*/ if(H5Tset_order(cmpd_array, H5T_ORDER_LE) < 0) FAIL_STACK_ERROR /* Verify that the order of the array type is little-endian */ - if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR + if(H5Tget_order(cmpd_array) != H5T_ORDER_LE) FAIL_STACK_ERROR /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); @@ -6512,23 +6512,23 @@ error: H5Tclose(vl_id); H5Tclose(cmpd); H5Tclose(cmpd_array); - H5Fclose(file); + H5Fclose(file); H5E_END_TRY; return 1; } /* end test_set_order_compound() */ - + /*------------------------------------------------------------------------- - * Function: test_named_indirect_reopen + * Function: test_named_indirect_reopen * - * Purpose: Tests that open named datatypes can be reopened indirectly + * Purpose: Tests that open named datatypes can be reopened indirectly * through H5Dget_type without causing problems. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Thursday, June 4, 2009 * * Modifications: @@ -6538,13 +6538,13 @@ error: static int test_named_indirect_reopen(hid_t fapl) { - hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1; - static hsize_t dims[1] = {3}; + hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1; + static hsize_t dims[1] = {3}; size_t dt_size; int enum_value; const char *tag = "opaque_tag"; char *tag_ret = NULL; - char filename[1024]; + char filename[1024]; TESTING("indirectly reopening committed datatypes"); @@ -6708,12 +6708,12 @@ test_named_indirect_reopen(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Tclose(strtype); - H5Tclose(reopened_type); - H5Sclose(space); - H5Dclose(dset); - H5Fclose(file); + H5Tclose(type); + H5Tclose(strtype); + H5Tclose(reopened_type); + H5Sclose(space); + H5Dclose(dset); + H5Fclose(file); } H5E_END_TRY; if(tag_ret) H5free_memory(tag_ret); @@ -6824,17 +6824,17 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl, HDassert(status >= 0); } /* end create_del_obj_named_test_file() */ - + /*------------------------------------------------------------------------- - * Function: test_delete_obj_named + * Function: test_delete_obj_named * - * Purpose: Tests that delete objects that use named datatypes through + * Purpose: Tests that delete objects that use named datatypes through * different file IDs * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Monday, July 18, 2011 * *------------------------------------------------------------------------- @@ -6912,27 +6912,27 @@ test_delete_obj_named(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(attr); - H5Dclose(dset); - H5Pclose(fapl2); - H5Fclose(filea1); - H5Fclose(filea2); - H5Fclose(fileb); + H5Tclose(attr); + H5Dclose(dset); + H5Pclose(fapl2); + H5Fclose(filea1); + H5Fclose(filea2); + H5Fclose(fileb); } H5E_END_TRY; return 1; } /* end test_delete_obj_named() */ - + /*------------------------------------------------------------------------- - * Function: test_delete_obj_named_fileid + * Function: test_delete_obj_named_fileid * - * Purpose: Tests that objects that use named datatypes through + * Purpose: Tests that objects that use named datatypes through * different file IDs get the correct file IDs * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 28, 2011 * *------------------------------------------------------------------------- @@ -7075,29 +7075,29 @@ test_delete_obj_named_fileid(hid_t fapl) error: H5E_BEGIN_TRY { - H5Aclose(attr); - H5Tclose(type); - H5Dclose(dset); - H5Pclose(fapl2); - H5Fclose(filea1); - H5Fclose(filea2); - H5Fclose(fileb); - H5Fclose(attr_fid); - H5Fclose(type_fid); + H5Aclose(attr); + H5Tclose(type); + H5Dclose(dset); + H5Pclose(fapl2); + H5Fclose(filea1); + H5Fclose(filea2); + H5Fclose(fileb); + H5Fclose(attr_fid); + H5Fclose(type_fid); } H5E_END_TRY; return 1; } /* end test_delete_obj_named_fileid() */ - + /*------------------------------------------------------------------------- - * Function: test_deprec + * Function: test_deprec * - * Purpose: Tests deprecated API routines for datatypes. + * Purpose: Tests deprecated API routines for datatypes. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 27, 2007 * *------------------------------------------------------------------------- @@ -7106,17 +7106,17 @@ error: static int test_deprec(hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t type = -1; /* Datatype ID */ + hid_t file = -1; /* File ID */ + hid_t type = -1; /* Datatype ID */ unsigned rank = 2; /* Rank for array datatype */ hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */ int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */ hsize_t rdims[2]= {0, 0}; /* Dimensions for querying array datatype */ int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */ hbool_t dim_mismatch; /* Whether any dimensions didn't match */ - char filename[1024]; + char filename[1024]; unsigned u; /* Local index variable */ - herr_t status; /* Generic routine value */ + herr_t status; /* Generic routine value */ TESTING("deprected API routines for datatypes"); @@ -7144,7 +7144,7 @@ test_deprec(hid_t fapl) dim_mismatch = TRUE; } /* end if */ if(dim_mismatch) - FAIL_PUTS_ERROR(" Dimensions didn't match!") + FAIL_PUTS_ERROR(" Dimensions didn't match!") /* Check the array dimension permutations */ dim_mismatch = FALSE; @@ -7154,7 +7154,7 @@ test_deprec(hid_t fapl) dim_mismatch = TRUE; } /* end if */ if(dim_mismatch) - FAIL_PUTS_ERROR(" Dimension permutations modified!") + FAIL_PUTS_ERROR(" Dimension permutations modified!") /* Close the datatype */ if(H5Tclose(type) < 0) @@ -7167,31 +7167,31 @@ test_deprec(hid_t fapl) /* Predefined types cannot be committed */ H5E_BEGIN_TRY { - status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); + status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Predefined types should not be committable!") + FAIL_PUTS_ERROR(" Predefined types should not be committable!") /* Copy a predefined datatype and commit the copy */ if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR if(H5Tcommit1(file, "native-int", type) < 0) FAIL_STACK_ERROR if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR if(0 == status) - FAIL_PUTS_ERROR(" H5Tcommitted() returned false!") + FAIL_PUTS_ERROR(" H5Tcommitted() returned false!") /* We should not be able to modify a type after it has been committed. */ H5E_BEGIN_TRY { - status = H5Tset_precision(type, (size_t)256); + status = H5Tset_precision(type, (size_t)256); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Committed type is not constant!") + FAIL_PUTS_ERROR(" Committed type is not constant!") /* We should not be able to re-commit a committed type */ H5E_BEGIN_TRY { - status = H5Tcommit1(file, "test_named_2 (should not exist)", type); + status = H5Tcommit1(file, "test_named_2 (should not exist)", type); } H5E_END_TRY; if(status >= 0) - FAIL_PUTS_ERROR(" Committed types should not be recommitted!") + FAIL_PUTS_ERROR(" Committed types should not be recommitted!") /* * Close the committed type and reopen it. It should return a named type. @@ -7200,7 +7200,7 @@ test_deprec(hid_t fapl) if((type = H5Topen1(file, "native-int")) < 0) FAIL_STACK_ERROR if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR if(!status) - FAIL_PUTS_ERROR(" Opened named types should be named types!") + FAIL_PUTS_ERROR(" Opened named types should be named types!") /* Close */ if(H5Tclose(type) < 0) FAIL_STACK_ERROR @@ -7230,24 +7230,24 @@ test_deprec(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Fclose(file); + H5Tclose(type); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- - * Function: test_utf_ascii_conv + * Function: test_utf_ascii_conv * - * Purpose: Make sure the library doesn't conversion strings between + * Purpose: Make sure the library doesn't conversion strings between * ASCII and UTF8. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 10 November 2011 *------------------------------------------------------------------------- */ @@ -7265,12 +7265,12 @@ test_utf_ascii_conv(void) char *ascii_r = NULL; const char *ascii_w = "bar!"; char *utf8_r = NULL; - char filename[1024]; + char filename[1024]; char ascii2[4], utf8_2[4]; herr_t status; TESTING("string conversion between ASCII and UTF"); - + /************************************************ * Test VL string conversion from UTF8 to ASCII ************************************************/ @@ -7437,13 +7437,13 @@ test_utf_ascii_conv(void) error: H5E_BEGIN_TRY { - H5Tclose(utf8_vtid); - H5Tclose(ascii_vtid); - H5Tclose(utf8_tid); - H5Tclose(ascii_tid); - H5Dclose(did); - H5Sclose(sid); - H5Fclose(fid); + H5Tclose(utf8_vtid); + H5Tclose(ascii_vtid); + H5Tclose(utf8_tid); + H5Tclose(ascii_tid); + H5Dclose(did); + H5Sclose(sid); + H5Fclose(fid); } H5E_END_TRY; return 1; } @@ -7583,7 +7583,7 @@ error: return ret; } /* end of verify_version */ - + /*------------------------------------------------------------------------- * Function: test_versionbounds * @@ -7603,8 +7603,8 @@ error: * It then loops through all valid combination of the library version * bounds to verify each datatype's version. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * *------------------------------------------------------------------------- */ @@ -7797,26 +7797,26 @@ test_versionbounds(void) /* Close dataspace and property lists */ if (H5Sclose(space) < 0) TEST_ERROR - if (H5Pclose(fcpl) < 0) TEST_ERROR - if (H5Pclose(fapl) < 0) TEST_ERROR + if (H5Pclose(fcpl) < 0) TEST_ERROR + if (H5Pclose(fapl) < 0) TEST_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Sclose(space); - H5Tclose(dset_dtype); - H5Pclose(dcpl); - H5Pclose(fcpl); - H5Pclose(fapl); - H5Fclose(file); + H5Dclose(dset); + H5Sclose(space); + H5Tclose(dset_dtype); + H5Pclose(dcpl); + H5Pclose(fcpl); + H5Pclose(fapl); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_versionbounds() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -7836,8 +7836,8 @@ error: int main(void) { - long nerrors = 0; - hid_t fapl = -1; + long nerrors = 0; + hid_t fapl = -1; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -7846,7 +7846,7 @@ main(void) fapl = h5_fileaccess(); if(ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ nerrors += test_classes(); @@ -7901,12 +7901,12 @@ main(void) nerrors += test_versionbounds(); if(nerrors) { - printf("***** %lu FAILURE%s! *****\n", + HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } - printf("All datatype tests passed.\n"); + HDprintf("All datatype tests passed.\n"); return 0; } diff --git a/test/earray.c b/test/earray.c index 57df4d5..71dd8b5 100644 --- a/test/earray.c +++ b/test/earray.c @@ -20,15 +20,15 @@ * This file needs to access private datatypes from the H5EA package. * This file also needs to access the extensible array testing code. */ -#define H5EA_FRIEND /*suppress error about including H5EApkg */ +#define H5EA_FRIEND /*suppress error about including H5EApkg */ #define H5EA_TESTING -#include "H5EApkg.h" /* Extensible Arrays */ +#include "H5EApkg.h" /* Extensible Arrays */ /* Other private headers that this test requires */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Iprivate.h" /* IDs */ +#include "H5Iprivate.h" /* IDs */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -173,16 +173,16 @@ char filename_g[EARRAY_FILENAME_LEN]; /* Empty file size */ h5_stat_size_t empty_size_g; - + /*------------------------------------------------------------------------- - * Function: init_cparam + * Function: init_cparam * - * Purpose: Initialize array creation parameter structure + * Purpose: Initialize array creation parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 21, 2008 * *------------------------------------------------------------------------- @@ -205,18 +205,18 @@ init_cparam(H5EA_create_t *cparam) return(0); } /* init_cparam() */ - + /*------------------------------------------------------------------------- - * Function: init_tparam + * Function: init_tparam * - * Purpose: Initialize array testing parameter structure + * Purpose: Initialize array testing parameter structure * - * Note: This initialization is the same as that in H5EA_hdr_init() + * Note: This initialization is the same as that in H5EA_hdr_init() * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 25, 2008 * *------------------------------------------------------------------------- @@ -255,16 +255,16 @@ init_tparam(earray_test_param_t *tparam, const H5EA_create_t *cparam) return(0); } /* init_tparam() */ - + /*------------------------------------------------------------------------- - * Function: finish_tparam + * Function: finish_tparam * - * Purpose: Close down array testing parameter structure + * Purpose: Close down array testing parameter structure * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 25, 2008 * *------------------------------------------------------------------------- @@ -279,16 +279,16 @@ finish_tparam(earray_test_param_t *tparam) return(0); } /* finish_tparam() */ - + /*------------------------------------------------------------------------- - * Function: create_file + * Function: create_file * - * Purpose: Create file and retrieve pointer to internal file object + * Purpose: Create file and retrieve pointer to internal file object * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -315,16 +315,16 @@ error: return(-1); } /* create_file() */ - + /*------------------------------------------------------------------------- - * Function: check_stats + * Function: check_stats * - * Purpose: Verify stats for an extensible array + * Purpose: Verify stats for an extensible array * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 21, 2008 * *------------------------------------------------------------------------- @@ -393,22 +393,22 @@ error: return(-1); } /* check_stats() */ - + /*------------------------------------------------------------------------- - * Function: reopen_file + * Function: reopen_file * - * Purpose: Perform common "re-open" operations on file & array for testing + * Purpose: Perform common "re-open" operations on file & array for testing * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, +reopen_file(hid_t *file, H5F_t **f, hid_t fapl, H5EA_t **ea, haddr_t ea_addr, const earray_test_param_t *tparam) { /* Check for closing & re-opening the array */ @@ -454,16 +454,16 @@ error: return(-1); } /* reopen_file() */ - + /*------------------------------------------------------------------------- - * Function: create_array + * Function: create_array * - * Purpose: Create an extensible array and perform initial checks + * Purpose: Create an extensible array and perform initial checks * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -501,16 +501,16 @@ error: return(-1); } /* create_array() */ - + /*------------------------------------------------------------------------- - * Function: verify_cparam + * Function: verify_cparam * - * Purpose: Verify creation parameters are correct + * Purpose: Verify creation parameters are correct * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -536,17 +536,17 @@ error: return FAIL; } /* verify_cparam() */ - + /*------------------------------------------------------------------------- - * Function: finish + * Function: finish * - * Purpose: Close array, delete array, close file and verify that file + * Purpose: Close array, delete array, close file and verify that file * is empty size * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -590,16 +590,16 @@ error: return(-1); } /* finish() */ - + /*------------------------------------------------------------------------- - * Function: test_create + * Function: test_create * - * Purpose: Test creating extensible array + * Purpose: Test creating extensible array * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 7, 2008 * *------------------------------------------------------------------------- @@ -607,8 +607,8 @@ error: static unsigned test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSED *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ @@ -806,22 +806,22 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_create() */ - + /*------------------------------------------------------------------------- - * Function: test_reopen + * Function: test_reopen * - * Purpose: Create & reopen an extensible array + * Purpose: Create & reopen an extensible array * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -829,8 +829,8 @@ error: static unsigned test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ @@ -876,22 +876,22 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_reopen() */ - + /*------------------------------------------------------------------------- - * Function: test_open_twice + * Function: test_open_twice * - * Purpose: Open an extensible array twice + * Purpose: Open an extensible array twice * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -899,10 +899,10 @@ error: static unsigned test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ H5EA_t *ea2 = NULL; /* Extensible array wrapper */ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ @@ -982,25 +982,25 @@ error: H5EA_close(ea); if(ea2) H5EA_close(ea2); - H5Fclose(file); - H5Fclose(file2); + H5Fclose(file); + H5Fclose(file2); } H5E_END_TRY; return 1; } /* test_open_twice() */ - + /*------------------------------------------------------------------------- - * Function: test_open_twice_diff + * Function: test_open_twice_diff * - * Purpose: Open an extensible array twice, through different "top" file + * Purpose: Open an extensible array twice, through different "top" file * handles, with an intermediate file open that takes the "shared" * file handle from the first extensible array's file pointer. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, December 18, 2015 * *------------------------------------------------------------------------- @@ -1009,12 +1009,12 @@ static unsigned test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) { char filename_tmp[EARRAY_FILENAME_LEN]; /* Temporary file name */ - hid_t file = -1; /* File ID */ - hid_t file2 = -1; /* File ID */ - hid_t file0 = -1; /* File ID */ - hid_t file00 = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5F_t *f2 = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t file2 = -1; /* File ID */ + hid_t file0 = -1; /* File ID */ + hid_t file00 = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f2 = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ H5EA_t *ea2 = NULL; /* Extensible array wrapper */ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ @@ -1122,25 +1122,25 @@ error: H5EA_close(ea); if(ea2) H5EA_close(ea2); - H5Fclose(file); - H5Fclose(file2); - H5Fclose(file0); - H5Fclose(file00); + H5Fclose(file); + H5Fclose(file2); + H5Fclose(file0); + H5Fclose(file00); } H5E_END_TRY; return 1; } /* test_open_twice_diff() */ - + /*------------------------------------------------------------------------- - * Function: test_delete_open + * Function: test_delete_open * - * Purpose: Delete opened extensible array (& open deleted array) + * Purpose: Delete opened extensible array (& open deleted array) * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, August 28, 2008 * *------------------------------------------------------------------------- @@ -1148,8 +1148,8 @@ error: static unsigned test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ H5EA_t *ea2 = NULL; /* Extensible array wrapper */ haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ @@ -1243,7 +1243,7 @@ error: H5EA_close(ea); if(ea2) H5EA_close(ea2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; @@ -1255,16 +1255,16 @@ typedef struct eiter_fw_t { unsigned base_sblk_idx; /* Starting index for actual superblocks */ } eiter_fw_t; - + /*------------------------------------------------------------------------- - * Function: eiter_fw_init + * Function: eiter_fw_init * - * Purpose: Initialize element interator (forward iteration) + * Purpose: Initialize element interator (forward iteration) * - * Return: Success: Pointer to iteration status object - * Failure: NULL + * Return: Success: Pointer to iteration status object + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 2, 2008 * *------------------------------------------------------------------------- @@ -1287,16 +1287,16 @@ eiter_fw_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_para return(eiter); } /* end eiter_fw_init() */ - + /*------------------------------------------------------------------------- - * Function: eiter_fw_next + * Function: eiter_fw_next * - * Purpose: Get next element index (forward iteration) + * Purpose: Get next element index (forward iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1316,16 +1316,16 @@ eiter_fw_next(void *_eiter) return(ret_val); } /* end eiter_fw_next() */ - + /*------------------------------------------------------------------------- - * Function: eiter_fw_max + * Function: eiter_fw_max * - * Purpose: Get max. element index (forward iteration) + * Purpose: Get max. element index (forward iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1344,14 +1344,14 @@ eiter_fw_max(const void *_eiter) /*------------------------------------------------------------------------- - * Function: eiter_fw_state + * Function: eiter_fw_state * - * Purpose: Get extensible array state (forward iteration) + * Purpose: Get extensible array state (forward iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1416,16 +1416,16 @@ HDfprintf(stderr, "state->nsuper_blks = %Hu\n", state->nsuper_blks); return(0); } /* end eiter_fw_state() */ - + /*------------------------------------------------------------------------- - * Function: eiter_fw_term + * Function: eiter_fw_term * - * Purpose: Shut down element interator (forward iteration) + * Purpose: Shut down element interator (forward iteration) * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, October 2, 2008 * *------------------------------------------------------------------------- @@ -1461,16 +1461,16 @@ typedef struct eiter_rv_t { hsize_t idx_blk_nsblks; /* Number of superblocks directly pointed to in the index block */ } eiter_rv_t; - + /*------------------------------------------------------------------------- - * Function: eiter_rv_init + * Function: eiter_rv_init * - * Purpose: Initialize element interator (reverse iteration) + * Purpose: Initialize element interator (reverse iteration) * - * Return: Success: Pointer to iteration status object - * Failure: NULL + * Return: Success: Pointer to iteration status object + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1505,16 +1505,16 @@ eiter_rv_init(const H5EA_create_t *cparam, const earray_test_param_t *tparam, return(eiter); } /* end eiter_rv_init() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rv_next + * Function: eiter_rv_next * - * Purpose: Get next element index (reverse iteration) + * Purpose: Get next element index (reverse iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1534,16 +1534,16 @@ eiter_rv_next(void *_eiter) return(ret_val); } /* end eiter_rv_next() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rv_max + * Function: eiter_rv_max * - * Purpose: Get max. element index (reverse iteration) + * Purpose: Get max. element index (reverse iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1560,16 +1560,16 @@ eiter_rv_max(const void *_eiter) return((hssize_t)eiter->max); } /* end eiter_rv_max() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rv_state + * Function: eiter_rv_state * - * Purpose: Get extensible array state (reverse iteration) + * Purpose: Get extensible array state (reverse iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1658,16 +1658,16 @@ HDfprintf(stderr, "eiter->idx_blk_nsblks = %Hu, state->nsuper_blks = %Hu\n", eit return(0); } /* end eiter_rv_state() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rv_term + * Function: eiter_rv_term * - * Purpose: Shut down element interator (reverse iteration) + * Purpose: Shut down element interator (reverse iteration) * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 4, 2008 * *------------------------------------------------------------------------- @@ -1700,16 +1700,16 @@ typedef struct eiter_rnd_t { hsize_t *idx; /* Array of shuffled indices */ } eiter_rnd_t; - + /*------------------------------------------------------------------------- - * Function: eiter_rnd_init + * Function: eiter_rnd_init * - * Purpose: Initialize element interator (random iteration) + * Purpose: Initialize element interator (random iteration) * - * Return: Success: Pointer to iteration status object - * Failure: NULL + * Return: Success: Pointer to iteration status object + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 6, 2008 * *------------------------------------------------------------------------- @@ -1752,16 +1752,16 @@ eiter_rnd_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par return(eiter); } /* end eiter_rnd_init() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rnd_next + * Function: eiter_rnd_next * - * Purpose: Get next element index (random iteration) + * Purpose: Get next element index (random iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 6, 2008 * *------------------------------------------------------------------------- @@ -1786,16 +1786,16 @@ eiter_rnd_next(void *_eiter) return(ret_val); } /* end eiter_rnd_next() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rnd_max + * Function: eiter_rnd_max * - * Purpose: Get max. element index (random iteration) + * Purpose: Get max. element index (random iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 6, 2008 * *------------------------------------------------------------------------- @@ -1812,16 +1812,16 @@ eiter_rnd_max(const void *_eiter) return((hssize_t)eiter->max); } /* end eiter_rnd_max() */ - + /*------------------------------------------------------------------------- - * Function: eiter_rnd_term + * Function: eiter_rnd_term * - * Purpose: Shut down element interator (random iteration) + * Purpose: Shut down element interator (random iteration) * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 6, 2008 * *------------------------------------------------------------------------- @@ -1853,16 +1853,16 @@ static const earray_iter_t ea_iter_rnd = { eiter_rnd_term /* Iterator term */ }; - + /*------------------------------------------------------------------------- - * Function: eiter_rnd2_init + * Function: eiter_rnd2_init * - * Purpose: Initialize element interator (random #2 iteration) + * Purpose: Initialize element interator (random #2 iteration) * - * Return: Success: Pointer to iteration status object - * Failure: NULL + * Return: Success: Pointer to iteration status object + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, November 11, 2008 * *------------------------------------------------------------------------- @@ -1937,16 +1937,16 @@ typedef struct eiter_cyc_t { hsize_t cyc; /* Cycle of elements to choose from */ } eiter_cyc_t; - + /*------------------------------------------------------------------------- - * Function: eiter_cyc_init + * Function: eiter_cyc_init * - * Purpose: Initialize element interator (cyclic iteration) + * Purpose: Initialize element interator (cyclic iteration) * - * Return: Success: Pointer to iteration status object - * Failure: NULL + * Return: Success: Pointer to iteration status object + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 11, 2008 * *------------------------------------------------------------------------- @@ -1971,16 +1971,16 @@ eiter_cyc_init(const H5EA_create_t H5_ATTR_UNUSED *cparam, const earray_test_par return(eiter); } /* end eiter_cyc_init() */ - + /*------------------------------------------------------------------------- - * Function: eiter_cyc_next + * Function: eiter_cyc_next * - * Purpose: Get next element index (cyclic iteration) + * Purpose: Get next element index (cyclic iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 11, 2008 * *------------------------------------------------------------------------- @@ -2007,16 +2007,16 @@ eiter_cyc_next(void *_eiter) return(ret_val); } /* end eiter_cyc_next() */ - + /*------------------------------------------------------------------------- - * Function: eiter_cyc_max + * Function: eiter_cyc_max * - * Purpose: Get max. element index (cyclic iteration) + * Purpose: Get max. element index (cyclic iteration) * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 11, 2008 * *------------------------------------------------------------------------- @@ -2033,16 +2033,16 @@ eiter_cyc_max(const void *_eiter) return((hssize_t)eiter->max); } /* end eiter_cyc_max() */ - + /*------------------------------------------------------------------------- - * Function: eiter_cyc_term + * Function: eiter_cyc_term * - * Purpose: Shut down element interator (cyclic iteration) + * Purpose: Shut down element interator (cyclic iteration) * - * Return: Success: 0 - * Failure: -1 + * Return: Success: 0 + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 11, 2008 * *------------------------------------------------------------------------- @@ -2070,16 +2070,16 @@ static const earray_iter_t ea_iter_cyc = { eiter_cyc_term /* Iterator term */ }; - + /*------------------------------------------------------------------------- - * Function: test_set_elmts + * Function: test_set_elmts * - * Purpose: Set all elements from 0 through 'nelmts' in extensible array + * Purpose: Set all elements from 0 through 'nelmts' in extensible array * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, September 22, 2008 * *------------------------------------------------------------------------- @@ -2088,8 +2088,8 @@ static unsigned test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, hsize_t nelmts, const char *test_str) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ void *eiter_info; /* Extensible array iterator info */ earray_state_t state; /* State of extensible array */ @@ -2242,22 +2242,22 @@ error: H5E_BEGIN_TRY { if(ea) H5EA_close(ea); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return 1; } /* test_set_elmts() */ - + /*------------------------------------------------------------------------- - * Function: test_skip_elmts + * Function: test_skip_elmts * - * Purpose: Skip some elements when writing element + * Purpose: Skip some elements when writing element * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, November 11, 2008 * *------------------------------------------------------------------------- @@ -2266,8 +2266,8 @@ static unsigned test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, hsize_t skip_elmts, const char *test_str) { - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ H5EA_t *ea = NULL; /* Extensible array wrapper */ earray_state_t state; /* State of extensible array */ uint64_t welmt; /* Element to write */ @@ -2405,16 +2405,16 @@ error: return 1; } /* test_skip_elmts() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test the extensible array code + * Purpose: Test the extensible array code * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, June 17, 2008 * *------------------------------------------------------------------------- @@ -2426,10 +2426,10 @@ main(void) earray_test_param_t tparam; /* Testing parameters */ earray_test_type_t curr_test; /* Current test being worked on */ earray_iter_type_t curr_iter; /* Current iteration type being worked on */ - hid_t fapl = -1; /* File access property list for data files */ - unsigned nerrors = 0; /* Cumulative error count */ + hid_t fapl = -1; /* File access property list for data files */ + unsigned nerrors = 0; /* Cumulative error count */ time_t curr_time; /* Current time, for seeding random number generator */ - int ExpressMode; /* Test express value */ + int ExpressMode; /* Test express value */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Reset library */ @@ -2437,7 +2437,7 @@ main(void) fapl = h5_fileaccess(); ExpressMode = GetTestExpress(); if(ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); @@ -2452,7 +2452,7 @@ main(void) /* Create an empty file to retrieve size */ { - hid_t file; /* File ID */ + hid_t file; /* File ID */ if((file = H5Fcreate(filename_g, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -2560,14 +2560,14 @@ main(void) nelmts = (hsize_t)((hsize_t)1 + cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx + (tparam.sblk_info[sblk].dblk_nelmts * dblk)); - sprintf(test_str, "setting first element of array's data block #%llu", (unsigned long long)ndblks); + HDsprintf(test_str, "setting first element of array's data block #%llu", (unsigned long long)ndblks); nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str); /* Test all elements in data block */ nelmts = (hsize_t)(cparam.idx_blk_elmts + tparam.sblk_info[sblk].start_idx + (tparam.sblk_info[sblk].dblk_nelmts * (dblk + 1))); - sprintf(test_str, "setting all elements of array's data block #%llu", (unsigned long long)ndblks); + HDsprintf(test_str, "setting all elements of array's data block #%llu", (unsigned long long)ndblks); nerrors += test_set_elmts(fapl, &cparam, &tparam, nelmts, test_str); /* Increment data block being tested */ diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 826957f..fa0a15e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -137,7 +137,7 @@ main(void) hid_t srcspace = -1; /* Source dataspaces */ hid_t vspace = -1; /* Virtual dset dataspaces */ hsize_t dims[1] = {3}; /* Data space current size */ - hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ + hsize_t chunk_size[2] = {16384, 4}; /* chunk size */ double fill = 2.7f; /* Fill value */ hsize_t max_size[1]; /* data space maximum size */ size_t nslots = 521 * 2; @@ -198,14 +198,14 @@ main(void) continue; /* Display testing info */ - low_string = h5_get_version_string(low); + low_string = h5_get_version_string(low); high_string = h5_get_version_string(high); HDsprintf(msg, "Testing ENCODE/DECODE with file version bounds: (%s, %s):", low_string, high_string); HDputs(msg); if(VERBOSE_MED) - printf("Encode/Decode DCPLs\n"); + HDprintf("Encode/Decode DCPLs\n"); /******* ENCODE/DECODE DCPLS *****/ TESTING("Default DCPL Encoding/Decoding"); @@ -233,23 +233,23 @@ main(void) FAIL_STACK_ERROR max_size[0] = 100; - if((H5Pset_external(dcpl, "ext1.data", (off_t)0, + if((H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) FAIL_STACK_ERROR - if((H5Pset_external(dcpl, "ext2.data", (off_t)0, + if((H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) FAIL_STACK_ERROR - if((H5Pset_external(dcpl, "ext3.data", (off_t)0, + if((H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) FAIL_STACK_ERROR - if((H5Pset_external(dcpl, "ext4.data", (off_t)0, + if((H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) FAIL_STACK_ERROR /* Test encoding & decoding property list */ if(test_encode_decode(dcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("DCPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(dcpl)) < 0) FAIL_STACK_ERROR @@ -260,7 +260,7 @@ main(void) TESTING("DCPL Encoding/Decoding for virtual layout"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - + /* Set virtual layout */ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0) TEST_ERROR @@ -299,11 +299,11 @@ main(void) if((H5Pset_chunk_cache(dapl, nslots, nbytes, w0)) < 0) FAIL_STACK_ERROR - + /* Test encoding & decoding property list */ if(test_encode_decode(dapl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("DAPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(dapl)) < 0) FAIL_STACK_ERROR @@ -314,7 +314,7 @@ main(void) TESTING("Default OCPL Encoding/Decoding"); if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) FAIL_STACK_ERROR - + /* Test encoding & decoding default property list */ if(test_encode_decode(ocpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("Default OCPL encoding/decoding failed\n") @@ -385,13 +385,13 @@ main(void) if((H5Pclose(dxpl)) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED(); /******* ENCODE/DECODE GCPLS *****/ TESTING("Default GCPL Encoding/Decoding"); if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0) FAIL_STACK_ERROR - + /* Test encoding & decoding default property list */ if(test_encode_decode(gcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("Default GCPL encoding/decoding failed\n") @@ -419,7 +419,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(gcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("GCPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(gcpl)) < 0) FAIL_STACK_ERROR @@ -445,7 +445,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(lcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("LCPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(lcpl)) < 0) FAIL_STACK_ERROR @@ -491,7 +491,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(lapl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("LAPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(lapl)) < 0) FAIL_STACK_ERROR @@ -523,7 +523,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(ocpypl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("OCPYPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(ocpypl)) < 0) FAIL_STACK_ERROR @@ -619,7 +619,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(fcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("FCPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(fcpl)) < 0) FAIL_STACK_ERROR @@ -647,7 +647,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(strcpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("STRCPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(strcpl)) < 0) FAIL_STACK_ERROR @@ -675,7 +675,7 @@ main(void) /* Test encoding & decoding property list */ if(test_encode_decode(acpl, low, high, FALSE) < 0) FAIL_PUTS_ERROR("ACPL encoding/decoding failed\n") - + /* release resource */ if((H5Pclose(acpl)) < 0) FAIL_STACK_ERROR @@ -688,7 +688,7 @@ main(void) return 0; error: - printf("***** Plist Encode/Decode tests FAILED! *****\n"); +HDprintf("***** Plist Encode/Decode tests FAILED! *****\n"); return 1; } diff --git a/test/enum.c b/test/enum.c index 588e9b3..26e64fd 100644 --- a/test/enum.c +++ b/test/enum.c @@ -166,7 +166,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" 1. data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -178,7 +178,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((short)data1[i] != data_short[i]) { H5_FAILED(); - printf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", + HDprintf(" 2. data1[%lu]=%d, data_short[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_short[i])); goto error; @@ -190,7 +190,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != (int)data_double[i]) { H5_FAILED(); - printf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + HDprintf(" 3. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_double[i])); goto error; @@ -212,7 +212,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != data_int[i]) { H5_FAILED(); - printf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", + HDprintf(" 4. data1[%lu]=%d, data_int[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_int[i])); goto error; @@ -234,7 +234,7 @@ test_conv(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if((int)data1[i] != (int)data_double[i]) { H5_FAILED(); - printf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", + HDprintf(" 5. data1[%lu]=%d, data_double[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data_double[i])); goto error; @@ -318,7 +318,7 @@ test_tr1(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -400,7 +400,7 @@ test_tr2(hid_t file) for(i = 0; i < (size_t)ds_size[0]; i++) if(data1[i] != data2[i]) { H5_FAILED(); - printf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", + HDprintf(" data1[%lu]=%d, data2[%lu]=%d (should be same)\n", (unsigned long)i, (int)(data1[i]), (unsigned long)i, (int)(data2[i])); goto error; @@ -559,7 +559,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -568,7 +568,7 @@ test_funcs(void) } H5E_END_TRY; if (size>0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -577,7 +577,7 @@ test_funcs(void) } H5E_END_TRY; if (inpad>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -586,7 +586,7 @@ test_funcs(void) } H5E_END_TRY; if (cset>-1) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -596,7 +596,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ @@ -605,7 +605,7 @@ test_funcs(void) } H5E_END_TRY; if (ret>=0) { H5_FAILED(); - printf("Operation not allowed for this type.\n"); + HDprintf("Operation not allowed for this type.\n"); goto error; } /* end if */ diff --git a/test/err_compat.c b/test/err_compat.c index ed85524..d2d039a 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -22,7 +22,7 @@ #ifdef H5_NO_DEPRECATED_SYMBOLS int main(void) { - printf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); + HDprintf("Test skipped because backward compatibility with v1.6 is NOT configured in\n"); return 0; } #else /* H5_NO_DEPRECATED_SYMBOLS */ @@ -62,7 +62,7 @@ static herr_t user_print1(FILE *stream) { /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk1(H5E_WALK_UPWARD, (H5E_walk1_t)custom_print_cb1, stream) < 0) TEST_ERROR; @@ -92,7 +92,7 @@ static herr_t user_print2(hid_t err_stack, FILE *stream) { /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk2(err_stack, H5E_WALK_UPWARD, (H5E_walk2_t)custom_print_cb2, stream) < 0) TEST_ERROR; @@ -135,12 +135,12 @@ custom_print_cb1(int n, H5E_error1_t *err_desc, void* client_data) if(NULL == (maj = H5Eget_major(err_desc->maj_num))) TEST_ERROR; - fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name, err_desc->func_name, err_desc->line); - fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); - fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); H5free_memory(maj); H5free_memory(min); @@ -188,12 +188,12 @@ custom_print_cb2(int n, H5E_error2_t *err_desc, void* client_data) if(NULL == (maj = H5Eget_major(err_desc->maj_num))) TEST_ERROR; - fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", + HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", indent, "", n, err_desc->file_name, err_desc->func_name, err_desc->line); - fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); - fprintf(stream, "%*sminor: %s\n", indent * 2, "", min); + HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); + HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); H5free_memory(maj); H5free_memory(min); @@ -238,7 +238,7 @@ test_error1(void) herr_t ret; TESTING("error API H5Eset/get_auto"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "\n"); /* Create the data space */ dims[0] = DIM0; @@ -367,7 +367,7 @@ test_error2(hid_t file) const char *FUNC_test_error="test_error2"; TESTING("error API based on data I/O"); - fprintf(stderr, "\n"); + HDfprintf(stderr, "\n"); /* Create the data space */ dims[0] = DIM0; @@ -433,12 +433,12 @@ static herr_t dump_error(void) { /* Print errors in library default way */ - fprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); + HDfprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); if(H5Eprint1(stderr) < 0) TEST_ERROR; /* Customized way to print errors */ - fprintf(stderr, "\n********* Print error stack in customized way *********\n"); + HDfprintf(stderr, "\n********* Print error stack in customized way *********\n"); if(H5Ewalk1(H5E_WALK_UPWARD, custom_print_cb1, stderr) < 0) TEST_ERROR; @@ -469,7 +469,7 @@ main(void) char filename[1024]; const char *FUNC_main="main"; - fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); + HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -500,11 +500,11 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR ; h5_clean_files(FILENAME, fapl); - printf("All error API tests passed.\n"); + HDprintf("All error API tests passed.\n"); return 0; - error: - printf("***** ERROR TEST FAILED! *****\n"); +error: + HDprintf("***** ERROR TEST FAILED! *****\n"); return 1; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/extend.c b/test/extend.c index e5c3cb3..f8c091b 100644 --- a/test/extend.c +++ b/test/extend.c @@ -105,9 +105,9 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me for(k = 0; k < (NX / 2); k++) for(m = 0; m < (NY / 2); m++) if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - printf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - printf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - printf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); TEST_ERROR; } /* end if */ } /* end for */ @@ -195,9 +195,9 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h for(k = 0; k < (NX / 2); k++) for(m = 0; m < (NY / 2); m++) if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) { - printf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); - printf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); - printf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); + HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m); + HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]); + HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]); TEST_ERROR; } /* end if */ } /* end for */ @@ -289,17 +289,17 @@ main (void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if(nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); + HDprintf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); exit(EXIT_FAILURE); } /* end if */ - printf("All extend tests passed.\n"); + HDprintf("All extend tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; error: - printf("*** One or more extend tests failed ***\n"); + HDprintf("*** One or more extend tests failed ***\n"); return 1; } diff --git a/test/external.c b/test/external.c index 2a90711..6c12c93 100644 --- a/test/external.c +++ b/test/external.c @@ -146,7 +146,7 @@ test_non_extendible(hid_t file) if(1 != n) { H5_FAILED(); HDputs(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); + HDprintf(" got: %d\n ans: 1\n", n); goto error; } /* end if */ @@ -158,7 +158,7 @@ test_non_extendible(hid_t file) if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } /* end if */ @@ -166,7 +166,7 @@ test_non_extendible(hid_t file) if(file_size != (max_size[0] * sizeof(int))) { H5_FAILED(); HDputs(" Wrong file size."); - printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); + HDprintf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); goto error; } /* end if */ @@ -407,7 +407,7 @@ test_unlimited(hid_t file) if(1 != n) { H5_FAILED(); HDputs(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); + HDprintf(" got: %d\n ans: 1\n", n); goto error; } /* end if */ @@ -417,14 +417,14 @@ test_unlimited(hid_t file) if(file_offset != 0) { H5_FAILED(); HDputs(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + HDprintf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); goto error; } /* end if */ if(H5F_UNLIMITED != file_size) { H5_FAILED(); HDputs(" Wrong file size."); - printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); + HDprintf(" got: %lu\n ans: INF\n", (unsigned long)file_size); goto error; } /* end if */ @@ -1399,6 +1399,6 @@ error: H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); - printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); + HDprintf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/external_env.c b/test/external_env.c index 0a96f8e..01f2cba 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -12,7 +12,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "external_common.h" #include "external_fname.h" @@ -22,7 +22,7 @@ static const char *EXT_ENV_FNAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_path_env * @@ -47,18 +47,18 @@ static const char *EXT_ENV_FNAME[] = { static int test_path_env(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dapl = -1; /* dataset access property list */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - char buffer[1024]; /* buffer to read efile_prefix */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ TESTING("prefix in HDF5_EXTFILE_PREFIX"); @@ -130,7 +130,7 @@ error: return 1; } /* end test_path_env() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -138,7 +138,7 @@ error: * * Return: EXIT_SUCCESS/EXIT_FAILURE * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 3, 1998 * *------------------------------------------------------------------------- @@ -146,12 +146,12 @@ error: int main(void) { - hid_t fapl_id_old = -1; /* file access properties (old format) */ - hid_t fapl_id_new = -1; /* file access properties (new format) */ - hid_t fid = -1; /* file for test_1* functions */ - hid_t gid = -1; /* group to emit diagnostics */ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ + hid_t fid = -1; /* file for test_1* functions */ + hid_t gid = -1; /* group to emit diagnostics */ unsigned latest_format; /* default or latest file format */ - int nerrors = 0; /* number of errors */ + int nerrors = 0; /* number of errors */ h5_reset(); @@ -213,7 +213,7 @@ error: H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); - printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); + HDprintf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/fillval.c b/test/fillval.c index 5b95de9..0454bde 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -15,7 +15,7 @@ * Programmer: Robb Matzke * Thursday, October 1, 1998 * - * Purpose: Tests dataset fill values. + * Purpose: Tests dataset fill values. */ #include "h5test.h" #include "H5srcdir.h" @@ -59,9 +59,9 @@ typedef struct { * for version 1.4(after 1.4.3). To get this data file, simply compile * gen_old_fill.c with HDF5 library (before v1.5) and run it. */ #define FILE_COMPATIBLE "fill_old.h5" -#define FILE_NAME_RAW "fillval.raw" +#define FILE_NAME_RAW "fillval.raw" + - /*------------------------------------------------------------------------- * Function: create_compound_type * @@ -91,7 +91,7 @@ static hid_t create_compound_type(void) if(H5Tinsert(ret_value, "y", HOFFSET(comp_datatype, y), H5T_NATIVE_DOUBLE) < 0) goto error; if(H5Tinsert(ret_value, "z", HOFFSET(comp_datatype, z), H5T_NATIVE_CHAR) < 0) - goto error; + goto error; return ret_value; @@ -102,7 +102,7 @@ error: return -1; } - + /*------------------------------------------------------------------------- * Function: create_compound_vl_type * @@ -146,18 +146,18 @@ error: return -1; } /* end create_compound_vl_type() */ - + /*------------------------------------------------------------------------- - * Function: test_getset + * Function: test_getset * - * Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value() - * functions. + * Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value() + * functions. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * * Modifications: @@ -167,15 +167,15 @@ error: static int test_getset(void) { - hid_t dcpl=-1; - int fill_i; - hid_t type_ss=-1, type_si=-1; + hid_t dcpl=-1; + int fill_i; + hid_t type_ss=-1, type_si=-1; struct fill_si { - int v1, v2; - } fill_si; + int v1, v2; + } fill_si; struct fill_ss { - short v1, v2; - } fill_ss, fill_ss_rd; + short v1, v2; + } fill_ss, fill_ss_rd; TESTING("property lists"); @@ -185,18 +185,18 @@ test_getset(void) */ if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if((type_ss=H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 || - H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), - H5T_NATIVE_SHORT) < 0 || - H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), - H5T_NATIVE_SHORT) < 0) { - goto error; + H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), + H5T_NATIVE_SHORT) < 0 || + H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), + H5T_NATIVE_SHORT) < 0) { + goto error; } if((type_si=H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 || - H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), - H5T_NATIVE_INT) < 0 || - H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), - H5T_NATIVE_INT) < 0) { - goto error; + H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), + H5T_NATIVE_INT) < 0 || + H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), + H5T_NATIVE_INT) < 0) { + goto error; } /* @@ -204,12 +204,12 @@ test_getset(void) * no fill value should result in a failure. */ H5E_BEGIN_TRY { - H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); + H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i); } H5E_END_TRY; if(fill_i != 0) { - H5_FAILED(); - puts(" H5Pget_fill_value() should return default 0"); - goto error; + H5_FAILED(); + puts(" H5Pget_fill_value() should return default 0"); + goto error; } /* @@ -224,10 +224,10 @@ test_getset(void) */ if(H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0) goto error; if(fill_ss.v1!=fill_ss_rd.v1 || fill_ss.v2!=fill_ss_rd.v2) { - H5_FAILED(); - puts(" Failed to get fill value using same data type that was "); - puts(" used to set the fill value."); - goto error; + H5_FAILED(); + puts(" Failed to get fill value using same data type that was "); + puts(" used to set the fill value."); + goto error; } /* @@ -235,10 +235,10 @@ test_getset(void) */ if(H5Pget_fill_value(dcpl, type_si, &fill_si) < 0) goto error; if(fill_ss.v1!=fill_si.v1 || fill_ss.v2!=fill_si.v2) { - H5_FAILED(); - puts(" Failed to get fill value using a data type other than what"); - puts(" was used to set the fill value."); - goto error; + H5_FAILED(); + puts(" Failed to get fill value using a data type other than what"); + puts(" was used to set the fill value."); + goto error; } /* @@ -247,9 +247,9 @@ test_getset(void) if(H5Pset_fill_value(dcpl, type_si, &fill_si) < 0) goto error; if(H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0) goto error; if(fill_si.v1!=fill_ss.v1 || fill_si.v2!=fill_ss.v2) { - H5_FAILED(); - puts(" Resetting the fill value was unsuccessful."); - goto error; + H5_FAILED(); + puts(" Resetting the fill value was unsuccessful."); + goto error; } /* Success */ @@ -261,24 +261,24 @@ test_getset(void) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Tclose(type_si); - H5Tclose(type_ss); + H5Pclose(dcpl); + H5Tclose(type_si); + H5Tclose(type_ss); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- - * Function: test_getset_vl + * Function: test_getset_vl * - * Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value() - * functions, using variable-length datatype. + * Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value() + * functions, using variable-length datatype. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, May 31, 2007 * *------------------------------------------------------------------------- @@ -362,47 +362,47 @@ test_getset_vl(hid_t fapl) return 1; } /* end test_getset_vl() */ - + /*------------------------------------------------------------------------- - * Function: test_create + * Function: test_create * - * Purpose: Tests creating datasets that have fill values. + * Purpose: Tests creating datasets that have fill values. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * * Modifications: - * Many new cases have been added to this test since - * the fill value design has been modified. + * Many new cases have been added to this test since + * the fill value design has been modified. * *------------------------------------------------------------------------- */ static int test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) { - hid_t file=-1, space=-1, dcpl=-1, comp_type_id=-1; - hid_t dset1=-1, dset2=-1, dset3=-1, dset4=-1, dset5=-1, - dset6=-1, /* dset7=-1, */ dset8=-1, dset9=-1; + hid_t file=-1, space=-1, dcpl=-1, comp_type_id=-1; + hid_t dset1=-1, dset2=-1, dset3=-1, dset4=-1, dset5=-1, + dset6=-1, /* dset7=-1, */ dset8=-1, dset9=-1; hsize_t cur_size[5] = {2, 8, 8, 4, 2}; - hsize_t ch_size[5] = {1, 1, 1, 4, 1}; - short rd_s, fill_s = 0x1234; - long rd_l, fill_l = 0x4321; - char filename[1024]; - H5D_space_status_t allocation; + hsize_t ch_size[5] = {1, 1, 1, 4, 1}; + short rd_s, fill_s = 0x1234; + long rd_l, fill_l = 0x4321; + char filename[1024]; + H5D_space_status_t allocation; H5D_alloc_time_t alloc_time; - H5D_fill_time_t fill_time; + H5D_fill_time_t fill_time; comp_datatype rd_c, fill_ctype; if(H5D_CHUNKED==layout) { - TESTING("chunked dataset creation"); + TESTING("chunked dataset creation"); } else if(H5D_COMPACT==layout) { TESTING("compact dataset creation"); } else { - TESTING("contiguous dataset creation"); + TESTING("contiguous dataset creation"); } /* @@ -410,11 +410,11 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) */ h5_fixname(base_name, fapl, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + goto error; if((space=H5Screate_simple(5, cur_size, cur_size)) < 0) goto error; if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5D_CHUNKED==layout) { - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) goto error; } else if(H5D_COMPACT==layout) { if(H5Pset_layout(dcpl, H5D_COMPACT) < 0) goto error; } @@ -444,21 +444,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0) goto error; #endif if((dset1=H5Dcreate2(file, "dset1", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; /* 3. Large to small fill conversion */ #ifndef NO_FILLING if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif if((dset2=H5Dcreate2(file, "dset2", H5T_NATIVE_SHORT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; /* 4. No conversion */ #ifndef NO_FILLING if(H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0) goto error; #endif if((dset3=H5Dcreate2(file, "dset3", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; /* 5. late space allocation and never write fill value */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; @@ -504,7 +504,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* 3. Write fill value at space allocation time */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; if((dset6 = H5Dcreate2(file, "dset6", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + goto error; /* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC. * Supposed to fail. */ @@ -531,7 +531,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) /* Open the file and get the dataset fill value from each dataset */ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - goto error; + goto error; /* I. Check cases for late space allocation except compact dataset */ if(H5D_COMPACT != layout) { @@ -541,10 +541,10 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) #ifndef NO_FILLING if(H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0) goto error; if(rd_s != fill_s) { - H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %d, set %d\n", rd_s, fill_s); - goto error; + H5_FAILED(); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %d, set %d\n", rd_s, fill_s); + goto error; } #endif if(H5Dclose(dset1) < 0) goto error; @@ -556,10 +556,10 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) #ifndef NO_FILLING if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l!=fill_l) { - H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); - goto error; + H5_FAILED(); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); + goto error; } #endif if(H5Dclose(dset2) < 0) goto error; @@ -571,10 +571,10 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) #ifndef NO_FILLING if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l != fill_l) { - H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); - goto error; + H5_FAILED(); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); + goto error; } #endif if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; @@ -582,12 +582,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset3) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -598,21 +598,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); puts(" Got allocated space instead of unallocated."); - printf(" Got %d\n", allocation); + HDprintf(" Got %d\n", allocation); goto error; } if((dcpl = H5Dget_create_plist(dset4)) < 0) goto error; if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_LATE) { - H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); - printf(" Got %d\n", alloc_time); + H5_FAILED(); + puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); + HDprintf(" Got %d\n", alloc_time); } if(fill_time != H5D_FILL_TIME_NEVER) { - H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); - printf(" Got %d\n", fill_time); + H5_FAILED(); + puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset4) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -624,7 +624,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); - printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", + HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } if(H5Dclose(dset9) < 0) goto error; @@ -639,21 +639,21 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Dget_space_status(dset5, &allocation) < 0) goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset5) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -664,28 +664,28 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(H5Dget_space_status(dset6, &allocation) < 0) goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } if(H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0) goto error; if(rd_l != fill_l) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", rd_l, fill_l); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", rd_l, fill_l); goto error; } if(H5Pget_alloc_time(dcpl, &alloc_time) < 0) goto error; if(alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); - printf(" Got %d\n", alloc_time); + HDprintf(" Got %d\n", alloc_time); } if(H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if(fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); - printf(" Got %d\n", fill_time); + HDprintf(" Got %d\n", fill_time); } if(H5Dclose(dset6) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -697,8 +697,8 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if(!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); puts(" Got wrong fill value"); - printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", - (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); + HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", + (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } if(H5Dclose(dset8) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -710,56 +710,56 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); + H5Pclose(dcpl); + H5Sclose(space); if(H5D_COMPACT != layout) { - H5Dclose(dset1); - H5Dclose(dset2); - H5Dclose(dset3); + H5Dclose(dset1); + H5Dclose(dset2); + H5Dclose(dset3); H5Dclose(dset4); H5Dclose(dset9); } H5Dclose(dset5); H5Dclose(dset6); - H5Dclose(dset8); - H5Fclose(file); + H5Dclose(dset8); + H5Fclose(file); } H5E_END_TRY; return 1; } /*------------------------------------------------------------------------- - * Function: test_rdwr_cases + * Function: test_rdwr_cases * - * Purpose: Tests fill values read and write for datasets. + * Purpose: Tests fill values read and write for datasets. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * * Modifications: - * This function is called by test_rdwr to write and read - * dataset for different cases. + * This function is called by test_rdwr to write and read + * dataset for different cases. * *------------------------------------------------------------------------- */ static int test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, - H5D_fill_time_t fill_time, H5D_layout_t layout, - H5T_class_t datatype, hid_t ctype_id) + H5D_fill_time_t fill_time, H5D_layout_t layout, + H5T_class_t datatype, hid_t ctype_id) { - hid_t fspace=-1, mspace=-1, dset1=-1, dset2=-1; - hsize_t cur_size[5] = {2, 8, 8, 4, 2}; - hsize_t one[5] = {1, 1, 1, 1, 1}; - hsize_t hs_size[5], hs_stride[5]; - hsize_t hs_offset[5], nelmts; - int fillval=(-1), val_rd, should_be; - int i, j, *buf=NULL, odd; + hid_t fspace=-1, mspace=-1, dset1=-1, dset2=-1; + hsize_t cur_size[5] = {2, 8, 8, 4, 2}; + hsize_t one[5] = {1, 1, 1, 1, 1}; + hsize_t hs_size[5], hs_stride[5]; + hsize_t hs_offset[5], nelmts; + int fillval=(-1), val_rd, should_be; + int i, j, *buf=NULL, odd; unsigned u; comp_datatype rd_c, fill_c, should_be_c; - comp_datatype *buf_c=NULL; + comp_datatype *buf_c=NULL; H5D_space_status_t allocation; if(datatype == H5T_INTEGER) { @@ -788,27 +788,27 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if((mspace = H5Screate_simple(5, one, NULL)) < 0) goto error; for (i=0; i<1000; i++) { - for (j=0; j<5; j++) - hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, - one, NULL) < 0) goto error; + for (j=0; j<5; j++) + hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, + one, NULL) < 0) goto error; - /* case for atomic datatype */ - if(datatype==H5T_INTEGER) { + /* case for atomic datatype */ + if(datatype==H5T_INTEGER) { if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, - &val_rd) < 0) goto error; - if(fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { - H5_FAILED(); + &val_rd) < 0) goto error; + if(fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { + H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); - HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " - "Fill value: %u\n", - hs_offset[0], hs_offset[1], - hs_offset[2], hs_offset[3], - hs_offset[4], val_rd, fillval); - goto error; - } - /* case for compound datatype */ - } + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " + "Fill value: %u\n", + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], val_rd, fillval); + goto error; + } + /* case for compound datatype */ + } else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; @@ -822,7 +822,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, - (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); + (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z); goto error; } } @@ -871,8 +871,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, else if(datatype == H5T_COMPOUND) { /*check for overflow*/ HDassert((nelmts * sizeof(comp_datatype)) == - (hsize_t)((size_t)(nelmts * sizeof(comp_datatype)))); - buf_c = (comp_datatype *)HDmalloc((size_t)nelmts * sizeof(comp_datatype)); + (hsize_t)((size_t)(nelmts * sizeof(comp_datatype)))); + buf_c = (comp_datatype *)HDmalloc((size_t)nelmts * sizeof(comp_datatype)); if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) goto error; @@ -910,24 +910,24 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, else if(datatype == H5T_COMPOUND) { HDmemset(buf_c, 0, ((size_t)nelmts * sizeof(comp_datatype))); for(u = 0; u < nelmts; u++) { - buf_c[u].a = 1111.11F; - buf_c[u].x = 2222; - buf_c[u].y = 3333.3333F; - buf_c[u].z = 'd'; - } + buf_c[u].a = 1111.11F; + buf_c[u].x = 2222; + buf_c[u].y = 3333.3333F; + buf_c[u].z = 'd'; + } if(H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) goto error; } /* Check if space is allocated */ if(datatype==H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0) - goto error; + goto error; if(datatype==H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0) goto error; if(layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) { H5_FAILED(); - printf(" %d: Got unallocated space instead of allocated.\n",__LINE__); - printf(" Got %d\n", allocation); + HDprintf(" %d: Got unallocated space instead of allocated.\n",__LINE__); + HDprintf(" Got %d\n", allocation); goto error; } HDfree(buf); @@ -938,86 +938,86 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if((mspace = H5Screate_simple(5, one, NULL)) < 0) goto error; for(i = 0; i < 1000; i++) { - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; - odd += (int)(hs_offset[j]%2); - } /* end for */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % cur_size[j]; + odd += (int)(hs_offset[j]%2); + } /* end for */ + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) goto error; - /* case for atomic datatype */ + /* case for atomic datatype */ if(datatype==H5T_INTEGER) { - if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) + if(H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0) goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { should_be = odd ? fillval : 9999; if(val_rd!=should_be) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " "should be: %u\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], (long)hs_offset[4], val_rd, should_be); goto error; } - } - else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { - should_be = 9999; - if(val_rd!=should_be) { - H5_FAILED(); + } + else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { + should_be = 9999; + if(val_rd!=should_be) { + H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " - "should be: %u\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], val_rd, should_be); - goto error; - } - } else if(fill_time == H5D_FILL_TIME_NEVER && odd) { - /*Trash data. Don't compare*/ - } - } /* end for datatype==H5T_INTEGER */ - /* case for compound datatype */ - else if(datatype==H5T_COMPOUND) { + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + "should be: %u\n", + (long)hs_offset[0], (long)hs_offset[1], + (long)hs_offset[2], (long)hs_offset[3], + (long)hs_offset[4], val_rd, should_be); + goto error; + } + } else if(fill_time == H5D_FILL_TIME_NEVER && odd) { + /*Trash data. Don't compare*/ + } + } /* end for datatype==H5T_INTEGER */ + /* case for compound datatype */ + else if(datatype==H5T_COMPOUND) { if(H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0) goto error; if(fill_time == H5D_FILL_TIME_ALLOC) { - if(odd) { - should_be_c.a=fill_c.a; - should_be_c.x=fill_c.x; - should_be_c.y=fill_c.y; - should_be_c.z=fill_c.z; - } else { - should_be_c.a=buf_c[0].a; - should_be_c.x=buf_c[0].x; - should_be_c.y=buf_c[0].y; - should_be_c.z=buf_c[0].z; - } - if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || - !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { + if(odd) { + should_be_c.a=fill_c.a; + should_be_c.x=fill_c.x; + should_be_c.y=fill_c.y; + should_be_c.z=fill_c.z; + } else { + should_be_c.a=buf_c[0].a; + should_be_c.x=buf_c[0].x; + should_be_c.y=buf_c[0].y; + should_be_c.z=buf_c[0].z; + } + if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || + !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " "should be: %f,%d,%f,%c\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], (long)hs_offset[4], - (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a, - should_be_c.x,should_be_c.y,should_be_c.z); + (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a, + should_be_c.x,should_be_c.y,should_be_c.z); goto error; - } - } /* end for fill_time == H5D_FILL_TIME_ALLOC */ - else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { + } + } /* end for fill_time == H5D_FILL_TIME_ALLOC */ + else if(fill_time == H5D_FILL_TIME_NEVER && !odd) { should_be_c.a=buf_c[0].a; should_be_c.x=buf_c[0].x; should_be_c.y=buf_c[0].y; should_be_c.z=buf_c[0].z; - if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || - !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { + if(!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x || + !H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) { H5_FAILED(); HDfprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " + HDprintf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c " "should be: %f,%d,%f,%c\n", (long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3], @@ -1026,11 +1026,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, should_be_c.x,should_be_c.y,should_be_c.z); goto error; } - } /* end for fill_time == H5D_FILL_TIME_NEVER */ + } /* end for fill_time == H5D_FILL_TIME_NEVER */ else if(fill_time == H5D_FILL_TIME_NEVER && odd) { /*Trash data. Don't compare*/ } - } /* end for datatype==H5T_COMPOUND */ + } /* end for datatype==H5T_COMPOUND */ } if(datatype == H5T_COMPOUND) { HDfree(buf_c); @@ -1045,16 +1045,16 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, error: H5E_BEGIN_TRY { - if(datatype==H5T_INTEGER) H5Dclose(dset1); - if(datatype==H5T_COMPOUND) H5Dclose(dset2); - H5Sclose(fspace); - H5Sclose(mspace); + if(datatype==H5T_INTEGER) H5Dclose(dset1); + if(datatype==H5T_COMPOUND) H5Dclose(dset2); + H5Sclose(fspace); + H5Sclose(mspace); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_rdwr * @@ -1068,8 +1068,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, * Thursday, October 1, 1998 * * Modifications: - * Many new cases have been added to this test since the - * fill value design is modified. + * Many new cases have been added to this test since the + * fill value design is modified. * *------------------------------------------------------------------------- */ @@ -1077,9 +1077,9 @@ static int test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) { char filename[1024]; - hid_t file=-1, dcpl=-1, ctype_id=-1; + hid_t file=-1, dcpl=-1, ctype_id=-1; hsize_t ch_size[5] = {2, 8, 8, 4, 2}; - int nerrors=0; + int nerrors=0; int fillval = 0x4c70f1cd; comp_datatype fill_ctype={0,0,0,0}; @@ -1154,7 +1154,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) fill_ctype.y = 4444.4444F; if(H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, - layout, H5T_COMPOUND, ctype_id); + layout, H5T_COMPOUND, ctype_id); if(H5Pclose(dcpl) < 0) goto error; if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; @@ -1211,7 +1211,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if(nerrors) - goto error; + goto error; if(H5Pclose(dcpl) < 0) goto error; if(H5Tclose(ctype_id) < 0) goto error; if(H5Fclose(file) < 0) goto error; @@ -1221,22 +1221,22 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) error: H5E_BEGIN_TRY { H5Pclose(dcpl); - H5Tclose(ctype_id); + H5Tclose(ctype_id); H5Fclose(file); } H5E_END_TRY; return nerrors; } - + /*------------------------------------------------------------------------- - * Function: test_extend_init_integer + * Function: test_extend_init_integer * - * Purpose: Initializes integer values + * Purpose: Initializes integer values * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1255,16 +1255,16 @@ test_extend_init_integer(void *_buf, size_t nelmts, const void *_val) return 0; } /* end test_extend_init_integer() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_verify_integer + * Function: test_extend_verify_integer * - * Purpose: Verifies integer values + * Purpose: Verifies integer values * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1293,16 +1293,16 @@ error: return -1; } /* end test_extend_verify_integer() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_release_integer + * Function: test_extend_release_integer * - * Purpose: Release element of integer value + * Purpose: Release element of integer value * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1313,16 +1313,16 @@ test_extend_release_integer(void H5_ATTR_UNUSED *_elmt) return 0; } /* end test_extend_release_integer() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_init_cmpd_vl + * Function: test_extend_init_cmpd_vl * - * Purpose: Initializes compound+vl values + * Purpose: Initializes compound+vl values * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1348,16 +1348,16 @@ test_extend_init_cmpd_vl(void *_buf, size_t nelmts, const void *_val) return 0; } /* end test_extend_init_cmpd_vl() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_verify_cmpd_vl + * Function: test_extend_verify_cmpd_vl * - * Purpose: Verifies compound+vl values + * Purpose: Verifies compound+vl values * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1389,16 +1389,16 @@ error: return -1; } /* end test_extend_verify_cmpd_vl() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_release_cmpd_vl + * Function: test_extend_release_cmpd_vl * - * Purpose: Release element of compound+vl value + * Purpose: Release element of compound+vl value * - * Return: Success: 0 - * Failure: < 0 + * Return: Success: 0 + * Failure: < 0 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1415,16 +1415,16 @@ test_extend_release_cmpd_vl(void *_elmt) return 0; } /* end test_extend_release_integer() */ - + /*------------------------------------------------------------------------- - * Function: test_extend_cases + * Function: test_extend_cases * - * Purpose: Called to test fill values with various different values + * Purpose: Called to test fill values with various different values * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 3, 2007 * *------------------------------------------------------------------------- @@ -1433,13 +1433,13 @@ static int test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_size, hsize_t *start_size, hsize_t *max_size, hid_t dtype, void *fillval) { - hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */ - hid_t dset = -1; /* Dataset ID */ + hid_t fspace = -1, mspace = -1; /* File & memory dataspaces */ + hid_t dset = -1; /* Dataset ID */ hid_t dcpl = -1; /* Dataset creation property list */ - hsize_t extend_size[5]; /* Dimensions to extend to */ - hsize_t one[5] = {1, 1, 1, 1, 1}; /* Dimensions of single element dataspace */ - hsize_t hs_size[5], hs_stride[5], hs_offset[5]; - size_t nelmts; + hsize_t extend_size[5]; /* Dimensions to extend to */ + hsize_t one[5] = {1, 1, 1, 1, 1}; /* Dimensions of single element dataspace */ + hsize_t hs_size[5], hs_stride[5], hs_offset[5]; + size_t nelmts; H5T_class_t dtype_class; /* Class of datatype */ int (*init_rtn)(void *, size_t, const void *); int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *); @@ -1447,12 +1447,12 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, size_t val_size; /* Size of element */ void *val_rd, *odd_val; const void *init_val, *should_be, *even_val; - int val_rd_i, init_val_i = 9999; + int val_rd_i, init_val_i = 9999; comp_vl_datatype init_val_c = {87, "baz", "mumble", 129}; comp_vl_datatype val_rd_c; - void *buf = NULL; - unsigned odd; /* Whether an odd or even coord. was read */ - unsigned i, j; /* Local index variables */ + void *buf = NULL; + unsigned odd; /* Whether an odd or even coord. was read */ + unsigned i, j; /* Local index variables */ /* Make copy of dataset creation property list */ if((dcpl = H5Pcopy(_dcpl)) < 0) TEST_ERROR @@ -1503,14 +1503,14 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0; j < 5; j++) - hs_offset[j] = (hsize_t)HDrand() % start_size[j]; + for(j = 0; j < 5; j++) + hs_offset[j] = (hsize_t)HDrand() % start_size[j]; /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0) TEST_ERROR @@ -1526,10 +1526,10 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, /* Initialize dataspace & hyperslab info */ for(i = 0, nelmts = 1; i < 5; i++) { - hs_size[i] = (start_size[i] + 1) / 2; - hs_offset[i] = 0; - hs_stride[i] = 2; - nelmts *= hs_size[i]; + hs_size[i] = (start_size[i] + 1) / 2; + hs_offset[i] = 0; + hs_stride[i] = 2; + nelmts *= hs_size[i]; } /* end for */ /* Check for overflow */ @@ -1556,19 +1556,19 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % start_size[j]; - odd += (unsigned)(hs_offset[j] % 2); - } /* end for */ + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % start_size[j]; + odd += (unsigned)(hs_offset[j] % 2); + } /* end for */ /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ - should_be = odd ? odd_val : even_val; + should_be = odd ? odd_val : even_val; if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR /* Release any VL components */ @@ -1594,22 +1594,22 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; - if(hs_offset[j] >= start_size[j]) - odd = 1; - else - odd += (unsigned)(hs_offset[j] % 2); - } /* end for */ + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; + if(hs_offset[j] >= start_size[j]) + odd = 1; + else + odd += (unsigned)(hs_offset[j] % 2); + } /* end for */ /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ - should_be = odd ? odd_val : even_val; + should_be = odd ? odd_val : even_val; if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR /* Release any VL components */ @@ -1633,22 +1633,22 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % max_size[j]; - if(hs_offset[j] >= start_size[j]) - odd = 1; - else - odd += (unsigned)(hs_offset[j] % 2); - } /* end for */ + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % max_size[j]; + if(hs_offset[j] >= start_size[j]) + odd = 1; + else + odd += (unsigned)(hs_offset[j] % 2); + } /* end for */ /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ - should_be = odd ? odd_val : even_val; + should_be = odd ? odd_val : even_val; if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR /* Release any VL components */ @@ -1674,22 +1674,22 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, if((mspace = H5Screate_simple(5, one, NULL)) < 0) TEST_ERROR for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; - if(hs_offset[j] >= start_size[j]) - odd = 1; - else - odd += (unsigned)(hs_offset[j] % 2); - } /* end for */ + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; + if(hs_offset[j] >= start_size[j]) + odd = 1; + else + odd += (unsigned)(hs_offset[j] % 2); + } /* end for */ /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ - should_be = odd ? odd_val : even_val; + should_be = odd ? odd_val : even_val; if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR /* Release any VL components */ @@ -1767,22 +1767,22 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, /* Read some data and make sure it's the right value */ for(i = 0; i < 1000; i++) { /* Set offset for random element */ - for(j = 0, odd = 0; j < 5; j++) { - hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; - if(hs_offset[j] >= start_size[j]) - odd = 1; - else - odd += (unsigned)(hs_offset[j] % 2); - } /* end for */ + for(j = 0, odd = 0; j < 5; j++) { + hs_offset[j] = (hsize_t)HDrand() % extend_size[j]; + if(hs_offset[j] >= start_size[j]) + odd = 1; + else + odd += (unsigned)(hs_offset[j] % 2); + } /* end for */ /* Select the random element */ - if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR + if(H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0) TEST_ERROR /* Read the random element */ - if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR + if(H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR /* Verify the element read in */ - should_be = odd ? odd_val : even_val; + should_be = odd ? odd_val : even_val; if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR /* Release any VL components */ @@ -1811,26 +1811,26 @@ error: if(buf) HDfree(buf); H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Dclose(dset); - H5Sclose(fspace); - H5Sclose(mspace); + H5Pclose(dcpl); + H5Dclose(dset); + H5Sclose(fspace); + H5Sclose(mspace); } H5E_END_TRY; return -1; } /* end test_extend_cases() */ - + /*------------------------------------------------------------------------- - * Function: test_extend + * Function: test_extend * - * Purpose: Test that filling works okay when a dataset is extended. + * Purpose: Test that filling works okay when a dataset is extended. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, October 5, 1998 * * Modifications: @@ -1840,30 +1840,30 @@ error: static int test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) { - hid_t file = -1; /* File ID */ - hid_t dcpl = -1; /* Dataset creation property list ID */ - hid_t cmpd_vl_tid = -1; /* Compound+vl datatype ID */ - hsize_t start_size[5] = {8, 8, 8, 4, 2}; - hsize_t max_size[5] = {32, 32, 32, 16, 8}; - hsize_t ch_size[5] = {1, 8, 8, 4, 2}; + hid_t file = -1; /* File ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + hid_t cmpd_vl_tid = -1; /* Compound+vl datatype ID */ + hsize_t start_size[5] = {8, 8, 8, 4, 2}; + hsize_t max_size[5] = {32, 32, 32, 16, 8}; + hsize_t ch_size[5] = {1, 8, 8, 4, 2}; #ifdef NO_FILLING - int fillval_i = 0; + int fillval_i = 0; #else - int fillval_i = 0x4c70f1cd; + int fillval_i = 0x4c70f1cd; #endif comp_vl_datatype fillval_c = {32, "foo", "bar", 64}; /* Fill value for compound+vl datatype tests */ - char filename[1024]; + char filename[1024]; /* Print testing message */ if(H5D_CHUNKED == layout) - TESTING("chunked dataset extend") + TESTING("chunked dataset extend") else - TESTING("contiguous dataset extend") + TESTING("contiguous dataset extend") /* Create dataset creation property list */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR if(H5D_CHUNKED == layout) - if(H5Pset_chunk(dcpl, 5, ch_size) < 0) TEST_ERROR + if(H5Pset_chunk(dcpl, 5, ch_size) < 0) TEST_ERROR #if 1 /* @@ -1877,13 +1877,13 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * below. */ if(H5D_CONTIGUOUS==layout) { - max_size[0] = (max_size[0] * max_size[1] * max_size[2] * - max_size[3] * max_size[4]) / - (start_size[1] * start_size[2] * start_size[3] * start_size[4]); - max_size[1] = start_size[1]; - max_size[2] = start_size[2]; - max_size[3] = start_size[3]; - max_size[4] = start_size[4]; + max_size[0] = (max_size[0] * max_size[1] * max_size[2] * + max_size[3] * max_size[4]) / + (start_size[1] * start_size[2] * start_size[3] * start_size[4]); + max_size[1] = start_size[1]; + max_size[2] = start_size[2]; + max_size[3] = start_size[3]; + max_size[4] = start_size[4]; } #endif @@ -1896,13 +1896,13 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) */ if(H5D_CONTIGUOUS==layout) { int fd; - hsize_t nelmts; + hsize_t nelmts; - nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; - if((fd = HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 || - HDclose(fd) < 0) goto error; - if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0) - goto error; + nelmts = max_size[0]*max_size[1]*max_size[2]*max_size[3]*max_size[4]; + if((fd = HDopen(FILE_NAME_RAW, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 || + HDclose(fd) < 0) goto error; + if(H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts*sizeof(int)) < 0) + goto error; } #endif @@ -1914,9 +1914,9 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) * errors described above or `unable to select fill value region'. */ if(H5D_CONTIGUOUS==layout) { - SKIPPED(); - puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); - goto skip; + SKIPPED(); + puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); + goto skip; } #endif @@ -1947,20 +1947,20 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) error: H5E_BEGIN_TRY { H5Tclose(cmpd_vl_tid); - H5Pclose(dcpl); - H5Fclose(file); + H5Pclose(dcpl); + H5Fclose(file); } H5E_END_TRY; return 1; skip: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Fclose(file); + H5Pclose(dcpl); + H5Fclose(file); } H5E_END_TRY; return 0; } /* end test_extend() */ - + /*------------------------------------------------------------------------- * Function: test_compatible * @@ -1992,7 +1992,7 @@ test_compatible(void) TESTING("contiguous dataset compatibility with v. 1.4"); if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { - printf(" Could not open file %s. Try set $srcdir to point at the " + HDprintf(" Could not open file %s. Try set $srcdir to point at the " "source directory of test\n", testfile); goto error; } @@ -2002,8 +2002,8 @@ test_compatible(void) if(H5Pfill_value_defined(dcpl1, &status) < 0) goto error; if(status != H5D_FILL_VALUE_UNDEFINED) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", (long)status); goto error; } @@ -2012,7 +2012,7 @@ test_compatible(void) if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); - printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); + HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } if((mspace = H5Screate_simple(2, one, NULL)) < 0) goto error; @@ -2023,7 +2023,7 @@ test_compatible(void) if(val_rd != 0) { H5_FAILED(); puts(" Got a different value than what was set."); - printf(" Got %ld, set 0\n", (long)val_rd); + HDprintf(" Got %ld, set 0\n", (long)val_rd); goto error; } if(H5Pclose(dcpl1) < 0) goto error; @@ -2037,16 +2037,16 @@ test_compatible(void) if(H5Pfill_value_defined(dcpl2, &status) < 0) goto error; if(status != H5D_FILL_VALUE_USER_DEFINED) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", (long)status); goto error; } if(H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0) goto error; if(rd_fill != fill_val) { H5_FAILED(); - printf(" %d: Got a different fill value than what was set.",__LINE__); - printf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); + HDprintf(" %d: Got a different fill value than what was set.",__LINE__); + HDprintf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val); goto error; } fspace = -1; @@ -2056,7 +2056,7 @@ test_compatible(void) if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); puts(" Got a different dimension size than what was set."); - printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); + HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } if((mspace=H5Screate_simple(2, one, NULL)) < 0) goto error; @@ -2067,7 +2067,7 @@ test_compatible(void) if(val_rd != fill_val) { H5_FAILED(); puts(" Got a different value than what was set."); - printf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); + HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } if(H5Pclose(dcpl2) < 0) goto error; @@ -2096,20 +2096,20 @@ error: } /*------------------------------------------------------------------------- - * Function: test_partalloc_cases + * Function: test_partalloc_cases * - * Purpose: Tests fill values read and write for datasets. + * Purpose: Tests fill values read and write for datasets. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: 1 + * Failure: 1 * - * Programmer: Joel Plutchak + * Programmer: Joel Plutchak * April 15, 2013 * * Modifications: - * This function is called by test_rdwr to write and read - * dataset for different cases of chunked datasets with + * This function is called by test_rdwr to write and read + * dataset for different cases of chunked datasets with * unallocated chunks. * *------------------------------------------------------------------------- @@ -2118,12 +2118,12 @@ error: static int test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t fill_time) { - hid_t fspace=-1, dset1=-1, rspace = -1; - herr_t ret; - hsize_t ds_size[2] = {4, 4}; - hsize_t max_size[2] = {H5S_UNLIMITED,4}; + hid_t fspace=-1, dset1=-1, rspace = -1; + herr_t ret; + hsize_t ds_size[2] = {4, 4}; + hsize_t max_size[2] = {H5S_UNLIMITED,4}; hsize_t chunk_size[2] = {1, 4}; - int fillval=(-1); + int fillval=(-1); int w_values[] = {42}; /* New value to be written */ int f_values[4] = {88,88,88,88}; /* pre-seed read buffer with known values */ int r_values[4] = {88,88,88,88}; /* pre-seed read buffer with known values */ @@ -2141,17 +2141,17 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t /* * Select a point in the file dataspace. */ - coord[0][0]=0; coord[0][1]=0; + coord[0][0]=0; coord[0][1]=0; if (H5Sselect_elements( fspace, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord)) goto error; - + /* * Write single data point to the dataset. */ if ((ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, fspace, H5P_DEFAULT, w_values))< 0) { goto error; } - + /* Read a line/chunk and make sure values are right */ rspace = H5Screate_simple(2, chunk_size, NULL); @@ -2163,7 +2163,7 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t if ((ret = H5Sselect_hyperslab(fspace, H5S_SELECT_SET, start, NULL, count, NULL)) < 0) goto error; if ((ret = H5Sselect_all(rspace)) < 0) - goto error; + goto error; if(H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &r_values) < 0) goto error; @@ -2185,7 +2185,7 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t (r_values[3] != fillval)) { H5_FAILED(); HDfprintf(stdout, "%u: Allocated chunk value read was not correct.\n", (unsigned)__LINE__); - printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", + HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)r_values[0], (long)r_values[1], (long)r_values[2], (long)r_values[3], (long)w_values[0], (long)fillval, @@ -2199,7 +2199,7 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t (f_values[3] != fillval)) { H5_FAILED(); HDfprintf(stdout, "%u: Unallocated chunk value read was not correct.\n", (unsigned)__LINE__); - printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", + HDprintf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)f_values[0], (long)f_values[1], (long)f_values[2], (long)f_values[3], (long)fillval, (long)fillval, @@ -2218,15 +2218,15 @@ test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t error: H5E_BEGIN_TRY { - H5Dclose(dset1); - H5Sclose(fspace); - H5Sclose(rspace); + H5Dclose(dset1); + H5Sclose(fspace); + H5Sclose(rspace); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: test_partalloc * @@ -2246,9 +2246,9 @@ static int test_partalloc(hid_t fapl, const char *base_name) { char filename[1024]; - hid_t file=-1, dcpl=-1; + hid_t file=-1, dcpl=-1; hsize_t ch_size[2] = {1, 4}; - int nerrors=0; + int nerrors=0; TESTING("chunked dataset partially allocated I/O"); @@ -2262,86 +2262,86 @@ test_partalloc(hid_t fapl, const char *base_name) /* I. Test H5D_ALLOC_TIME_LATE space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_LATE\n" ); + HDfprintf( stdout, "\nALLOC_TIME_LATE\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset1", H5D_FILL_TIME_ALLOC); - + /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset2", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset3", H5D_FILL_TIME_IFSET ); /* II. Test H5D_ALLOC_TIME_INCR space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_INCR\n" ); + HDfprintf( stdout, "\nALLOC_TIME_INCR\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset4", H5D_FILL_TIME_ALLOC ); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset5", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset6", H5D_FILL_TIME_IFSET ); /* III. Test H5D_ALLOC_TIME_EARLY space allocation cases */ if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) goto error; #ifdef DEBUG - fprintf( stdout, "\nALLOC_TIME_EARLY\n" ); + HDfprintf( stdout, "\nALLOC_TIME_EARLY\n" ); #endif /* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_ALLOC\n" ); + HDfprintf( stdout, " FILL_TIME_ALLOC\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset7", H5D_FILL_TIME_ALLOC ); /* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_NEVER\n" ); + HDfprintf( stdout, " FILL_TIME_NEVER\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset8", H5D_FILL_TIME_NEVER ); /* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */ if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0) goto error; #ifdef DEBUG - fprintf( stdout, " FILL_TIME_IFSET\n" ); + HDfprintf( stdout, " FILL_TIME_IFSET\n" ); #endif nerrors += test_partalloc_cases(file, dcpl, "dset9", H5D_FILL_TIME_IFSET ); if(nerrors) - goto error; + goto error; if(H5Pclose(dcpl) < 0) goto error; if(H5Fclose(file) < 0) goto error; PASSED(); @@ -2355,17 +2355,17 @@ test_partalloc(hid_t fapl, const char *base_name) return nerrors; } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests fill values + * Purpose: Tests fill values * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, October 1, 1998 * *------------------------------------------------------------------------- @@ -2373,9 +2373,9 @@ test_partalloc(hid_t fapl, const char *base_name) int main(int argc, char *argv[]) { - int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; - hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ - unsigned new_format; /* Whether to use the new format or not */ + int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1; + hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ + unsigned new_format; /* Whether to use the new format or not */ if(argc >= 2) { test_contig = test_chunk = test_compact = 0; diff --git a/test/filter_fail.c b/test/filter_fail.c index 76b3106..2acce01 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -270,15 +270,15 @@ test_filter_read(char *file_name, hid_t my_fapl) for(i = 0; i < DIM; i++) { if(i < DIM-2 && rbuf[i] != i) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } else if(i >= DIM-2 && rbuf[i] != 0) { H5_FAILED(); - printf(" No value should be read.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" No value should be read.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } } @@ -310,15 +310,15 @@ test_filter_read(char *file_name, hid_t my_fapl) for(i = 0; i < DIM; i+=2) { if(i < DIM-2 && rbuf[i] != i) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } else if(i >= DIM-2 && rbuf[i] != 0) { H5_FAILED(); - printf(" No value should be read.\n"); - printf(" At index %d\n", i); - printf(" rbuf[%d]=%d\n", i, rbuf[i]); + HDprintf(" No value should be read.\n"); + HDprintf(" At index %d\n", i); + HDprintf(" rbuf[%d]=%d\n", i, rbuf[i]); TEST_ERROR } } @@ -402,7 +402,7 @@ int main(void) error: if (nerrors) { - printf("***** %u FAILURE%s! *****\n", + HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } diff --git a/test/h5test.c b/test/h5test.c index 707c436..7cb5345 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -25,7 +25,7 @@ #include "H5srcdir.h" /* Necessary for h5_verify_cached_stabs() */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5G_TESTING #include "H5Gpkg.h" @@ -114,10 +114,10 @@ const char *LIBVER_NAMES[] = { static H5E_auto2_t err_func = NULL; static herr_t h5_errors(hid_t estack, void *client_data); -static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, +static char *h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock); - + /*------------------------------------------------------------------------- * Function: h5_errors * @@ -142,7 +142,7 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) return 0; } - + /*------------------------------------------------------------------------- * Function: h5_clean_files * @@ -171,7 +171,7 @@ h5_clean_files(const char *base_name[], hid_t fapl) return; } /* end h5_clean_files() */ - + /*------------------------------------------------------------------------- * Function: h5_delete_test_file * @@ -248,7 +248,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl) } /* end h5_delete_test_file() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: h5_delete_all_test_files * @@ -281,7 +281,7 @@ h5_delete_all_test_files(const char *base_name[], hid_t fapl) return; } /* end h5_delete_all_test_files() */ - + /*------------------------------------------------------------------------- * Function: h5_cleanup * @@ -314,7 +314,7 @@ h5_cleanup(const char *base_name[], hid_t fapl) return retval; } /* end h5_cleanup() */ - + /*------------------------------------------------------------------------- * Function: h5_test_shutdown * @@ -343,7 +343,7 @@ h5_test_shutdown(void) return; } /* end h5_test_shutdown() */ - + /*------------------------------------------------------------------------- * Function: h5_restore_err * @@ -365,7 +365,7 @@ h5_restore_err(void) err_func = NULL; } - + /*------------------------------------------------------------------------- * Function: h5_reset * @@ -407,7 +407,7 @@ h5_reset(void) * Cause the library to emit some diagnostics early so they don't * interfere with other formatted output. */ - sprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); + HDsprintf(filename, "/tmp/h5emit-%05d.h5", HDgetpid()); H5E_BEGIN_TRY { hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -420,7 +420,7 @@ h5_reset(void) #endif /* OLD_WAY */ } - + /*------------------------------------------------------------------------- * Function: h5_test_init * @@ -453,7 +453,7 @@ h5_test_init(void) return; } /* end h5_test_init() */ - + /*------------------------------------------------------------------------- * Function: h5_fixname * @@ -482,7 +482,7 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, FALSE, FALSE)); } - + /*------------------------------------------------------------------------- * Function: h5_fixname_superblock * @@ -508,7 +508,7 @@ h5_fixname_superblock(const char *base_name, hid_t fapl_id, char *fullname, size return (h5_fixname_real(base_name, fapl_id, ".h5", fullname, size, FALSE, TRUE)); } - + /*------------------------------------------------------------------------- * Function: h5_fixname_no_suffix * @@ -528,7 +528,7 @@ h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t s return (h5_fixname_real(base_name, fapl, NULL, fullname, size, FALSE, FALSE)); } - + /*------------------------------------------------------------------------- * Function: h5_fixname_printf * @@ -554,7 +554,7 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size return (h5_fixname_real(base_name, fapl, ".h5", fullname, size, TRUE, FALSE)); } - + /*------------------------------------------------------------------------- * Function: h5_fixname_real * @@ -578,7 +578,7 @@ h5_fixname_printf(const char *base_name, hid_t fapl, char *fullname, size_t size *------------------------------------------------------------------------- */ static char * -h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, +h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, char *fullname, size_t size, hbool_t nest_printf, hbool_t subst_for_superblock) { const char *prefix = NULL; @@ -679,7 +679,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (mpi_rank == 0) - printf("*** Hint ***\n" + HDprintf("*** Hint ***\n" "You can use environment variable HDF5_PARAPREFIX to " "run parallel test files in a\n" "different directory or to add file type prefix. e.g.,\n" @@ -795,7 +795,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix, return fullname; } - + /*------------------------------------------------------------------------- * Function: h5_rmprefix * @@ -826,7 +826,7 @@ h5_rmprefix(const char *filename) return(ret_ptr); } - + /*------------------------------------------------------------------------- * Function: h5_fileaccess * @@ -857,7 +857,7 @@ h5_fileaccess(void) /* Finally, check for libver bounds */ if(h5_get_libver_fapl(fapl_id) < 0) goto error; - + return fapl_id; error: @@ -866,7 +866,7 @@ error: return H5I_INVALID_HID; } /* end h5_fileaccess() */ - + /*------------------------------------------------------------------------- * Function: h5_fileaccess_flags * @@ -897,7 +897,7 @@ h5_fileaccess_flags(unsigned flags) /* Finally, check for libver bounds */ if((flags & H5_FILEACCESS_LIBVER) && h5_get_libver_fapl(fapl_id) < 0) goto error; - + return fapl_id; error: @@ -906,7 +906,7 @@ error: return H5I_INVALID_HID; } /* end h5_fileaccess_flags() */ - + /*------------------------------------------------------------------------- * Function: h5_get_vfd_fapl * @@ -1042,7 +1042,7 @@ error: return -1; } /* end h5_get_vfd_fapl() */ - + /*------------------------------------------------------------------------- * Function: h5_get_libver_fapl * @@ -1105,7 +1105,7 @@ error: return -1; } /* end h5_get_libver_fapl() */ - + /*------------------------------------------------------------------------- * Function: h5_no_hwconv * @@ -1126,7 +1126,7 @@ h5_no_hwconv(void) H5Tunregister(H5T_PERS_HARD, NULL, (hid_t)-1, (hid_t)-1, NULL); } - + /*------------------------------------------------------------------------- * Function: h5_show_hostname * @@ -1160,15 +1160,15 @@ h5_show_hostname(void) if(mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); - printf("MPI-process %d.", mpi_rank); + HDprintf("MPI-process %d.", mpi_rank); } else - printf("thread 0."); + HDprintf("thread 0."); } #elif defined(H5_HAVE_THREADSAFE) - printf("thread %lu.", HDpthread_self_ulong()); + HDprintf("thread %lu.", HDpthread_self_ulong()); #else - printf("thread 0."); + HDprintf("thread 0."); #endif #ifdef H5_HAVE_WIN32_API @@ -1194,18 +1194,18 @@ h5_show_hostname(void) #endif #ifdef H5_HAVE_GETHOSTNAME if (gethostname(hostname, (size_t)80) < 0) - printf(" gethostname failed\n"); + HDprintf(" gethostname failed\n"); else - printf(" hostname=%s\n", hostname); + HDprintf(" hostname=%s\n", hostname); #else - printf(" gethostname not supported\n"); + HDprintf(" gethostname not supported\n"); #endif #ifdef H5_HAVE_WIN32_API WSACleanup(); #endif } - + #ifdef H5_HAVE_PARALLEL /* * Function: h5_set_info_object @@ -1304,7 +1304,7 @@ h5_set_info_object(void) return ret_value; } - + /* * Function: h5_dump_info_object * Purpose: Display content of an MPI Info object @@ -1320,25 +1320,25 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, + HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ - printf("object is MPI_INFO_NULL\n"); + HDprintf("object is MPI_INFO_NULL\n"); } else { MPI_Info_get_nkeys(info, &nkeys); - printf("object has %d items\n", nkeys); + HDprintf("object has %d items\n", nkeys); for (i=0; i 0) if(HDwrite(fd_new, buf, (size_t)nread) < 0) goto error; - + /* Close files */ if(HDclose(fd_old) < 0) goto error; @@ -1682,7 +1682,7 @@ error: return -1; } /* end h5_make_local_copy() */ - + /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs_cb * @@ -1705,7 +1705,7 @@ h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name, return SUCCEED; } /* end h5_verify_cached_stabs_cb() */ - + /*------------------------------------------------------------------------- * Function: h5_verify_cached_stabs * @@ -1768,16 +1768,16 @@ error: /*------------------------------------------------------------------------- * Function: h5_send_message - * + * * Purpose: Sends the specified signal. - * + * * In terms of this test framework, a signal consists of a file - * on disk. Since there are multiple processes that need to + * on disk. Since there are multiple processes that need to * communicate with each other, they do so by writing and - * reading signal files on disk, the names and contents of + * reading signal files on disk, the names and contents of * which are used to inform a process about when it can * proceed and what it should do next. - * + * * This function writes a signal file. The first argument is * the name of the signal file, and the second and third * arguments are the contents of the first two lines of the @@ -1787,7 +1787,7 @@ error: * * Programmer: Mike McGreevy * August 18, 2010 - * + * *------------------------------------------------------------------------- */ void @@ -1806,7 +1806,7 @@ h5_send_message(const char *send, const char *arg1, const char *arg2) else if(arg1 != NULL) { HDassert(arg2 == NULL); HDfprintf(signalfile, "%s\n", arg1); - } /* end if */ + } /* end if */ else { HDassert(arg1 == NULL); HDassert(arg2 == NULL); @@ -1819,38 +1819,38 @@ h5_send_message(const char *send, const char *arg1, const char *arg2) /*------------------------------------------------------------------------- * Function: h5_wait_message - * + * * Purpose: Waits for the specified signal. - * + * * In terms of this test framework, a signal consists of a file - * on disk. Since there are multiple processes that need to + * on disk. Since there are multiple processes that need to * communicate with each other, they do so by writing and - * reading signal files on disk, the names and contents of + * reading signal files on disk, the names and contents of * which are used to inform a process about when it can * proceed and what it should do next. - * + * * This function continuously attempts to read the specified * signal file from disk, and only continues once it has * successfully done so (i.e., only after another process has * called the "h5_send_message" function to write the signal file). - * This functon will then immediately remove the file (i.e., - * to indicate that it has been received and can be reused), + * This functon will then immediately remove the file (i.e., + * to indicate that it has been received and can be reused), * and then exits, allowing the calling function to continue. * * Return: void * * Programmer: Mike McGreevy * August 18, 2010 - * + * *------------------------------------------------------------------------- */ herr_t -h5_wait_message(const char *waitfor) +h5_wait_message(const char *waitfor) { FILE *returnfile; time_t t0,t1; - /* Start timer. If this function runs for too long (i.e., + /* Start timer. If this function runs for too long (i.e., expected signal is never received), it will return failure */ HDtime(&t0); @@ -1938,10 +1938,10 @@ static const H5FD_class_t H5FD_dummy_g = { NULL, /* truncate */ NULL, /* lock */ NULL, /* unlock */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; - + /*------------------------------------------------------------------------- * Function: h5_get_dummy_vfd_class() * @@ -2030,7 +2030,7 @@ error: * Purpose: Get the string that corresponds to the libvery version bound. * * Return: The string - * + * *------------------------------------------------------------------------- */ H5_ATTR_PURE const char * diff --git a/test/h5test.h b/test/h5test.h index a0c8974..15bb15c 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -78,7 +78,7 @@ #define BEGINTEST 3 /* Skip all tests before this test */ /* - * This contains the filename prefix specificied as command line option for + * This contains the filename prefix specified as command line option for * the parallel test files. */ H5TEST_DLLVAR char *paraprefix; @@ -89,7 +89,7 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ /* * Print the current location on the standard output stream. */ -#define AT() printf (" at %s:%d in %s()...\n", \ +#define AT() HDprintf (" at %s:%d in %s()...\n", \ __FILE__, __LINE__, FUNC); /* @@ -101,18 +101,18 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * spaces. If the h5_errors() is used for automatic error handling then * the H5_FAILED() macro is invoked automatically when an API function fails. */ -#define TESTING(WHAT) {printf("Testing %-62s",WHAT); fflush(stdout);} -#define TESTING_2(WHAT) {printf(" Testing %-60s",WHAT); fflush(stdout);} -#define PASSED() {puts(" PASSED");fflush(stdout);} -#define H5_FAILED() {puts("*FAILED*");fflush(stdout);} -#define H5_WARNING() {puts("*WARNING*");fflush(stdout);} -#define SKIPPED() {puts(" -SKIP-");fflush(stdout);} -#define PUTS_ERROR(s) {puts(s); AT(); goto error;} +#define TESTING(WHAT) {HDprintf("Testing %-62s",WHAT); HDfflush(stdout);} +#define TESTING_2(WHAT) {HDprintf(" Testing %-60s",WHAT); HDfflush(stdout);} +#define PASSED() {HDputs(" PASSED");HDfflush(stdout);} +#define H5_FAILED() {HDputs("*FAILED*");HDfflush(stdout);} +#define H5_WARNING() {HDputs("*WARNING*");HDfflush(stdout);} +#define SKIPPED() {HDputs(" -SKIP-");HDfflush(stdout);} +#define PUTS_ERROR(s) {HDputs(s); AT(); goto error;} #define TEST_ERROR {H5_FAILED(); AT(); goto error;} #define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;} #define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \ goto error;} -#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;} +#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); HDputs(s); goto error;} /* * Alarm definitions to wait up (terminate) a test that runs too long. diff --git a/test/hyperslab.c b/test/hyperslab.c index d8c00c9..3592ca0 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -85,19 +85,19 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) for(i = 0; i < nx; i++) { if(nz > 1) - printf("i=%lu:\n", (unsigned long)i); + HDprintf("i=%lu:\n", (unsigned long)i); else - printf("%03lu:", (unsigned long)i); + HDprintf("%03lu:", (unsigned long)i); for(j = 0; j < ny; j++) { if(nz > 1) - printf("%03lu:", (unsigned long)j); + HDprintf("%03lu:", (unsigned long)j); for(k = 0; k < nz; k++) - printf(" %3d", *array++); + HDprintf(" %3d", *array++); if(nz > 1) - printf("\n"); + HDprintf("\n"); } /* end for */ - printf("\n"); + HDprintf("\n"); } /* end for */ } /* end print_array() */ @@ -122,7 +122,7 @@ print_ref(size_t nx, size_t ny, size_t nz) uint8_t *array; if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) { - printf("Reference array:\n"); + HDprintf("Reference array:\n"); init_full(array, nx, ny, nz); print_array(array, nx, ny, nz); HDfree(array); @@ -168,21 +168,21 @@ test_fill(size_t nx, size_t ny, size_t nz, if(0 == ny) { ndims = 1; ny = nz = 1; - sprintf(dim, "%lu", (unsigned long) nx); + HDsprintf(dim, "%lu", (unsigned long) nx); } /* end if */ else { ndims = 2; nz = 1; - sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } /* end else */ } /* end if */ else { ndims = 3; - sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, + HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } /* end else */ - sprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); - printf("%-70s", s); + HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); + HDprintf("%-70s", s); fflush(stdout); /* Allocate array */ @@ -242,8 +242,8 @@ test_fill(size_t nx, size_t ny, size_t nz, * is going directly to a terminal. */ AT(); - printf(" acc != ref_value\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" acc != ref_value\n"); + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu, " "fill=%d\n", (unsigned long)i, (unsigned long)j, @@ -252,7 +252,7 @@ test_fill(size_t nx, size_t ny, size_t nz, (unsigned long)dy, (unsigned long)dz, fill_value); print_ref(nx, ny, nz); - printf("\n Result is:\n"); + HDprintf("\n Result is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -332,17 +332,17 @@ test_copy(int mode, if(0 == ny) { ndims = 1; ny = nz = 1; - sprintf(dim, "%lu", (unsigned long) nx); + HDsprintf(dim, "%lu", (unsigned long) nx); } /* end if */ else { ndims = 2; nz = 1; - sprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dim, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } /* end else */ } /* end if */ else { ndims = 3; - sprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, + HDsprintf(dim, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } /* end else */ @@ -376,8 +376,8 @@ test_copy(int mode, HDabort(); } /* end switch */ - sprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); - printf("%-70s", s); + HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); + HDprintf("%-70s", s); fflush(stdout); /* @@ -481,8 +481,8 @@ test_copy(int mode, * going directly to a terminal. */ AT(); - printf(" acc != ref_value\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" acc != ref_value\n"); + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu\n", (unsigned long)i, (unsigned long)j, @@ -491,7 +491,7 @@ test_copy(int mode, (unsigned long)dy, (unsigned long)dz); print_ref(nx, ny, nz); - printf("\n Destination array is:\n"); + HDprintf("\n Destination array is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -522,9 +522,9 @@ test_copy(int mode, * going directly to a terminal. */ AT(); - printf(" acc != ref_value + nx*ny*nz - " + HDprintf(" acc != ref_value + nx*ny*nz - " "dx*dy*dz\n"); - printf(" i=%lu, j=%lu, k=%lu, " + HDprintf(" i=%lu, j=%lu, k=%lu, " "dx=%lu, dy=%lu, dz=%lu\n", (unsigned long)i, (unsigned long)j, @@ -533,7 +533,7 @@ test_copy(int mode, (unsigned long)dy, (unsigned long)dz); print_ref(nx, ny, nz); - printf("\n Destination array is:\n"); + HDprintf("\n Destination array is:\n"); print_array(dst, nx, ny, nz); } /* end if */ goto error; @@ -594,7 +594,7 @@ test_multifill(size_t nx) } fill, *src = NULL, *dst = NULL; hsize_t i, j; - printf("%-70s", "Testing multi-byte fill value"); + HDprintf("%-70s", "Testing multi-byte fill value"); fflush(stdout); /* Initialize the source and destination */ @@ -639,28 +639,28 @@ test_multifill(size_t nx) s[0] = '\0'; for(i = 0; i < nx; i++) { if(dst[i].left != 3333333) - sprintf(s, "bad dst[%lu].left", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].left", (unsigned long)i); else if(!H5_DBL_ABS_EQUAL(dst[i].mid, fill.mid)) /* Check if two DOUBLE values are equal. If their difference * is smaller than the EPSILON value for double, they are * considered equal. See the definition in h5test.h. */ - sprintf(s, "bad dst[%lu].mid", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].mid", (unsigned long)i); else if(dst[i].right != 4444444) - sprintf(s, "bad dst[%lu].right", (unsigned long)i); + HDsprintf(s, "bad dst[%lu].right", (unsigned long)i); if(s[0]) { H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, + HDprintf(" fill={%d,%g,%d}\n ", fill.left, fill.mid, fill.right); for(j = 0; j < sizeof(fill); j++) - printf(" %02x", ((uint8_t *)&fill)[j]); - printf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, + HDprintf(" %02x", ((uint8_t *)&fill)[j]); + HDprintf("\n dst[%lu]={%d,%g,%d}\n ", (unsigned long)i, dst[i].left, dst[i].mid, dst[i].right); for(j = 0; j < sizeof(dst[i]); j++) - printf(" %02x", ((uint8_t *)(dst + i))[j]); - printf("\n"); + HDprintf(" %02x", ((uint8_t *)(dst + i))[j]); + HDprintf("\n"); } /* end if */ goto error; } /* end if */ @@ -709,7 +709,7 @@ test_endian(size_t nx) hsize_t size[2]; /*size vector */ hsize_t i, j; - printf("%-70s", "Testing endian conversion by stride"); + HDprintf("%-70s", "Testing endian conversion by stride"); fflush(stdout); /* Initialize arrays */ @@ -742,10 +742,10 @@ test_endian(size_t nx) * to a terminal. */ AT(); - printf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); - printf(" Source array is:\n"); + HDprintf(" i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Source array is:\n"); print_array(src, nx, (size_t)4, (size_t)1); - printf("\n Result is:\n"); + HDprintf("\n Result is:\n"); print_array(dst, nx, (size_t)4, (size_t)1); } /* end if */ goto error; @@ -795,9 +795,9 @@ test_transpose(size_t nx, size_t ny) char s[256]; hsize_t i, j; - sprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, + HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Initialize */ @@ -829,20 +829,20 @@ test_transpose(size_t nx, size_t ny) H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); - printf(" Source is:\n"); + HDprintf(" diff at i=%lu, j=%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Source is:\n"); for(i = 0; i < nx; i++) { - printf("%3lu:", (unsigned long)i); + HDprintf("%3lu:", (unsigned long)i); for(j = 0; j < ny; j++) - printf(" %6d", src[i * ny + j]); - printf("\n"); + HDprintf(" %6d", src[i * ny + j]); + HDprintf("\n"); } /* end for */ - printf("\n Destination is:\n"); + HDprintf("\n Destination is:\n"); for (i = 0; i < ny; i++) { - printf("%3lu:", (unsigned long)i); + HDprintf("%3lu:", (unsigned long)i); for(j = 0; j < nx; j++) - printf(" %6d", dst[i * nx + j]); - printf("\n"); + HDprintf(" %6d", dst[i * nx + j]); + HDprintf("\n"); } /* end for */ } /* end if */ goto error; @@ -896,10 +896,10 @@ test_sub_super(size_t nx, size_t ny) hsize_t i, j; char s[256]; - sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", + HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Initialize */ @@ -931,12 +931,12 @@ test_sub_super(size_t nx, size_t ny) H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" full[%lu][%lu] != half[%lu][%lu]\n", + HDprintf(" full[%lu][%lu] != half[%lu][%lu]\n", (unsigned long)i * 2, (unsigned long)j * 2, (unsigned long)i, (unsigned long)j); - printf(" full is:\n"); + HDprintf(" full is:\n"); print_array(full, 2 * nx, 2 * ny, (size_t)1); - printf("\n half is:\n"); + HDprintf("\n half is:\n"); print_array(half, nx, ny, (size_t)1); } /* end if */ goto error; @@ -949,10 +949,10 @@ test_sub_super(size_t nx, size_t ny) * Test replicating pixels to produce an image twice as large in each * dimension. */ - sprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", + HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny)); - printf("%-70s", s); + HDprintf("%-70s", s); fflush(stdout); /* Setup stride */ @@ -978,28 +978,28 @@ test_sub_super(size_t nx, size_t ny) for(i = 0; i < nx; i++) { for(j = 0; j < ny; j++) { if(half[i * ny + j] != twice[4 * i * ny + 2 * j]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2); else if(half[i * ny + j] != twice[4 * i * ny + 2 * j + 1]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2, (unsigned long)j * 2 + 1); else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2); else if(half[i * ny + j] != twice[(2 * i + 1) * 2 * ny + 2 * j + 1]) - sprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", + HDsprintf(s, "half[%lu][%lu] != twice[%lu][%lu]", (unsigned long)i, (unsigned long)j, (unsigned long)i * 2 + 1, (unsigned long)j * 2 + 1); if(s[0]) { H5_FAILED() if(!HDisatty(1)) { AT(); - printf(" %s\n Half is:\n", s); + HDprintf(" %s\n Half is:\n", s); print_array(half, nx, ny, (size_t)1); - printf("\n Twice is:\n"); + HDprintf("\n Twice is:\n"); print_array(twice, 2 * nx, 2 * ny, (size_t)1); } /* end if */ goto error; @@ -1051,7 +1051,7 @@ test_array_fill(size_t lo, size_t hi) size_t u, v, w; /* Local index variables */ char s[256]; - sprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi); + HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo,(unsigned long)hi); TESTING(s); /* Initialize */ @@ -1116,7 +1116,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ char s[256]; - sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); + HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); TESTING(s); /* Initialize */ @@ -1208,18 +1208,18 @@ main(int argc, char *argv[]) else if(!HDstrcmp(argv[i], "medium")) size_of_test |= TEST_MEDIUM; else { - printf("unrecognized argument: %s\n", argv[i]); + HDprintf("unrecognized argument: %s\n", argv[i]); HDexit(EXIT_FAILURE); } /* end else */ } /* end for */ } /* end else */ - printf("Test sizes: "); + HDprintf("Test sizes: "); if(size_of_test & TEST_SMALL) - printf(" SMALL"); + HDprintf(" SMALL"); if(size_of_test & TEST_MEDIUM) - printf(" MEDIUM"); - printf("\n"); + HDprintf(" MEDIUM"); + HDprintf("\n"); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -1425,14 +1425,14 @@ main(int argc, char *argv[]) /*--- END OF TESTS ---*/ if(nerrors) { - printf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 + HDprintf("***** %d HYPERSLAB TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); if(HDisatty(1)) - printf("(Redirect output to a pager or a file to see debug output)\n"); + HDprintf("(Redirect output to a pager or a file to see debug output)\n"); HDexit(EXIT_FAILURE); } /* end if */ - printf("All hyperslab tests passed.\n"); + HDprintf("All hyperslab tests passed.\n"); #ifdef H5_HAVE_THREADSAFE H5close(); diff --git a/test/istore.c b/test/istore.c index 1d57a2a..7489b7e 100644 --- a/test/istore.c +++ b/test/istore.c @@ -106,21 +106,21 @@ print_array(uint8_t *array, size_t nx, size_t ny, size_t nz) for (i = 0; i < nx; i++) { if (nz > 1) { - fprintf(stderr,"i=%lu:\n", (unsigned long)i); + HDfprintf(stderr,"i=%lu:\n", (unsigned long)i); } else { - fprintf(stderr,"%03lu:", (unsigned long)i); + HDfprintf(stderr,"%03lu:", (unsigned long)i); } for (j = 0; j < ny; j++) { if (nz > 1) - fprintf(stderr,"%03lu:", (unsigned long)j); + HDfprintf(stderr,"%03lu:", (unsigned long)j); for (k = 0; k < nz; k++) { - fprintf(stderr," %3d", *array++); + HDfprintf(stderr," %3d", *array++); } if (nz > 1) - fprintf(stderr,"\n"); + HDfprintf(stderr,"\n"); } - fprintf(stderr,"\n"); + HDfprintf(stderr,"\n"); } } @@ -268,19 +268,19 @@ test_extend(hid_t f, const char *prefix, if (!ny) { ndims = 1; ny = nz = 1; - sprintf(dims, "%lu", (unsigned long) nx); + HDsprintf(dims, "%lu", (unsigned long) nx); } else { ndims = 2; nz = 1; - sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } } else { ndims = 3; - sprintf(dims, "%lux%lux%lu", + HDsprintf(dims, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } - sprintf(s, "istore extend: %s", dims); + HDsprintf(s, "istore extend: %s", dims); TESTING(s); buf = (uint8_t *)HDmalloc(nx * ny * nz); check = (uint8_t *)HDmalloc(nx * ny * nz); @@ -294,10 +294,10 @@ test_extend(hid_t f, const char *prefix, max_corner[2] = 0; /* Build the new empty object */ - sprintf(name, "%s_%s", prefix, dims); + HDsprintf(name, "%s_%s", prefix, dims); if ((dataset=new_object(f, name, ndims, whole_size, whole_size)) < 0) { - fprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name); - goto error; + HDfprintf(stderr," Cannot create %u-d object `%s'\n", ndims, name); + goto error; } /* Get dataset's dataspace */ @@ -327,21 +327,21 @@ test_extend(hid_t f, const char *prefix, #if 0 if (0 == ctr) - fprintf(stderr,"\n"); - fprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]); + HDfprintf(stderr,"\n"); + HDfprintf(stderr," Insert: ctr=%lu, corner=(%ld", (unsigned long)ctr, (long)offset[0]); if (ndims > 1) - fprintf(stderr,",%ld", (long)offset[1]); + HDfprintf(stderr,",%ld", (long)offset[1]); if (ndims > 2) - fprintf(stderr,",%ld", (long)offset[2]); - fprintf(stderr,"), size=(%lu", (unsigned long)size[0]); + HDfprintf(stderr,",%ld", (long)offset[2]); + HDfprintf(stderr,"), size=(%lu", (unsigned long)size[0]); if (ndims > 1) - fprintf(stderr,",%lu", (unsigned long)size[1]); + HDfprintf(stderr,",%lu", (unsigned long)size[1]); if (ndims > 2) - fprintf(stderr,",%lu", (unsigned long)size[2]); - fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); + HDfprintf(stderr,",%lu", (unsigned long)size[2]); + HD fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); if (0 == nelmts) - fprintf(stderr," *SKIPPED*"); - fprintf(stderr,"\n"); + HDfprintf(stderr," *SKIPPED*"); + HDfprintf(stderr,"\n"); #endif /* Fill the source array */ @@ -357,7 +357,7 @@ test_extend(hid_t f, const char *prefix, /* Write to disk */ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - fprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Write failed: ctr=%lu\n", (unsigned long)ctr); goto error; } @@ -365,16 +365,16 @@ test_extend(hid_t f, const char *prefix, HDmemset(check, 0xff, (size_t)nelmts); if (H5Dread(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, check) < 0) { H5_FAILED(); - fprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Read failed: ctr=%lu\n", (unsigned long)ctr); goto error; } if (HDmemcmp(buf, check, (size_t)nelmts)) { H5_FAILED(); - fprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr); - fprintf(stderr," Wrote:\n"); + HDfprintf(stderr," Read check failed: ctr=%lu\n", (unsigned long)ctr); + HDfprintf(stderr," Wrote:\n"); print_array(buf, (size_t)size[0], (size_t)size[1], (size_t)size[2]); - fprintf(stderr," Read:\n"); + HDfprintf(stderr," Read:\n"); print_array(check, (size_t)size[0], (size_t)size[1], (size_t)size[2]); goto error; @@ -397,7 +397,7 @@ test_extend(hid_t f, const char *prefix, HDmemset(buf, 0xff, nx * ny * nz); if (H5Dread(dataset, TEST_DATATYPE, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - fprintf(stderr," Read failed for whole array.\n"); + HDfprintf(stderr," Read failed for whole array.\n"); goto error; } for (i=0; i 1) { - fprintf(stderr,", j=%lu", (unsigned long)j); + HDfprintf(stderr,", j=%lu", (unsigned long)j); } if (ndims > 2) { - fprintf(stderr,", k=%lu", (unsigned long)k); + HDfprintf(stderr,", k=%lu", (unsigned long)k); } - fprintf(stderr,"\n Check array is:\n"); + HDfprintf(stderr,"\n Check array is:\n"); print_array(whole, nx, ny, nz); - fprintf(stderr," Value read is:\n"); + HDfprintf(stderr," Value read is:\n"); print_array(buf, nx, ny, nz); goto error; } @@ -481,19 +481,19 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, if (!ny) { ndims = 1; ny = nz = 1; - sprintf(dims, "%lu", (unsigned long) nx); + HDsprintf(dims, "%lu", (unsigned long) nx); } else { ndims = 2; nz = 1; - sprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); + HDsprintf(dims, "%lux%lu", (unsigned long) nx, (unsigned long) ny); } } else { ndims = 3; - sprintf(dims, "%lux%lux%lu", + HDsprintf(dims, "%lux%lux%lu", (unsigned long) nx, (unsigned long) ny, (unsigned long) nz); } - sprintf(s, "istore sparse: %s", dims); + HDsprintf(s, "istore sparse: %s", dims); TESTING(s); if(skip_test){ SKIPPED() @@ -512,10 +512,10 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size[2] = nz; /* Build the new empty object */ - sprintf(name, "%s_%s", prefix, dims); + HDsprintf(name, "%s_%s", prefix, dims); if ((dataset=new_object(f, name, ndims, whole_size, chunk_dims)) < 0) { - printf(" Cannot create %u-d object `%s'\n", ndims, name); - goto error; + HDprintf(" Cannot create %u-d object `%s'\n", ndims, name); + goto error; } /* Get dataset's dataspace */ @@ -535,18 +535,18 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, /* write to disk */ if (H5Dwrite(dataset, TEST_DATATYPE, mspace, fspace, H5P_DEFAULT, buf) < 0) { H5_FAILED(); - printf(" Write failed: ctr=%lu\n", (unsigned long)ctr); - printf(" offset=(%lu", (unsigned long) (offset[0])); + HDprintf(" Write failed: ctr=%lu\n", (unsigned long)ctr); + HDprintf(" offset=(%lu", (unsigned long) (offset[0])); if (ndims > 1) - printf(",%lu", (unsigned long) (offset[1])); + HDprintf(",%lu", (unsigned long) (offset[1])); if (ndims > 2) - printf(",%lu", (unsigned long) (offset[2])); - printf("), size=(%lu", (unsigned long) (size[0])); + HDprintf(",%lu", (unsigned long) (offset[2])); + HDprintf("), size=(%lu", (unsigned long) (size[0])); if (ndims > 1) - printf(",%lu", (unsigned long) (size[1])); + HDprintf(",%lu", (unsigned long) (size[1])); if (ndims > 2) - printf(",%lu", (unsigned long) (size[2])); - printf(")\n"); + HDprintf(",%lu", (unsigned long) (size[2])); + HDprintf(")\n"); goto error; } total += nx * ny * nz; @@ -617,21 +617,21 @@ main(int argc, char *argv[]) } else if (!strcmp(argv[i], "large")) { size_of_test |= TEST_LARGE; } else { - printf("unrecognized argument: %s\n", argv[i]); + HDprintf("unrecognized argument: %s\n", argv[i]); #if 0 exit(EXIT_FAILURE); #endif } } } - printf("Test sizes: "); + HDprintf("Test sizes: "); if (size_of_test & TEST_SMALL) - printf(" SMALL"); + HDprintf(" SMALL"); if (size_of_test & TEST_MEDIUM) - printf(" MEDIUM"); + HDprintf(" MEDIUM"); if (size_of_test & TEST_LARGE) - printf(" LARGE"); - printf("\n"); + HDprintf(" LARGE"); + HDprintf("\n"); /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -653,7 +653,7 @@ main(int argc, char *argv[]) /* Create the test file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { - printf("Cannot create file %s; test aborted\n", filename); + HDprintf("Cannot create file %s; test aborted\n", filename); exit(EXIT_FAILURE); } @@ -708,7 +708,7 @@ main(int argc, char *argv[]) */ status = test_sparse(file, "sparse", (size_t)800, (size_t)50, (size_t)50, (size_t)50, skip_test); if(skip_test) - printf(" The current VFD does not support sparse files on this platform.\n"); + HDprintf(" The current VFD does not support sparse files on this platform.\n"); nerrors += status < 0 ? 1 : 0; } @@ -720,12 +720,12 @@ main(int argc, char *argv[]) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if (nerrors) { - printf("***** %d I-STORE TEST%s FAILED! *****\n", + HDprintf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); exit(EXIT_FAILURE); } - printf("All i-store tests passed.\n"); + HDprintf("All i-store tests passed.\n"); h5_cleanup(FILENAME, fapl); diff --git a/test/lheap.c b/test/lheap.c index e9e626f..5f60dca 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -15,7 +15,7 @@ * Programmer: Robb Matzke * Tuesday, November 24, 1998 * - * Purpose: Test local heaps used by symbol tables (groups). + * Purpose: Test local heaps used by symbol tables (groups). */ #include "h5test.h" #include "H5srcdir.h" @@ -34,7 +34,7 @@ const char *FILENAME[] = { #define NOBJS 40 - + /*------------------------------------------------------------------------- * Function: main * @@ -100,7 +100,7 @@ main(void) goto error; } for(i = 0; i < NOBJS; i++) { - sprintf(buf, "%03d-", i); + HDsprintf(buf, "%03d-", i); for(j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if(j > 4) @@ -140,7 +140,7 @@ main(void) goto error; } for(i = 0; i < NOBJS; i++) { - sprintf(buf, "%03d-", i); + HDsprintf(buf, "%03d-", i); for(j = 4; j < i; j++) buf[j] = (char)('0' + j % 10); if(j > 4) diff --git a/test/mf.c b/test/mf.c index fe98000..2d24f6e 100644 --- a/test/mf.c +++ b/test/mf.c @@ -13,23 +13,23 @@ /* * Tests for file memory management consist of 3 parts: - * test_mf_eoa_*() tests for file meomory that interact with file allocation - * test_mf_fs_*() tests for file memory that interact with the free-space manager - * test_mf_aggr_*() tests for file memory that interact with the aggregators - * test_mf_align_*() tests for file memory with alignment setting - * test_filespace_*() tests for file space management - * test_page_*() tests for file space paging + * test_mf_eoa_*() tests for file meomory that interact with file allocation + * test_mf_fs_*() tests for file memory that interact with the free-space manager + * test_mf_aggr_*() tests for file memory that interact with the aggregators + * test_mf_align_*() tests for file memory with alignment setting + * test_filespace_*() tests for file space management + * test_page_*() tests for file space paging */ #include "h5test.h" -#define H5MF_FRIEND /*suppress error about including H5MFpkg */ +#define H5MF_FRIEND /*suppress error about including H5MFpkg */ #include "H5MFpkg.h" -#define H5FS_FRIEND /*suppress error about including H5FSpkg */ +#define H5FS_FRIEND /*suppress error about including H5FSpkg */ #include "H5FSpkg.h" -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" @@ -138,7 +138,7 @@ static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl); static unsigned test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); -static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); +static unsigned test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); static unsigned test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); static unsigned test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); static unsigned test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format); @@ -212,15 +212,15 @@ error: static unsigned test_mf_eoa(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr1, addr2; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0; + H5FD_mem_t type; + haddr_t addr1, addr2; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MM_alloc() of file allocation"); @@ -321,8 +321,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); } /* end else */ return(0); @@ -330,7 +330,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_eoa() */ @@ -340,32 +340,32 @@ error: * To verify that an allocated block from file allocation is shrunk. * * Set up: - * Turn off using meta/small data aggregator - * There is nothing in free-space manager - * - * Test 1: Allocate a block of 30 from file allocation - * H5MF_try_shrink() the block by 30 : succeed - * Test 2: Allocate a block of 30 from file allocation - * H5MF_try_shrink() the block by 20 : fail - * Test 3: Allocate a block of 30 from file allocation - * H5MF_try_shrink() the block by 40 : fail - * Test 4: Allocate a block of 30 from file allocation - * H5MF_try_shrink() the block by 20 from the end: succeed + * Turn off using meta/small data aggregator + * There is nothing in free-space manager + * + * Test 1: Allocate a block of 30 from file allocation + * H5MF_try_shrink() the block by 30 : succeed + * Test 2: Allocate a block of 30 from file allocation + * H5MF_try_shrink() the block by 20 : fail + * Test 3: Allocate a block of 30 from file allocation + * H5MF_try_shrink() the block by 40 : fail + * Test 4: Allocate a block of 30 from file allocation + * H5MF_try_shrink() the block by 20 from the end: succeed * *------------------------------------------------------------------------- */ static unsigned test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size = 0, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr = 0; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0; + H5FD_mem_t type; + haddr_t addr = 0; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_shrink() of file allocation: test 1"); @@ -463,8 +463,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation: test 2"); @@ -511,8 +511,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ @@ -555,8 +555,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation: test 4"); @@ -603,8 +603,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); @@ -612,7 +612,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_eoa_shrink() */ @@ -622,29 +622,29 @@ error: * To verify that an allocated block from file allocation is extended. * * Set up: - * Turn off using meta/small data aggregator - * There is nothing in free-space manager + * Turn off using meta/small data aggregator + * There is nothing in free-space manager * * Test 1: Allocate a block of 30 - * H5MF_try_extend() the block of size 30 by 50: succeed + * H5MF_try_extend() the block of size 30 by 50: succeed * * Test 2: Allocate a block of 30 - * H5MF_try_extend() the block of size 20 by 50: fail + * H5MF_try_extend() the block of size 20 by 50: fail *------------------------------------------------------------------------- */ static unsigned test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ - h5_stat_size_t file_size, new_file_size; /* File size */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + h5_stat_size_t file_size, new_file_size; /* File size */ H5FD_mem_t type; - haddr_t addr; + haddr_t addr; htri_t was_extended; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_extend() of file allocation: test 1"); @@ -741,8 +741,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of file allocation: test 2"); @@ -804,8 +804,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); @@ -813,7 +813,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_eoa_extend() */ @@ -823,7 +823,7 @@ error: * To verify that temporary blocks are allocated correctly * * Set up: - * There is nothing in free-space manager + * There is nothing in free-space manager * * Tests: * Allocate a reasonable-sized temporary block @@ -855,13 +855,13 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Can't run this test with multi-file VFDs */ if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) { - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ haddr_t maxaddr; /* File's max. address */ - haddr_t tmp_addr; /* Temporary space file address */ - haddr_t norm_addr; /* Normal space file address */ - haddr_t check_addr; /* File address for checking for errors */ + haddr_t tmp_addr; /* Temporary space file address */ + haddr_t norm_addr; /* Normal space file address */ + haddr_t check_addr; /* File address for checking for errors */ unsigned char buf = 0; /* Buffer to read/write with */ herr_t status; /* Generic status value */ @@ -1002,15 +1002,15 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + puts(" Current VFD doesn't support continuous address space"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_tmp() */ @@ -1020,16 +1020,16 @@ error: * To verify that the free-space manager is created or opened * * Set up: - * Turn off using meta/small data aggregator + * Turn off using meta/small data aggregator *------------------------------------------------------------------------- */ static unsigned test_mf_fs_start(hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ H5FS_stat_t state; @@ -1088,7 +1088,7 @@ test_mf_fs_start(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1100,7 +1100,7 @@ test_mf_fs_start(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_start() */ @@ -1111,36 +1111,36 @@ error: * To verify that a block is allocated/freed from/to the free-space manager * * Set up: - * Turn off using meta/small data aggregator + * Turn off using meta/small data aggregator * * Test 1: - * Add section A to free-space manager (addr=70, size=30) - * Allocate a block of size=30 - * The returned space's address should be same as section A's address - * Deallocate the block which will be returned to the free-space manager + * Add section A to free-space manager (addr=70, size=30) + * Allocate a block of size=30 + * The returned space's address should be same as section A's address + * Deallocate the block which will be returned to the free-space manager * Test 2: - * Add section A to free-space manager (addr=70, size=30) - * Allocate a block of size=20 - * The returned space's address should be same as section A's address - * There should still be space of 10 left in the free-space manager - * Deallocate the block which will be returned to free-space manager + * Add section A to free-space manager (addr=70, size=30) + * Allocate a block of size=20 + * The returned space's address should be same as section A's address + * There should still be space of 10 left in the free-space manager + * Deallocate the block which will be returned to free-space manager * Test 3: - * Add section A to free-space manager (addr=70, size=30) - * Allocate a block of size=40 - * The free-space manager is unable to fulfill the request - * The block is allocated from file allocation - * Deallocate the block which will be returned to free-space manager - * (the space is shrunk and freed since it is at end of file) + * Add section A to free-space manager (addr=70, size=30) + * Allocate a block of size=40 + * The free-space manager is unable to fulfill the request + * The block is allocated from file allocation + * Deallocate the block which will be returned to free-space manager + * (the space is shrunk and freed since it is at end of file) *------------------------------------------------------------------------- */ static unsigned test_mf_fs_alloc_free(hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ - h5_stat_size_t file_size, new_file_size; /* file size */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + h5_stat_size_t file_size, new_file_size; /* file size */ H5MF_free_section_t *sect_node = NULL; haddr_t addr; haddr_t tmp; @@ -1206,7 +1206,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify that the allocated block is section A in free-space */ if(addr != TBLOCK_ADDR70) - TEST_ERROR + TEST_ERROR state.tot_space -= TBLOCK_SIZE30; state.tot_sect_count -= 1; @@ -1240,7 +1240,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1283,7 +1283,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify that the allocated block is section A in free-space manager */ if(addr != TBLOCK_ADDR70) - TEST_ERROR + TEST_ERROR /* should still have 1 section of size 10 left in free-space manager */ state.tot_space -= (TBLOCK_SIZE20); @@ -1315,7 +1315,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1400,7 +1400,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1412,7 +1412,7 @@ test_mf_fs_alloc_free(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_alloc_free() */ @@ -1423,47 +1423,47 @@ error: * To verify that a block allocated from the free-space manager can be extended * * Set up: - * Turn off using meta/small data aggregator + * Turn off using meta/small data aggregator * * Test 1: - * Add section A to free-space manager: addr=70, size=30 - * Allocate a block of size 30 from free-space manager - * Add section B to free-space manager: addr=100, size=50 - * Try to extend the allocated block by requested-size=50 - * Succeed: section A adjoins section B (70+30=100 which is section B's address) and - * requested-size (50) is equal to the size of section B + * Add section A to free-space manager: addr=70, size=30 + * Allocate a block of size 30 from free-space manager + * Add section B to free-space manager: addr=100, size=50 + * Try to extend the allocated block by requested-size=50 + * Succeed: section A adjoins section B (70+30=100 which is section B's address) and + * requested-size (50) is equal to the size of section B * Test 2: - * Add section A to free-space manager: addr=70, size=30 - * Allocate a block of size 30 from free-space manager - * Add section B to free-space manager: addr=100, size=50 - * Try to extend the allocated block by requested-size=60 - * Fail: section A adjoins section B (70+30=100 which is section B's address) but - * requested-size (60) > size of section B (50) + * Add section A to free-space manager: addr=70, size=30 + * Allocate a block of size 30 from free-space manager + * Add section B to free-space manager: addr=100, size=50 + * Try to extend the allocated block by requested-size=60 + * Fail: section A adjoins section B (70+30=100 which is section B's address) but + * requested-size (60) > size of section B (50) * * Test 3: - * Add section A to free-space manager: addr=70, size=30 - * Allocate a block of size 30 from free-space manager - * Add section B to free-space manager: addr=100, size=50 - * Try to extend the allocated block by requested-size=40 - * Succeed: section A adjoins section B (70+30=100 which is section B's address) and - * requested-size (40) < size of section B (50), therefore, - * a section of 10 is left in the free-space manager + * Add section A to free-space manager: addr=70, size=30 + * Allocate a block of size 30 from free-space manager + * Add section B to free-space manager: addr=100, size=50 + * Try to extend the allocated block by requested-size=40 + * Succeed: section A adjoins section B (70+30=100 which is section B's address) and + * requested-size (40) < size of section B (50), therefore, + * a section of 10 is left in the free-space manager * Test 4: - * Add section A to free-space manager: addr=70, size=20 - * Allocate a block of size 20 from free-space manager - * Add section B to free-space manager: addr=100, size=50 - * Try to extend the allocated block by 50 from the free-space_manager: - * Fail: section A does not adjoin section B (70+20 != address of section B) even though - * the requested-size (50) equal to size of section B (50) + * Add section A to free-space manager: addr=70, size=20 + * Allocate a block of size 20 from free-space manager + * Add section B to free-space manager: addr=100, size=50 + * Try to extend the allocated block by 50 from the free-space_manager: + * Fail: section A does not adjoin section B (70+20 != address of section B) even though + * the requested-size (50) equal to size of section B (50) *------------------------------------------------------------------------- */ static unsigned test_mf_fs_extend(hid_t fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl_new = -1; /* copy of fapl */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl_new = -1; /* copy of fapl */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ H5MF_free_section_t *sect_node1 = NULL, *sect_node2=NULL; haddr_t addr; @@ -1559,7 +1559,7 @@ test_mf_fs_extend(hid_t fapl) /* should succeed */ if(was_extended <= 0) - TEST_ERROR + TEST_ERROR /* Section B is removed from free-space manager */ state.tot_space -= TBLOCK_SIZE50; @@ -1586,7 +1586,7 @@ test_mf_fs_extend(hid_t fapl) if(tmp != TBLOCK_ADDR70) TEST_ERROR - + if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -1596,7 +1596,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1667,7 +1667,7 @@ test_mf_fs_extend(hid_t fapl) /* Should not be able to extend the allocated block */ if(was_extended) - TEST_ERROR + TEST_ERROR /* free-space info should remain the same */ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state)) @@ -1698,7 +1698,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1769,7 +1769,7 @@ test_mf_fs_extend(hid_t fapl) /* Should succeed in extending the allocated block */ if(was_extended <=0) - TEST_ERROR + TEST_ERROR /* Should have 1 section of size=10 left in free-space manager */ state.tot_space -= (TBLOCK_SIZE40); @@ -1788,7 +1788,7 @@ test_mf_fs_extend(hid_t fapl) /* Remove the merged sections A & B from free-space */ if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(TBLOCK_SIZE30+TBLOCK_SIZE50), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE) TEST_ERROR - + if(tmp != addr) TEST_ERROR if(H5Fclose(file) < 0) @@ -1800,7 +1800,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1871,7 +1871,7 @@ test_mf_fs_extend(hid_t fapl) /* Should not succeed in extending the allocated block */ if(was_extended) - TEST_ERROR + TEST_ERROR /* Free-space info should be the same */ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state)) @@ -1906,7 +1906,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1918,7 +1918,7 @@ test_mf_fs_extend(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_extend() */ @@ -1927,26 +1927,26 @@ error: *------------------------------------------------------------------------- * To verify that an aggregator is absorbed into a section. * - * Test 1: To aborb the aggregator onto the beginning of the section - * Allocate block A from meta_aggr - * Create a free-space section node with an address that adjoins - * the end of meta_aggr and a size to make the aggregator - * get absorbed into the section. - * The adding of the section to free-space will call H5MF_aggr_absorb(), - * which will absorb meta_aggr to the section: - * section size + remaining size of aggregator is > aggr->alloc_size, - * section is allowed to absorb an aggregator (allow_sect_absorb is true) - * - * Test 2: To absorb the aggregator onto the end of the section - * Allocate block A from meta_aggr - * Allocate block B from sdata_aggr - * Create a free-space section node with an address that adjoins - * the beginning of meta_aggr and a size to make the - * aggregator get absorbed into the section. - * The adding of the section to free-space will call H5MF_aggr_absorb(), - * which will absorb meta_aggr to the section: - * section size + remaining size of aggregator is > aggr->alloc_size, - * section is allowed to absorb an aggregator (allow_sect_absorb is true) + * Test 1: To aborb the aggregator onto the beginning of the section + * Allocate block A from meta_aggr + * Create a free-space section node with an address that adjoins + * the end of meta_aggr and a size to make the aggregator + * get absorbed into the section. + * The adding of the section to free-space will call H5MF_aggr_absorb(), + * which will absorb meta_aggr to the section: + * section size + remaining size of aggregator is > aggr->alloc_size, + * section is allowed to absorb an aggregator (allow_sect_absorb is true) + * + * Test 2: To absorb the aggregator onto the end of the section + * Allocate block A from meta_aggr + * Allocate block B from sdata_aggr + * Create a free-space section node with an address that adjoins + * the beginning of meta_aggr and a size to make the + * aggregator get absorbed into the section. + * The adding of the section to free-space will call H5MF_aggr_absorb(), + * which will absorb meta_aggr to the section: + * section size + remaining size of aggregator is > aggr->alloc_size, + * section is allowed to absorb an aggregator (allow_sect_absorb is true) *------------------------------------------------------------------------- */ static unsigned @@ -1960,7 +1960,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) haddr_t ma_addr=HADDR_UNDEF; hsize_t ma_size=0; H5MF_free_section_t *sect_node=NULL; - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("A free-space section absorbs an aggregator: test 1"); @@ -2026,8 +2026,8 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("A free-space section absorbs an aggregator: test 2"); @@ -2069,7 +2069,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) if(H5MF__find_sect(f, H5FD_MEM_SUPER, (hsize_t)(ma_size+TBLOCK_SIZE30), f->shared->fs_man[H5FD_MEM_SUPER], &tmp) != TRUE) TEST_ERROR - if((tmp + TBLOCK_SIZE30) != ma_addr) + if((tmp + TBLOCK_SIZE30) != ma_addr) TEST_ERROR /* restore info to meta_aggr */ @@ -2087,15 +2087,15 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_absorb() */ @@ -2104,32 +2104,32 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * The first block of 30 is allocated from meta_aggr - * There is space of 2018 left in meta_aggr - * - * Allocate second block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr - * Result: - * The second block of 50 is allocated from meta_aggr - * There is space of 1968 left in meta_aggr + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * The first block of 30 is allocated from meta_aggr + * There is space of 2018 left in meta_aggr + * + * Allocate second block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr + * Result: + * The second block of 50 is allocated from meta_aggr + * There is space of 1968 left in meta_aggr *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ hid_t fcpl; /* File creation property list */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr1, addr2; - haddr_t ma_addr=HADDR_UNDEF; - hsize_t ma_size=0; + H5FD_mem_t type; + haddr_t addr1, addr2; + haddr_t ma_addr=HADDR_UNDEF; + hsize_t ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 1"); @@ -2229,15 +2229,15 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); } H5E_END_TRY; return(1); @@ -2247,38 +2247,38 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation - * There is space of 2018 left in meta_aggr - * - * Allocate second block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr - * Result: - * The second block of 50 is allocated from what is left in meta_aggr - * There is space of 1968 left in meta_aggr - * - * Allocate third block (2058) from meta_aggr: - * request-size is > what is left in meta_aggr and is >= meta_aggr->alloc_size - * meta_aggr is at EOA - * Result: - * A block of request-size is extended via file allocation and is merged with meta_aggr - * The block of 2058 is allocated out of meta_aggr - * There is space of 1968 left in meta_aggr + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation + * There is space of 2018 left in meta_aggr + * + * Allocate second block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr + * Result: + * The second block of 50 is allocated from what is left in meta_aggr + * There is space of 1968 left in meta_aggr + * + * Allocate third block (2058) from meta_aggr: + * request-size is > what is left in meta_aggr and is >= meta_aggr->alloc_size + * meta_aggr is at EOA + * Result: + * A block of request-size is extended via file allocation and is merged with meta_aggr + * The block of 2058 is allocated out of meta_aggr + * There is space of 1968 left in meta_aggr *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr1, addr2, addr3; - haddr_t ma_addr=HADDR_UNDEF; - hsize_t ma_size=0; + H5FD_mem_t type; + haddr_t addr1, addr2, addr3; + haddr_t ma_addr=HADDR_UNDEF; + hsize_t ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 2"); @@ -2371,15 +2371,15 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc2() */ @@ -2388,53 +2388,53 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr : (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from there - * There is space of 2018 left in meta_aggr - * - * Allocate second block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr - * Result: - * The second block of 50 is allocated from what is left in meta_aggr - * There is space of 1968 left in meta_aggr - * - * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) - * request-size is > what is left in other_aggr and is < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from there - * There is space of 2018 left in sdata_aggr - * - * Allocate the third block (2058) from meta_aggr: - * request-size is > what is left in meta_aggr and >= meta_aggr->alloc_size - * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size - * Result: A block of request-size is obtained via file allocation - * The new block's address is returned - * Nothing is changed in meta_aggr and sdata_aggr - * - * Allocate fourth block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * The fourth block of 50 is allocated from what is left in meta_aggr - * There is space of 1968 left in meta_aggr + * Allocate first block (30) from meta_aggr : (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from there + * There is space of 2018 left in meta_aggr + * + * Allocate second block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr + * Result: + * The second block of 50 is allocated from what is left in meta_aggr + * There is space of 1968 left in meta_aggr + * + * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) + * request-size is > what is left in other_aggr and is < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from there + * There is space of 2018 left in sdata_aggr + * + * Allocate the third block (2058) from meta_aggr: + * request-size is > what is left in meta_aggr and >= meta_aggr->alloc_size + * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size + * Result: A block of request-size is obtained via file allocation + * The new block's address is returned + * Nothing is changed in meta_aggr and sdata_aggr + * + * Allocate fourth block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * The fourth block of 50 is allocated from what is left in meta_aggr + * There is space of 1968 left in meta_aggr *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3, addr4, saddr1; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0; - haddr_t sdata_addr=HADDR_UNDEF; - hsize_t sdata_size=0; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, addr4, saddr1; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0; + haddr_t sdata_addr=HADDR_UNDEF; + hsize_t sdata_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator: test 3"); @@ -2531,15 +2531,15 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc3() */ @@ -2549,55 +2549,55 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation - * There is space of 2018 left in meta_aggr - * The first block of 30 is allocated from there - * - * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) - * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from there - * - * Allocate the second block (2018) from sdata_aggr: - * request-size is <= what is left in sdata_aggr and < sdata_aggr->alloc_size - * request-size is < sdata_aggr->alloc_size - * Result: - * The block is allocated from what is left in sdata_aggr (all used up) - * - * Allocate third block (50) from sdata_aggr : - * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is extended via file allocation - * The third block of 50 is allocated from there - * There is space of 1998 left in the sdata_aggr - * - * Allocate second block (2058) from meta_aggr: - * request-size is > what is left in meta_aggr and >= meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * unused spaced in sdata_aggr is freed to free-space and is shrunk - * sdata_aggr is reset to 0 - * A block of request-size is obtained via file allocation - * The new block's address is returned - * The block does not adjoin meta_aggr - * meta_aggr's info is unchanged + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation + * There is space of 2018 left in meta_aggr + * The first block of 30 is allocated from there + * + * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) + * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from there + * + * Allocate the second block (2018) from sdata_aggr: + * request-size is <= what is left in sdata_aggr and < sdata_aggr->alloc_size + * request-size is < sdata_aggr->alloc_size + * Result: + * The block is allocated from what is left in sdata_aggr (all used up) + * + * Allocate third block (50) from sdata_aggr : + * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is extended via file allocation + * The third block of 50 is allocated from there + * There is space of 1998 left in the sdata_aggr + * + * Allocate second block (2058) from meta_aggr: + * request-size is > what is left in meta_aggr and >= meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * unused spaced in sdata_aggr is freed to free-space and is shrunk + * sdata_aggr is reset to 0 + * A block of request-size is obtained via file allocation + * The new block's address is returned + * The block does not adjoin meta_aggr + * meta_aggr's info is unchanged *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* File size */ - H5FD_mem_t type, stype; - haddr_t addr1, addr2, saddr1, saddr2, saddr3; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0, sdata_size=0; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, saddr1, saddr2, saddr3; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0, sdata_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 4"); @@ -2698,15 +2698,15 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc4() */ @@ -2715,37 +2715,37 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocate from there + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocate from there * - * Allocate second block (50) from meta_aggr: - * request-size is < what is left in meta_aggr - * Result: - * The second block of 50 is allocated from what is left there - * There is space of 1968 left in the meta_aggr + * Allocate second block (50) from meta_aggr: + * request-size is < what is left in meta_aggr + * Result: + * The second block of 50 is allocated from what is left there + * There is space of 1968 left in the meta_aggr * - * Allocate third block (1970) from meta_aggr: - * request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size - * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the meta_aggr - * The block of 1970 is allocated from there - * There is space of 2046 left in meta_aggr + * Allocate third block (1970) from meta_aggr: + * request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size + * Result: A block of meta_aggr->alloc_size is extended via file allocation and is absorbed into the meta_aggr + * The block of 1970 is allocated from there + * There is space of 2046 left in meta_aggr * *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* File size */ - H5FD_mem_t type; - haddr_t addr1, addr2, addr3; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0; + H5FD_mem_t type; + haddr_t addr1, addr2, addr3; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_alloc() of meta/sdata aggregator:test 5"); @@ -2821,15 +2821,15 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc5() */ @@ -2838,47 +2838,47 @@ error: *------------------------------------------------------------------------- * To verify that blocks are allocated from the aggregator * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from there - * - * Allocate second block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr - * Result: - * The second block of 50 is allocated from what is left in meta_aggr - * There is space of 1968 left in meta_aggr - * - * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) - * request-size is > what is left in sdata_aggr and is < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from there - * There is space of 2018 left in sdata_aggr - * - * Allocate third block (1970) from meta_aggr: - * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size - * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is obtained via file allocation. - * The block does not adjoin meta_aggr - * sdata_aggr is untouched - * meta_aggr's unused space of [880, 1968] is freed to free-space - * meta_aggr is updated to point to the new block + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from there + * + * Allocate second block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr + * Result: + * The second block of 50 is allocated from what is left in meta_aggr + * There is space of 1968 left in meta_aggr + * + * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) + * request-size is > what is left in sdata_aggr and is < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from there + * There is space of 2018 left in sdata_aggr + * + * Allocate third block (1970) from meta_aggr: + * request-size is > what is left in meta_aggr and < meta_aggr->alloc_size + * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is obtained via file allocation. + * The block does not adjoin meta_aggr + * sdata_aggr is untouched + * meta_aggr's unused space of [880, 1968] is freed to free-space + * meta_aggr is updated to point to the new block *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; /* file size */ - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3, saddr1; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0, sdata_size=0; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, saddr1; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0, sdata_size=0; H5FS_stat_t state; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -2977,15 +2977,15 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc6() */ @@ -3000,52 +3000,52 @@ error: * A block of meta_aggr->alloc_size is obtained via file allocation * The first block of 30 is allocated from there * - * Allocate second block (50) from meta_aggr: - * request-size is <= what is left in meta_aggr - * Result: - * The second block of 50 is allocated from what is left in the aggregator - * There is space of 1968 left in the meta_aggr - * - * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) - * request-size is > what is left in sdata_aggr->size and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocate from there - * - * Allocate second block (2018) from sdata_aggr: - * request-size is <= what is left in sdata_aggr and is < sdata_aggr->alloc_size - * Result: - * The second block of 2018 is allocated from what is left in sdata_aggr (all used up) - * - * Allocate third block (50) from sdata_aggr: - * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is extended via file allocation - * The third block of 50 is allocated from there - * - * Allocate third block (1970) from meta_aggr: - * request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * unused space in sdata_aggr is freed to free-space and is shrunk - * sdata_aggr is reset to 0 - * A block of meta_aggr->alloc_size is obtained via file allocation - * The block does not adjoin meta_aggr - * meta_aggr's unused space of [880, 1968] is freed to free-space - * meta_aggr is updated to point to the new block + * Allocate second block (50) from meta_aggr: + * request-size is <= what is left in meta_aggr + * Result: + * The second block of 50 is allocated from what is left in the aggregator + * There is space of 1968 left in the meta_aggr + * + * Allocate first block (30) from sdata_aggr: (nothing in sdata_aggr) + * request-size is > what is left in sdata_aggr->size and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocate from there + * + * Allocate second block (2018) from sdata_aggr: + * request-size is <= what is left in sdata_aggr and is < sdata_aggr->alloc_size + * Result: + * The second block of 2018 is allocated from what is left in sdata_aggr (all used up) + * + * Allocate third block (50) from sdata_aggr: + * request-size is > what is left in sdata_aggr and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is extended via file allocation + * The third block of 50 is allocated from there + * + * Allocate third block (1970) from meta_aggr: + * request-size is > what is left in meta_aggr and is < meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * unused space in sdata_aggr is freed to free-space and is shrunk + * sdata_aggr is reset to 0 + * A block of meta_aggr->alloc_size is obtained via file allocation + * The block does not adjoin meta_aggr + * meta_aggr's unused space of [880, 1968] is freed to free-space + * meta_aggr is updated to point to the new block *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t empty_size, file_size; - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3; - haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, sdata_size=0; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, saddr1, saddr2, saddr3; + haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, sdata_size=0; H5FS_stat_t state; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -3161,15 +3161,15 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc7() */ @@ -3178,38 +3178,38 @@ error: *------------------------------------------------------------------------- * To verify that a block can be extended from the aggregator * - * Test 1: Allocate block A from meta_aggr which is at end of file - * Try to extend the block which adjoins the aggregator that is at end of file - * a. block size < (% * aggr->alloc_size) - * The block is allocated from the aggregator - * b. block size > (% * aggr->alloc_size) but block size < aggr->alloc_size - * The block is extended by aggr->alloc_size and the block is allocated from the aggregator - * c. block size > (% * aggr->alloc_size) but block size > aggr->alloc_size - * The block is extended by extended-request and the block is allocated from the aggregator - * - * Test 2: Allocate block A from meta_aggr - * Allocate block B from sdata_aggr so that meta_aggr is not at end of file - * Try to extend a block which adjoins meta_aggr and meta_aggr can fulfill the extended-request - * H5MF_try_extend() succeeds: the block is extended into the aggregator - * - * Test 3: Allocate block A from meta_aggr - * Allocate block B from sdata_aggr so that meta_aggr is not at end of file - * Try to extend a block which adjoins meta_aggr but meta_aggr cannot fulfill the extended-request - * H5MF_try_extend() fails + * Test 1: Allocate block A from meta_aggr which is at end of file + * Try to extend the block which adjoins the aggregator that is at end of file + * a. block size < (% * aggr->alloc_size) + * The block is allocated from the aggregator + * b. block size > (% * aggr->alloc_size) but block size < aggr->alloc_size + * The block is extended by aggr->alloc_size and the block is allocated from the aggregator + * c. block size > (% * aggr->alloc_size) but block size > aggr->alloc_size + * The block is extended by extended-request and the block is allocated from the aggregator + * + * Test 2: Allocate block A from meta_aggr + * Allocate block B from sdata_aggr so that meta_aggr is not at end of file + * Try to extend a block which adjoins meta_aggr and meta_aggr can fulfill the extended-request + * H5MF_try_extend() succeeds: the block is extended into the aggregator + * + * Test 3: Allocate block A from meta_aggr + * Allocate block B from sdata_aggr so that meta_aggr is not at end of file + * Try to extend a block which adjoins meta_aggr but meta_aggr cannot fulfill the extended-request + * H5MF_try_extend() fails *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t empty_size = 0, file_size; - H5FD_mem_t type, stype; - haddr_t new_addr, addr, saddr; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0, sdata_size=0; - htri_t was_extended; + H5FD_mem_t type, stype; + haddr_t new_addr, addr, saddr; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0, sdata_size=0; + htri_t was_extended; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1"); @@ -3315,8 +3315,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 2"); @@ -3385,8 +3385,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 3"); @@ -3453,15 +3453,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_extend() */ @@ -3472,35 +3472,35 @@ error: * * MF_try_shrink() only allows blocks to be absorbed into an aggregator * - * Test 1: H5MF_alloc() block A from meta_aggr - * H5MF_try_shrink() block A should merge it back into meta_aggr - * since block A adjoins the beginning of meta_aggr + * Test 1: H5MF_alloc() block A from meta_aggr + * H5MF_try_shrink() block A should merge it back into meta_aggr + * since block A adjoins the beginning of meta_aggr * - * Test 2: H5MF_alloc() block A from meta_aggr - * H5MF_alloc() block B from sdata_aggr - * H5MF_try_shrink() block B should merge it back to the end of sdata_aggr - * because sec2 driver is FLMAP_DICHOTOMY by default + * Test 2: H5MF_alloc() block A from meta_aggr + * H5MF_alloc() block B from sdata_aggr + * H5MF_try_shrink() block B should merge it back to the end of sdata_aggr + * because sec2 driver is FLMAP_DICHOTOMY by default * - * Test 3: H5MF_alloc() block A from meta_aggr - * H5MF_alloc() block B from meta_aggr - * H5MF_alloc() block C from meta_aggr - * H5MF_try_shrink() block B should fail since it does not adjoin the - * beginning nor the end of meta_aggr + * Test 3: H5MF_alloc() block A from meta_aggr + * H5MF_alloc() block B from meta_aggr + * H5MF_alloc() block C from meta_aggr + * H5MF_try_shrink() block B should fail since it does not adjoin the + * beginning nor the end of meta_aggr *------------------------------------------------------------------------- */ static unsigned test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t empty_size = 0, file_size; - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3, saddr1; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - haddr_t new_sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0; - hsize_t sdata_size=0, new_sdata_size=0; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, saddr1; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + haddr_t new_sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0; + hsize_t sdata_size=0, new_sdata_size=0; hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 1"); @@ -3562,8 +3562,8 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 2"); @@ -3621,8 +3621,8 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 3"); @@ -3683,15 +3683,15 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + puts(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_absorb() */ @@ -3703,46 +3703,46 @@ error: * Alignment = 1024 or 4096 * * Test 1: - * Turn off using metadata aggregator - * Allocate a block of 30 which should be from file allocation - * Result: - * The return address should be aligned - * A fragment [800, 224] or [800, 3296] is freed to free-space - * EOA is 1054 or 4126 - * - * Allocate a block of 50 which should be from file allocation - * Result: - * The return address should be aligned - * A fragment [1054, 994] or [4126, 4066] is freed to free-space - * EOA is 2098 or 8242 + * Turn off using metadata aggregator + * Allocate a block of 30 which should be from file allocation + * Result: + * The return address should be aligned + * A fragment [800, 224] or [800, 3296] is freed to free-space + * EOA is 1054 or 4126 + * + * Allocate a block of 50 which should be from file allocation + * Result: + * The return address should be aligned + * A fragment [1054, 994] or [4126, 4066] is freed to free-space + * EOA is 2098 or 8242 * Test 2: - * Turn off using metadata aggregator - * Allocate a block which should be from file allocation - * The return address should be aligned - * H5MF_try_shrink() the block with aligned address should succeed + * Turn off using metadata aggregator + * Allocate a block which should be from file allocation + * The return address should be aligned + * H5MF_try_shrink() the block with aligned address should succeed * * Test 3: - * Turn off using metadata aggregator - * Allocate a block which should be from file allocation - * The return address should be aligned - * H5MF_try_extend() the block with aligned address should succeed + * Turn off using metadata aggregator + * Allocate a block which should be from file allocation + * The return address should be aligned + * H5MF_try_extend() the block with aligned address should succeed *------------------------------------------------------------------------- */ static unsigned test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - hid_t fapl1 = -1; - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + hid_t fapl1 = -1; + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size, new_file_size; - H5FD_mem_t type; - haddr_t addr1, addr2; - haddr_t ma_addr=HADDR_UNDEF; - hsize_t ma_size=0; - htri_t was_extended; + H5FD_mem_t type; + haddr_t addr1, addr2; + haddr_t ma_addr=HADDR_UNDEF; + hsize_t ma_size=0; + htri_t was_extended; H5FS_stat_t state; - hsize_t alignment=0, mis_align=0, tmp=0, accum=0; + hsize_t alignment=0, mis_align=0, tmp=0, accum=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MM_alloc() of file allocation with alignment: test 1"); @@ -3850,8 +3850,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation with alignment: test 2"); @@ -3905,8 +3905,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ TESTING("H5MF_try_extend() of file allocation with alignment: test 3"); @@ -3961,15 +3961,15 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_eoa() */ @@ -3981,43 +3981,43 @@ error: * Alignment = 1024 or 4096 * * Test 1: - * Add section A with an aligned address to free-space manager (addr=alignment, size=50) - * Allocate a block of size=50 - * The returned space's address should be same as section A's address + * Add section A with an aligned address to free-space manager (addr=alignment, size=50) + * Allocate a block of size=50 + * The returned space's address should be same as section A's address * * Test 2: - * Add section A to free-space manager (addr=70, size=8000): - * section A is mis-aligned but the size is big enough for allocation with alignment - * Allocate a block of size=600 - * The returned space should be allocated from section A with an aligned address: - * address=alignment size=600 - * There will be 2 sections in free-space: (alignment = 1024 or alignment = 4096) - * the fragment left from aligning section A: [70, 954] or [70, 4026] - * the section left after allocating block A: [1624, 416] or [4696, 3374] - * H5MF_try_extend() the block of size 600 by 200 should succeed: - * the existing fragment left from aligning section A: [70, 954] or [70, 4026] - * the section left after extending block A: [1824, 216] or [4896, 3174] + * Add section A to free-space manager (addr=70, size=8000): + * section A is mis-aligned but the size is big enough for allocation with alignment + * Allocate a block of size=600 + * The returned space should be allocated from section A with an aligned address: + * address=alignment size=600 + * There will be 2 sections in free-space: (alignment = 1024 or alignment = 4096) + * the fragment left from aligning section A: [70, 954] or [70, 4026] + * the section left after allocating block A: [1624, 416] or [4696, 3374] + * H5MF_try_extend() the block of size 600 by 200 should succeed: + * the existing fragment left from aligning section A: [70, 954] or [70, 4026] + * the section left after extending block A: [1824, 216] or [4896, 3174] * * Test 3: - * Add section A to free-space manager (addr=70, size=700): - * section A is mis-aligned but the size is not big enough for allocation with alignment - * Allocate a block of size=40 - * The free-space manager is unable to fulfill the request - * The block is allocated from file allocation and should be aligned + * Add section A to free-space manager (addr=70, size=700): + * section A is mis-aligned but the size is not big enough for allocation with alignment + * Allocate a block of size=40 + * The free-space manager is unable to fulfill the request + * The block is allocated from file allocation and should be aligned *------------------------------------------------------------------------- */ static unsigned test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ h5_stat_size_t file_size; - H5F_t *f = NULL; /* Internal file object pointer */ + H5F_t *f = NULL; /* Internal file object pointer */ H5MF_free_section_t *sect_node = NULL; - haddr_t addr; + haddr_t addr; H5FS_stat_t state; htri_t was_extended; - hsize_t alignment=0, tmp=0, mis_align=0; + hsize_t alignment=0, tmp=0, mis_align=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of free-space manager with alignment: test 1"); @@ -4248,15 +4248,15 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_fs() */ @@ -4265,114 +4265,114 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 1024 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (nothing in the aggregator) - * request-size > aggr->size and < aggr->alloc_size - * Result: - * An "aggr->alloc_size" block is allocated from file allocation for the aggregator - * EOA is 3072 - * The first block of 30 is allocated from the aggregator and should be aligned - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * There is space of 2018 left in meta_aggr - * - * Allocate second block (50) from meta_aggr: - * (request-size + fragment size) <= aggr->size - * Result: - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] - * There is space of 974 left in meta_aggr - * - * Allocate third block (80) from meta_aggr: - * (request-size + fragment size) > aggr->size - * request-size < meta_aggr->alloc_size - * fragment size < (meta_aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of "meta_aggr->alloc_size" is extended from file allocation for meta_aggr - * EOA is 5120 - * The third block of 80 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[2098, 974] - * There is space of 1968 left in meta_aggr - * - * Allocate fourth block (1970) from meta_aggr: - * (request-size + fragment size) is <= aggr->size - * fragment size > (aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of aggr->alloc_size + fragment size - (aggr->alloc_size - request-size)) - * is extended from file allocation for meta_aggr - * The third block of 1970 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[3152, 944] - * There is space of 1968 left in meta_aggr - * EOA is at 8034 - * - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (aggregator is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator - * The first block of 30 is allocated from the aggregator and should be aligned - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * There is space of 2018 left in meta_aggr - * EOA is at 6144 - * - * Allocate second block (50) from meta_aggr: - * (request-size + fragment size) is > meta_aggr->size - * request-size < meta_aggr->alloc_size - * fragment size > (meta_aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] - * There is space of 2018 left in meta_aggr - * EOA is at 10260 - * - * Allocate third block (80) from meta_aggr: - * (request-size + fragment size) is > meta_aggr->size - * request-size < meta_aggr->alloc_size - * fragment size > (meta_aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator - * The third block of 80 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[8242, 4046] - * There is space of 2018 left in meta_aggr - * EOA is at 14386 - * - * Allocate fourth block (1970) from meta_aggr: - * (request-size + fragment size) > meta_aggr->size - * request-size < meta_aggr->alloc_size - * fragment size > (meta_aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator - * The fourth block of 1970 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[12368, 4016] - * There is space of 2018 left in meta_aggr - * EOA is at 20372 + * Alignment = 1024 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (nothing in the aggregator) + * request-size > aggr->size and < aggr->alloc_size + * Result: + * An "aggr->alloc_size" block is allocated from file allocation for the aggregator + * EOA is 3072 + * The first block of 30 is allocated from the aggregator and should be aligned + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * There is space of 2018 left in meta_aggr + * + * Allocate second block (50) from meta_aggr: + * (request-size + fragment size) <= aggr->size + * Result: + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] + * There is space of 974 left in meta_aggr + * + * Allocate third block (80) from meta_aggr: + * (request-size + fragment size) > aggr->size + * request-size < meta_aggr->alloc_size + * fragment size < (meta_aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of "meta_aggr->alloc_size" is extended from file allocation for meta_aggr + * EOA is 5120 + * The third block of 80 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[2098, 974] + * There is space of 1968 left in meta_aggr + * + * Allocate fourth block (1970) from meta_aggr: + * (request-size + fragment size) is <= aggr->size + * fragment size > (aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of aggr->alloc_size + fragment size - (aggr->alloc_size - request-size)) + * is extended from file allocation for meta_aggr + * The third block of 1970 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[3152, 944] + * There is space of 1968 left in meta_aggr + * EOA is at 8034 + * + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (aggregator is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator + * The first block of 30 is allocated from the aggregator and should be aligned + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * There is space of 2018 left in meta_aggr + * EOA is at 6144 + * + * Allocate second block (50) from meta_aggr: + * (request-size + fragment size) is > meta_aggr->size + * request-size < meta_aggr->alloc_size + * fragment size > (meta_aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) + * is extended from file allocation for the aggregator + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] + * There is space of 2018 left in meta_aggr + * EOA is at 10260 + * + * Allocate third block (80) from meta_aggr: + * (request-size + fragment size) is > meta_aggr->size + * request-size < meta_aggr->alloc_size + * fragment size > (meta_aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) + * is extended from file allocation for the aggregator + * The third block of 80 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[8242, 4046] + * There is space of 2018 left in meta_aggr + * EOA is at 14386 + * + * Allocate fourth block (1970) from meta_aggr: + * (request-size + fragment size) > meta_aggr->size + * request-size < meta_aggr->alloc_size + * fragment size > (meta_aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of meta_aggr->alloc_size + (fragment size - (meta_aggr->alloc_size - request-size)) + * is extended from file allocation for the aggregator + * The fourth block of 1970 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[12368, 4016] + * There is space of 2018 left in meta_aggr + * EOA is at 20372 *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; /* File size */ - H5FD_mem_t type; - haddr_t addr1, addr2, addr3, addr4; + H5FD_mem_t type; + haddr_t addr1, addr2, addr3, addr4; H5FS_stat_t state; - haddr_t ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, mis_align=0; - hsize_t alignment=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, mis_align=0; + hsize_t alignment=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ @@ -4518,15 +4518,15 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc1() */ @@ -4535,101 +4535,101 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 1024 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator - * The first block of 30 is allocated from the aggregator and should be aligned - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * There is space of 2018 left in meta_aggr - * EOA is 3072 - * - * Allocate second block (50) from meta_aggr: - * (request-size+fragment size) <= aggr->size - * Result: - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] - * There is space of 974 left in meta_aggr - * - * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) - * request-size is > sdata_aggr->size and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is obtained via file allocation - * The first block of 30 is allocated from sdata_aggr and should be aligned - * EOA is 5120 - * - * Allocate third block (80) from meta_aggr: - * request-size+fragment size is > meta_aggr->size - * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * The unused space in meta_aggr is freed to free-space [2098, 974] - * meta_aggr is updated to point to the new block - * The third block of 80 is allocated from meta_aggr and should be aligned - * EOA is 7168 - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > aggr->size and < aggr->alloc_size - * Result: - * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator - * The first block of 30 is allocated from the aggregator and should be aligned - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * There is space of 2018 left meta_aggr - * EOA is at 6144 - * - * Allocate second block (50) from meta_aggr: - * (request-size + fragment size) > aggr->size - * request-size < aggr->alloc_size - * fragment size > (aggr->alloc_size - request-size) - * Result: - * A block of (fragment size + request-size) is extended from file allocation for the aggregator - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] - * There is space of 2018 left in meta_aggr - * EOA is at 10260 - * - * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) - * request-size is > sdata_aggr->size and < sdata_aggr->alloc_size - * meta_aggr is at EOA and has used up more than meta_aggr->alloc_size - * Result: - * The remaining space in meta_aggr is freed to free-space [8242, 2018] and shrunk since at EOF - * meta_aggr is reset to 0 - * A block of sdata_aggr->alloc_size is obtained via file allocation - * Fragment from alignment of file allocation is freed to free-space: [8242, 4046] - * The first block of 30 is allocated from sdata_aggr and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 14336 - * - * Allocate third block (80) from meta_aggr: - * (request-size + fragment size) is > meta_aggr->size - * request-size < meta_aggr->alloc_size - * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator - * Fragment from alignment of file allocation is freed to free-space:[14336, 2048] - * other_aggr is [12318, 2018] - * The third block of 80 is allocated from the aggregator and should be aligned - * There is space of 1968 left in meta_aggr - * EOA is at 18432 + * Alignment = 1024 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator + * The first block of 30 is allocated from the aggregator and should be aligned + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * There is space of 2018 left in meta_aggr + * EOA is 3072 + * + * Allocate second block (50) from meta_aggr: + * (request-size+fragment size) <= aggr->size + * Result: + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] + * There is space of 974 left in meta_aggr + * + * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) + * request-size is > sdata_aggr->size and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is obtained via file allocation + * The first block of 30 is allocated from sdata_aggr and should be aligned + * EOA is 5120 + * + * Allocate third block (80) from meta_aggr: + * request-size+fragment size is > meta_aggr->size + * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * The unused space in meta_aggr is freed to free-space [2098, 974] + * meta_aggr is updated to point to the new block + * The third block of 80 is allocated from meta_aggr and should be aligned + * EOA is 7168 + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > aggr->size and < aggr->alloc_size + * Result: + * A meta_aggr->alloc_size block is allocated from file allocation for the aggregator + * The first block of 30 is allocated from the aggregator and should be aligned + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * There is space of 2018 left meta_aggr + * EOA is at 6144 + * + * Allocate second block (50) from meta_aggr: + * (request-size + fragment size) > aggr->size + * request-size < aggr->alloc_size + * fragment size > (aggr->alloc_size - request-size) + * Result: + * A block of (fragment size + request-size) is extended from file allocation for the aggregator + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] + * There is space of 2018 left in meta_aggr + * EOA is at 10260 + * + * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) + * request-size is > sdata_aggr->size and < sdata_aggr->alloc_size + * meta_aggr is at EOA and has used up more than meta_aggr->alloc_size + * Result: + * The remaining space in meta_aggr is freed to free-space [8242, 2018] and shrunk since at EOF + * meta_aggr is reset to 0 + * A block of sdata_aggr->alloc_size is obtained via file allocation + * Fragment from alignment of file allocation is freed to free-space: [8242, 4046] + * The first block of 30 is allocated from sdata_aggr and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 14336 + * + * Allocate third block (80) from meta_aggr: + * (request-size + fragment size) is > meta_aggr->size + * request-size < meta_aggr->alloc_size + * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator + * Fragment from alignment of file allocation is freed to free-space:[14336, 2048] + * other_aggr is [12318, 2018] + * The third block of 80 is allocated from the aggregator and should be aligned + * There is space of 1968 left in meta_aggr + * EOA is at 18432 *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; /* File size */ - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3, saddr1; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3, saddr1; H5FS_stat_t state[H5FD_MEM_NTYPES]; - haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, sdata_size=0, mis_align=0; - hsize_t alignment=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, sdata_size=0, mis_align=0; + hsize_t alignment=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 2"); @@ -4718,11 +4718,11 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * * For alignment = 1024, alloc_size = 2048: * block 30 is allocated from (ma_addr + ma_size), - * which is already aligned + * which is already aligned * * For alignment = 4096, alloc_size = 2048: - * since remaining space in meta_aggr is freed and shrunk, - * block 30 is allocated from ma_addr + * since remaining space in meta_aggr is freed and shrunk, + * block 30 is allocated from ma_addr */ mis_align = 0; if((alignment == TEST_ALIGN1024) && (tmp = ((ma_addr + ma_size) % alignment))) @@ -4753,10 +4753,10 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * Calculate fragment for the allocation of block 80 from meta_aggr: * * For alignment = 1024, alloc_size = 2048: - * fragment for unused space in meta_aggr is freed to free-space + * fragment for unused space in meta_aggr is freed to free-space * For alignment = 4096, alloc_size = 2048: - * fragment from alignment of ma_addr is freed - * block 30 is allocated from ma_addr + * fragment from alignment of ma_addr is freed + * block 30 is allocated from ma_addr */ mis_align = 0; if((alignment == TEST_ALIGN1024) && (tmp = (ma_addr % alignment))) @@ -4783,15 +4783,15 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all the allocations */ - if(f->shared->fs_man[type]) { - if(check_stats(f, f->shared->fs_man[type], &(state[type]))) - TEST_ERROR - } + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } - if(f->shared->fs_man[stype]) { - if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) - TEST_ERROR - } + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE30); H5MF_xfree(f, type, addr2, (hsize_t)TBLOCK_SIZE50); @@ -4804,15 +4804,15 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc2() */ @@ -4821,153 +4821,153 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 1024 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 3072 - * - * Allocate second block (50) from meta_aggr: - * (request-size+fragment size) is <= aggr->size - * Result: - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] - * There is space of 974 left in the aggregator - * - * Allocate first block (30) from other_aggr: (nothing in other_aggr) - * request-size is > what is left in other_aggr->size and < other_aggr->alloc_size - * Result: - * A "other_aggr->alloc_size" block is allocated from file allocation for other_aggr - * The first block of 30 is allocated from other_aggr and should be aligned - * There is space of 2018 left in other_aggr->size - * EOA is 5120 - * - * Allocate second block (50) from sdata_aggr: - * (request-size+fragment size) < sdata_aggr->size - * Result: - * The second block of 50 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[3102, 994] - * There is space of 974 left in sdata_aggr - * - * Allocate third block (80) from sdata_aggr: - * (request-size+fragment size) is >= sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * sdata_aggr is at EOA - * Result: - * Another block of sdata_aggr->alloc_size is extended from file allocation for sdata_aggr - * The third block of 80 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[4146, 974] - * There is space of 1968 left in sdata_aggr - * EOA is 7168 - * - * Allocate third block (1034) from meta_aggregator: - * (request-size + alignment) > meta_aggr->size but < meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * The unused space in sdata_aggr is freed to free-space [5200, 1968] then shrunk - * sdata_aggr is reset to 0 - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space [5200, 944] - * The unused space in meta_aggr is freed to free-space [2098, 974] - * The meta_aggr is updated to point to the new space - * The block of 1034 is allocated from the new block and should be aligned - * There is space of 1014 left in meta_aggr - * EOA is 8192 - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > what is left in aggr->size and < aggr->alloc_size - * Result: - * A meta_aggr->alloc block is allocated from file allocation for the aggregator - * The first block of 30 is allocated from the aggregator and should be aligned - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * There is space of 2018 left in meta_aggr - * EOA is at 6144 - * - * Allocate second block (50) from meta_aggr: - * (request-size + fragment size) is > what is left in aggr->size - * request-size < aggr->alloc_size - * fragment size > (aggr->alloc_size - request-size) - * Result: - * A block of aggr->alloc_size + (fragment size - (aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator - * The second block of 50 is allocated from the aggregator and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] - * There is space of 2018 left in meta_aggr - * EOA is at 10260 - * - * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) - * request-size > sdata_aggr->size and < sdata_aggr->alloc_size - * meta_aggr is at EOA and has used up more than meta_aggr->alloc_size - * Result: - * The remaining space in meta_aggr is freed to free-space [8242, 2018] and shrunk - * since at EOF - * meta_aggr is reset to 0 - * A block of sdata_aggr->alloc_size is obtained via file allocation - * Fragment from alignment of file allocation is freed to free-space: [8242, 4046] - * The first block of 30 is allocated from sdata_aggr and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 14336 - * - * Allocate second block (50) from sdata_aggr: - * request-size is > sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * fragment size > (sdata_aggr->alloc_size - request-size) - * Result: - * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size)) - * is extended from file allocation for the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[12318, 4066] - * The second block of 50 is allocated from the aggregator and should be aligned - * There is space of 2018 left in the sdata_aggr - * EOA is at 18452 - * - * Allocate third block (80) from sdata_aggr: - * request-size + fragment size is > sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * fragment size > (sdata_aggr->alloc_size - request-size) - * Result: - * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size) - * is allocated from file allocation for the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[16434, 4046] - * The third block of 80 is allocated from the aggregator and should be aligned - * There is space of 2018 left in the sdata_aggr - * EOA is at 22578 - * - * Allocate third block (1034) from meta_aggregator: - * (request-size + fragment size) is > meta_aggr->size but request-size < meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * The remaining space in sdata_aggr is freed to free-space [20560, 2018] then shrunk - * sdata_aggr is reset to 0 - * There is nothing in meta_aggr - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space [20560, 4016] - * EOA is 26624 - * The meta_aggr is updated to point to the new space - * The block of 1034 is allocated from the new block and should be aligned - * There is space of 1014 left in meta_aggr + * Alignment = 1024 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation for the aggregator + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 3072 + * + * Allocate second block (50) from meta_aggr: + * (request-size+fragment size) is <= aggr->size + * Result: + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] + * There is space of 974 left in the aggregator + * + * Allocate first block (30) from other_aggr: (nothing in other_aggr) + * request-size is > what is left in other_aggr->size and < other_aggr->alloc_size + * Result: + * A "other_aggr->alloc_size" block is allocated from file allocation for other_aggr + * The first block of 30 is allocated from other_aggr and should be aligned + * There is space of 2018 left in other_aggr->size + * EOA is 5120 + * + * Allocate second block (50) from sdata_aggr: + * (request-size+fragment size) < sdata_aggr->size + * Result: + * The second block of 50 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[3102, 994] + * There is space of 974 left in sdata_aggr + * + * Allocate third block (80) from sdata_aggr: + * (request-size+fragment size) is >= sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * sdata_aggr is at EOA + * Result: + * Another block of sdata_aggr->alloc_size is extended from file allocation for sdata_aggr + * The third block of 80 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[4146, 974] + * There is space of 1968 left in sdata_aggr + * EOA is 7168 + * + * Allocate third block (1034) from meta_aggregator: + * (request-size + alignment) > meta_aggr->size but < meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * The unused space in sdata_aggr is freed to free-space [5200, 1968] then shrunk + * sdata_aggr is reset to 0 + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space [5200, 944] + * The unused space in meta_aggr is freed to free-space [2098, 974] + * The meta_aggr is updated to point to the new space + * The block of 1034 is allocated from the new block and should be aligned + * There is space of 1014 left in meta_aggr + * EOA is 8192 + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > what is left in aggr->size and < aggr->alloc_size + * Result: + * A meta_aggr->alloc block is allocated from file allocation for the aggregator + * The first block of 30 is allocated from the aggregator and should be aligned + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * There is space of 2018 left in meta_aggr + * EOA is at 6144 + * + * Allocate second block (50) from meta_aggr: + * (request-size + fragment size) is > what is left in aggr->size + * request-size < aggr->alloc_size + * fragment size > (aggr->alloc_size - request-size) + * Result: + * A block of aggr->alloc_size + (fragment size - (aggr->alloc_size - request-size)) + * is extended from file allocation for the aggregator + * The second block of 50 is allocated from the aggregator and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] + * There is space of 2018 left in meta_aggr + * EOA is at 10260 + * + * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) + * request-size > sdata_aggr->size and < sdata_aggr->alloc_size + * meta_aggr is at EOA and has used up more than meta_aggr->alloc_size + * Result: + * The remaining space in meta_aggr is freed to free-space [8242, 2018] and shrunk + * since at EOF + * meta_aggr is reset to 0 + * A block of sdata_aggr->alloc_size is obtained via file allocation + * Fragment from alignment of file allocation is freed to free-space: [8242, 4046] + * The first block of 30 is allocated from sdata_aggr and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 14336 + * + * Allocate second block (50) from sdata_aggr: + * request-size is > sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * fragment size > (sdata_aggr->alloc_size - request-size) + * Result: + * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size)) + * is extended from file allocation for the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[12318, 4066] + * The second block of 50 is allocated from the aggregator and should be aligned + * There is space of 2018 left in the sdata_aggr + * EOA is at 18452 + * + * Allocate third block (80) from sdata_aggr: + * request-size + fragment size is > sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * fragment size > (sdata_aggr->alloc_size - request-size) + * Result: + * A block of sdata_aggr->alloc_size + (fragment size - (sdata_aggr->alloc_size - request-size) + * is allocated from file allocation for the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[16434, 4046] + * The third block of 80 is allocated from the aggregator and should be aligned + * There is space of 2018 left in the sdata_aggr + * EOA is at 22578 + * + * Allocate third block (1034) from meta_aggregator: + * (request-size + fragment size) is > meta_aggr->size but request-size < meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * The remaining space in sdata_aggr is freed to free-space [20560, 2018] then shrunk + * sdata_aggr is reset to 0 + * There is nothing in meta_aggr + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space [20560, 4016] + * EOA is 26624 + * The meta_aggr is updated to point to the new space + * The block of 1034 is allocated from the new block and should be aligned + * There is space of 1014 left in meta_aggr *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; - H5FD_mem_t type, stype; - haddr_t addr1, addr2, addr3; - haddr_t saddr1, saddr2, saddr3; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, addr3; + haddr_t saddr1, saddr2, saddr3; H5FS_stat_t state[H5FD_MEM_NTYPES]; - haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, sdata_size=0, mis_align=0; - hsize_t alignment=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, sdata_size=0, mis_align=0; + hsize_t alignment=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ @@ -5164,15 +5164,15 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Verify total size of free space after all allocations */ - if(f->shared->fs_man[type]) { - if(check_stats(f, f->shared->fs_man[type], &(state[type]))) - TEST_ERROR - } + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } - if(f->shared->fs_man[stype]) { - if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) - TEST_ERROR - } + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -5180,15 +5180,15 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc3() */ @@ -5198,81 +5198,81 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * The first block of 30 is allocated from meta_aggr and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 3072 - * - * Allocate second block (2058) from meta_aggr: - * (request-size+fragment) is > meta_aggr->size and request-size is > meta_aggr->alloc_size - * meta_aggr is at EOA - * Result: - * The second block of 2058 + fragment is extended and merged together with meta_aggr - * The block of 2058 is allocated out of the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] - * There is space of 2018 (same as before) left in meta_aggr - * EOA is 6124 - * - * Allocate third block (5) from meta_aggr: - * request-size+fragment < meta_aggr->size - * Result: - * A block of 5 is allocated from the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[4106, 1014] - * There is space of 999 left in meta_aggr - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * The first block of 30 is allocated from meta_aggr and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 6144 - * - * Allocate second block (2058) from meta_aggr: - * (request-size+fragment) is > meta_aggr->size and request-size is > meta_aggr->alloc_size - * meta_aggr is at EOA - * Result: - * The second block of 2058 + fragment is extended and merged together with meta_aggr - * The block of 2058 is allocated out of the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] - * There is space of 2018 (same as before) left in meta_aggr - * EOA is 12268 - * - * Allocate third block (5) from meta_aggr: - * request-size+fragment is > meta_aggr->size - * request-size < meta_aggr->alloc_size - * fragment < (meta_aggr->alloc_size - request-size) - * meta_aggr is at EOA - * Result: - * A block of meta_aggr->alloc_size is extended from file allocation for the aggregator - * A block of 5 is allocated from the aggregator - * Fragment from alignment of aggregator allocation is freed to free-space:[10250, 2038] - * There is space of 2023 left in meta_aggr + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * The first block of 30 is allocated from meta_aggr and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 3072 + * + * Allocate second block (2058) from meta_aggr: + * (request-size+fragment) is > meta_aggr->size and request-size is > meta_aggr->alloc_size + * meta_aggr is at EOA + * Result: + * The second block of 2058 + fragment is extended and merged together with meta_aggr + * The block of 2058 is allocated out of the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[1054, 994] + * There is space of 2018 (same as before) left in meta_aggr + * EOA is 6124 + * + * Allocate third block (5) from meta_aggr: + * request-size+fragment < meta_aggr->size + * Result: + * A block of 5 is allocated from the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[4106, 1014] + * There is space of 999 left in meta_aggr + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * The first block of 30 is allocated from meta_aggr and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 6144 + * + * Allocate second block (2058) from meta_aggr: + * (request-size+fragment) is > meta_aggr->size and request-size is > meta_aggr->alloc_size + * meta_aggr is at EOA + * Result: + * The second block of 2058 + fragment is extended and merged together with meta_aggr + * The block of 2058 is allocated out of the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[4126, 4066] + * There is space of 2018 (same as before) left in meta_aggr + * EOA is 12268 + * + * Allocate third block (5) from meta_aggr: + * request-size+fragment is > meta_aggr->size + * request-size < meta_aggr->alloc_size + * fragment < (meta_aggr->alloc_size - request-size) + * meta_aggr is at EOA + * Result: + * A block of meta_aggr->alloc_size is extended from file allocation for the aggregator + * A block of 5 is allocated from the aggregator + * Fragment from alignment of aggregator allocation is freed to free-space:[10250, 2038] + * There is space of 2023 left in meta_aggr * *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; - H5FD_mem_t type; - haddr_t addr1, addr2, addr3; + H5FD_mem_t type; + haddr_t addr1, addr2, addr3; H5FS_stat_t state; - haddr_t ma_addr=HADDR_UNDEF; - hsize_t ma_size=0, saved_ma_size=0; - hsize_t alignment=0, mis_align=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF; + hsize_t ma_size=0, saved_ma_size=0; + hsize_t alignment=0, mis_align=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ @@ -5378,10 +5378,10 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if(addr3 % alignment) TEST_ERROR /* Verify total size of free space after all allocations */ - if(f->shared->fs_man[type]) { - if(check_stats(f, f->shared->fs_man[type], &state)) - TEST_ERROR - } + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &state)) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -5389,15 +5389,15 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc4() */ @@ -5406,84 +5406,84 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 1024 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * The first block of 30 is allocated from meta_aggr and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 3072 - * - * Allocate first block (30) from sdata_aggr: (nothing in the aggregator) - * A block of sdata_aggr->alloc_size is allocated from file allocation - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 5120 - * - * Allocate second block (2058) from meta_aggr: - * (request-size + fragment size) > meta_aggr->size and > meta_aggr->alloc_size - * sdata_aggr is at EOA but has not used up sdata_aggr->alloc_size - * Result: - * A block of 2058 is allocated from file allocation - * EOA is 7178 - * Nothing is changed in meta_aggr and sdata_aggr - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * The first block of 30 is allocated from meta_aggr and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 6144 - * - * Allocate first block (30) from sdata_aggr: (meta_aggr is empty) - * meta_aggr is at EOA but has not used up more than meta_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[6144, 2048] - * This fragment adjoins meta_aggr and fulfills "absorb" condition, - * the remaining space left in meta_aggr is absorbed into the fragment and - * freed to free-space: [4126, 2018] - * meta_aggr is reset to 0 - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 10240 - * - * Allocate second block (2058) from meta_aggr: - * request-size + fragment size is > meta_aggr->size - * request_size is > meta_aggr->alloc_size - * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size - * Result: - * A block of 2058 is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[10240, 2048] - * This fragment adjoins sdata_aggr and fulfills "absorb" condition, - * the remaining space left in sdata_aggr is absorbed into the fragment and - * freed to free-space: [8222, 2018] - * sdata_aggr is reset to 0 - * EOA is 14346 - * meta_aggr and sdata_aggr are all 0 + * Alignment = 1024 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * The first block of 30 is allocated from meta_aggr and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 3072 + * + * Allocate first block (30) from sdata_aggr: (nothing in the aggregator) + * A block of sdata_aggr->alloc_size is allocated from file allocation + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 5120 + * + * Allocate second block (2058) from meta_aggr: + * (request-size + fragment size) > meta_aggr->size and > meta_aggr->alloc_size + * sdata_aggr is at EOA but has not used up sdata_aggr->alloc_size + * Result: + * A block of 2058 is allocated from file allocation + * EOA is 7178 + * Nothing is changed in meta_aggr and sdata_aggr + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * The first block of 30 is allocated from meta_aggr and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 6144 + * + * Allocate first block (30) from sdata_aggr: (meta_aggr is empty) + * meta_aggr is at EOA but has not used up more than meta_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[6144, 2048] + * This fragment adjoins meta_aggr and fulfills "absorb" condition, + * the remaining space left in meta_aggr is absorbed into the fragment and + * freed to free-space: [4126, 2018] + * meta_aggr is reset to 0 + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 10240 + * + * Allocate second block (2058) from meta_aggr: + * request-size + fragment size is > meta_aggr->size + * request_size is > meta_aggr->alloc_size + * sdata_aggr is at EOA but has not used up more than sdata_aggr->alloc_size + * Result: + * A block of 2058 is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[10240, 2048] + * This fragment adjoins sdata_aggr and fulfills "absorb" condition, + * the remaining space left in sdata_aggr is absorbed into the fragment and + * freed to free-space: [8222, 2018] + * sdata_aggr is reset to 0 + * EOA is 14346 + * meta_aggr and sdata_aggr are all 0 *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; - H5FD_mem_t type, stype; - haddr_t addr1, addr2, saddr1; + H5FD_mem_t type, stype; + haddr_t addr1, addr2, saddr1; H5FS_stat_t state[H5FD_MEM_NTYPES]; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; - haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0; - hsize_t alignment=0, mis_align=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF; + haddr_t sdata_addr=HADDR_UNDEF, new_sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0, sdata_size=0, new_sdata_size=0; + hsize_t alignment=0, mis_align=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ @@ -5586,15 +5586,15 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) } /* Verify total size of free space after all allocations */ - if(f->shared->fs_man[type]) { - if(check_stats(f, f->shared->fs_man[type], &(state[type]))) - TEST_ERROR - } + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } - if(f->shared->fs_man[stype]) { - if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) - TEST_ERROR - } + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } /* nothing is changed in meta_aggr */ H5MF__aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); @@ -5612,15 +5612,15 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + puts(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc5() */ @@ -5630,125 +5630,125 @@ error: *------------------------------------------------------------------------- * To verify that blocks allocated from the aggregator are aligned * - * Alignment = 1024 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is empty) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 224] - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in meta_aggr->size - * EOA is 3072 - * - * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) - * request_size > sdata_aggr->size and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is allocated from file allocation - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 5120 - * - * Allocate second block (50) from sdata_aggr: - * (request-size+fragment size) <= sdata_aggr->size - * Result: - * The second block of 50 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[3102, 994] - * There is space of 974 left in sdata_aggr - * - * Allocate third block (80) from sdata_aggr: - * (request-size+fragment size) > sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * fragment size < (sdata_aggr->alloc_size - request-size) - * Result: - * Another block of sdata_aggr->alloc_size block is extended from file allocation - * for sdata_aggr - * The third block of 80 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[4146, 974] - * There is space of 1968 left in sdata_aggr - * EOA is 7168 - * - * Allocate second block (2058) from meta_aggr: - * request-size + fragment size is > meta_aggr->size - * request-size is > meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * The remaining space in sdata_aggr is freed to free-space and shrunk - * sdata_aggr is reset to 0 - * A block of 2058 is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[5200, 944] - * EOA is at 8202 - * meta_aggr is unchanged - * - * Alignment = 4096 aggr->alloc_size = 2048 - * - * Allocate first block (30) from meta_aggr: (meta_aggr is emtpy) - * request-size is > meta_aggr->size and < meta_aggr->alloc_size - * Result: - * A block of meta_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[800, 3296] - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in meta_aggr - * EOA is 6144 - * - * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) - * request_size > sdata_aggr->size and < sdata_aggr->alloc_size - * Result: - * A block of sdata_aggr->alloc_size is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space: [6144, 2048] - * The first block of 30 is allocated from the aggregator and should be aligned - * There is space of 2018 left in sdata_aggr - * EOA is 10240 - * - * Allocate second block (50) from sdata_aggr: - * (request-size+fragment size) is > sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * fragment size > (sdata_aggr->alloc_size - request-size) - * Result: - * A block of (fragment size + request-size) is extended from file allocation for the aggregator - * The second block of 50 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[8222, 4066] - * There is space of 2018 left in sdata_aggr - * EOA is at 14356 - * - * Allocate third block (80) from sdata_aggr: - * (request-size+fragment size) is > sdata_aggr->size - * request-size < sdata_aggr->alloc_size - * fragment size > (sdata_aggr->alloc_size - request-size) - * Result: - * A block of (fragment size + request-size) is extended from file allocation for sdata_aggr - * The third block of 80 is allocated from sdata_aggr and should be aligned - * Fragment from alignment of aggregator allocation is freed to free-space:[12338, 4046] - * There is space of 2018 left in sdata_aggr - * EOA is 18482 - * - * Allocate second block (2058) from meta_aggr: - * request-size + fragment size is > meta_aggr->size - * request-size is > meta_aggr->alloc_size - * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size - * Result: - * The remaining space in sdata_aggr is freed to free-space and shrunk: [16464, 2018] - * sdata_aggr is reset to 0 - * A block of 2058 is allocated from file allocation - * Fragment from alignment of file allocation is freed to free-space:[16464, 4016] - * EOA is at 22538 - * meta_aggr is unchanged + * Alignment = 1024 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is empty) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 224] + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in meta_aggr->size + * EOA is 3072 + * + * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) + * request_size > sdata_aggr->size and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is allocated from file allocation + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 5120 + * + * Allocate second block (50) from sdata_aggr: + * (request-size+fragment size) <= sdata_aggr->size + * Result: + * The second block of 50 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[3102, 994] + * There is space of 974 left in sdata_aggr + * + * Allocate third block (80) from sdata_aggr: + * (request-size+fragment size) > sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * fragment size < (sdata_aggr->alloc_size - request-size) + * Result: + * Another block of sdata_aggr->alloc_size block is extended from file allocation + * for sdata_aggr + * The third block of 80 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[4146, 974] + * There is space of 1968 left in sdata_aggr + * EOA is 7168 + * + * Allocate second block (2058) from meta_aggr: + * request-size + fragment size is > meta_aggr->size + * request-size is > meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * The remaining space in sdata_aggr is freed to free-space and shrunk + * sdata_aggr is reset to 0 + * A block of 2058 is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[5200, 944] + * EOA is at 8202 + * meta_aggr is unchanged + * + * Alignment = 4096 aggr->alloc_size = 2048 + * + * Allocate first block (30) from meta_aggr: (meta_aggr is emtpy) + * request-size is > meta_aggr->size and < meta_aggr->alloc_size + * Result: + * A block of meta_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[800, 3296] + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in meta_aggr + * EOA is 6144 + * + * Allocate first block (30) from sdata_aggr: (sdata_aggr is empty) + * request_size > sdata_aggr->size and < sdata_aggr->alloc_size + * Result: + * A block of sdata_aggr->alloc_size is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space: [6144, 2048] + * The first block of 30 is allocated from the aggregator and should be aligned + * There is space of 2018 left in sdata_aggr + * EOA is 10240 + * + * Allocate second block (50) from sdata_aggr: + * (request-size+fragment size) is > sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * fragment size > (sdata_aggr->alloc_size - request-size) + * Result: + * A block of (fragment size + request-size) is extended from file allocation for the aggregator + * The second block of 50 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[8222, 4066] + * There is space of 2018 left in sdata_aggr + * EOA is at 14356 + * + * Allocate third block (80) from sdata_aggr: + * (request-size+fragment size) is > sdata_aggr->size + * request-size < sdata_aggr->alloc_size + * fragment size > (sdata_aggr->alloc_size - request-size) + * Result: + * A block of (fragment size + request-size) is extended from file allocation for sdata_aggr + * The third block of 80 is allocated from sdata_aggr and should be aligned + * Fragment from alignment of aggregator allocation is freed to free-space:[12338, 4046] + * There is space of 2018 left in sdata_aggr + * EOA is 18482 + * + * Allocate second block (2058) from meta_aggr: + * request-size + fragment size is > meta_aggr->size + * request-size is > meta_aggr->alloc_size + * sdata_aggr is at EOA and has used up more than sdata_aggr->alloc_size + * Result: + * The remaining space in sdata_aggr is freed to free-space and shrunk: [16464, 2018] + * sdata_aggr is reset to 0 + * A block of 2058 is allocated from file allocation + * Fragment from alignment of file allocation is freed to free-space:[16464, 4016] + * EOA is at 22538 + * meta_aggr is unchanged *------------------------------------------------------------------------- */ static unsigned test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size; - H5FD_mem_t type, stype; - haddr_t addr1, addr2; - haddr_t saddr1, saddr2, saddr3; + H5FD_mem_t type, stype; + haddr_t addr1, addr2; + haddr_t saddr1, saddr2, saddr3; H5FS_stat_t state[H5FD_MEM_NTYPES]; - haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; - hsize_t ma_size=0, new_ma_size=0, sdata_size=0; - hsize_t alignment=0, mis_align=0, tmp=0; + haddr_t ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF; + hsize_t ma_size=0, new_ma_size=0, sdata_size=0; + hsize_t alignment=0, mis_align=0, tmp=0; hbool_t have_alloc_vfd; /* Whether VFD used has an 'alloc' callback */ TESTING("H5MF_alloc() of meta/sdata aggregator with alignment: test 6"); @@ -5901,16 +5901,16 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if (sdata_addr != HADDR_UNDEF || sdata_size != 0) TEST_ERROR - if(f->shared->fs_man[type]) { - if(check_stats(f, f->shared->fs_man[type], &(state[type]))) - TEST_ERROR - } - + if(f->shared->fs_man[type]) { + if(check_stats(f, f->shared->fs_man[type], &(state[type]))) + TEST_ERROR + } + - if(f->shared->fs_man[stype]) { - if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) - TEST_ERROR - } + if(f->shared->fs_man[stype]) { + if(check_stats(f, f->shared->fs_man[stype], &(state[stype]))) + TEST_ERROR + } if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -6386,22 +6386,22 @@ error: memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; \ memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP; \ memb_map[H5FD_MEM_LHEAP] = H5FD_MEM_LHEAP; \ - sprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \ + HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's'); \ memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER]; \ memb_addr[H5FD_MEM_SUPER] = 0; \ - sprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \ + HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b'); \ memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE]; \ memb_addr[H5FD_MEM_BTREE] = HADDR_MAX/6; \ - sprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \ + HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r'); \ memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW]; \ memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/3; \ - sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \ + HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); \ memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; \ memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX/2; \ - sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \ + HDsprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); \ memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; \ memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; \ - sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \ + HDsprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); \ memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; \ memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; \ } @@ -6748,7 +6748,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) TESTING("File's free-space is persistent with new library format") else TESTING("File's free-space is persistent with old library format") - + if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")) { /* File creation property list template */ @@ -6889,7 +6889,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); H5Pclose(fapl2); } H5E_END_TRY; @@ -6898,7 +6898,7 @@ error: /* *------------------------------------------------------------------------- - * Verify free-space are merged/shrunk away + * Verify free-space are merged/shrunk away *------------------------------------------------------------------------- */ static unsigned @@ -6913,7 +6913,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5FS_stat_t fs_stat; /* Information for free-space manager */ haddr_t addr1, addr2, addr3, addr4; /* File address for H5FD_MEM_SUPER */ haddr_t addrx; - H5FD_mem_t fs_type; + H5FD_mem_t fs_type; hbool_t contig_addr_vfd; if(new_format) @@ -6966,7 +6966,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4))) FAIL_STACK_ERROR - + /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -7073,7 +7073,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); H5Pclose(fapl2); } H5E_END_TRY; @@ -7136,11 +7136,11 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for /* Create file-creation template */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) FAIL_STACK_ERROR - + /* Set default file space information */ if(H5Pset_file_space_strategy(fcpl, fs_type, (hbool_t)fs_persist, fs_threshold) < 0) FAIL_STACK_ERROR - + /* Create the file to work on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl2)) < 0) FAIL_STACK_ERROR @@ -7163,7 +7163,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - + /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -7195,7 +7195,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for hssize_t nsects; /* # of free-space sections */ int i; /* local index variable */ H5F_sect_info_t *sect_info; /* array to hold the free-space information */ - + /* Get the # of free-space sections in the file */ if((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0) FAIL_STACK_ERROR @@ -7210,7 +7210,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)); H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); - + /* Verify the size of free-space sections */ for(i = 0; i < nsects; i++) if(sect_info[i].size < fs_threshold) @@ -7243,7 +7243,7 @@ error: H5E_BEGIN_TRY { H5Pclose(fcpl); H5Pclose(fapl2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_strat_thres_persist() */ @@ -7286,7 +7286,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format HDmemset(&fs_state_zero, 0, sizeof(H5FS_stat_t)); /* Copy the file access property list */ - if((fapl2 = H5Pcopy(fapl)) < 0) + if((fapl2 = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR if(new_format) @@ -7342,7 +7342,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0) FAIL_STACK_ERROR - } + } /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0) @@ -7375,7 +7375,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { fs_state.tot_sect_count = fs_state.serial_sect_count = 1; fs_state.tot_space += (TBLOCK_SIZE4 + TBLOCK_SIZE6); - } + } /* For old format: the sections at EOF are shrunk away */ if(check_stats(f, f->shared->fs_man[tt], (fs_type == H5F_FSPACE_STRATEGY_PAGE) ? &fs_state:&fs_state_zero)) @@ -7399,7 +7399,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format /* Re-open the file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl2)) < 0) FAIL_STACK_ERROR - + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR @@ -7429,7 +7429,7 @@ error: H5E_BEGIN_TRY { H5Pclose(fcpl); H5Pclose(fapl2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_strat_thres_gone() */ @@ -7459,11 +7459,11 @@ error: static unsigned test_dichotomy(hid_t fapl) { - hid_t file = -1; /* File ID */ - char filename[FILENAME_LEN]; /* Filename to use */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5FD_mem_t type, stype; - haddr_t addr1, addr3, saddr1, saddr2; + hid_t file = -1; /* File ID */ + char filename[FILENAME_LEN]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + H5FD_mem_t type, stype; + haddr_t addr1, addr3, saddr1, saddr2; TESTING("Allocation from raw or metadata free-space manager"); @@ -7516,7 +7516,7 @@ test_dichotomy(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_dichotomy() */ @@ -7637,7 +7637,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); @@ -7702,7 +7702,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Re-open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) TEST_ERROR - + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR @@ -7732,7 +7732,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Verify that the small raw data manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW])) TEST_ERROR - + /* Set up to use the small raw data manager */ if(!(f->shared->fs_man[H5F_MEM_PAGE_DRAW])) if(H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0) @@ -7756,7 +7756,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(found_addr != gaddr1) TEST_ERROR - + /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -7991,13 +7991,13 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, (haddr_t)addr1, (hsize_t)TBLOCK_SIZE3198, (hsize_t)TBLOCK_SIZE50); /* Should succeed */ if(was_extended != TRUE) TEST_ERROR - + /* Free the block with addr1 */ H5MF_xfree(f, H5FD_MEM_OHDR, addr1, (hsize_t)TBLOCK_SIZE3248); /* Allocate a new metadata block with addr1 */ /* There is a page end threshold of size H5F_FILE_SPACE_PGEND_META_THRES at the end of the block */ - /* The block is right next to the threshold */ + /* The block is right next to the threshold */ addr1 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE3286); /* Try extending the block into the threshold with size > H5F_FILE_SPACE_PGEND_META_THRES */ @@ -8159,7 +8159,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) if(was_extended == FALSE) TEST_ERROR /* Try extending the block with gaddr2 */ - /* There is no free-space section big enough to fulfill the request (request is < H5F_FILE_SPACE_PGEND_META_THRES) */ + /* There is no free-space section big enough to fulfill the request (request is < H5F_FILE_SPACE_PGEND_META_THRES) */ was_extended = H5MF_try_extend(f, H5FD_MEM_DRAW, (haddr_t)gaddr2, (hsize_t)TBLOCK_SIZE8190, (hsize_t)TBLOCK_SIZE5); /* Should not succeed */ if(was_extended == TRUE) TEST_ERROR @@ -8247,7 +8247,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) /* Set the strategy to paged aggregation */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0) FAIL_STACK_ERROR - + /* Create the file to work on */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR @@ -8322,7 +8322,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(fs_stat.tot_space != (16384+288)) TEST_ERROR - + /* Close file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR @@ -8390,7 +8390,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) multi = TRUE; else if(!HDstrcmp(env_h5_drvr, "family")) family = TRUE; - + if(!multi && !split) { /* Set the filename to use for this test (dependent on fapl) */ @@ -8524,7 +8524,7 @@ error: * Function: test_page_alignment * * Purpose: To verify the proper alignment is used when H5Pset_alignment() - * is set and paged aggregation is enabled. + * is set and paged aggregation is enabled. * * Return: Success: 0 * Failure: number of errors @@ -8555,7 +8555,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) split = TRUE; else if(!HDstrcmp(env_h5_drvr, "multi")) multi = TRUE; - + if(!multi && !split) { /* Set the filename to use for this test (dependent on fapl) */ @@ -8647,7 +8647,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* The alignment to use will be the library's default file space page size */ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) TEST_ERROR - + /* Create the file to work on */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl_new)) < 0) TEST_ERROR @@ -8688,7 +8688,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) if(H5Fclose(fid) < 0) TEST_ERROR - /* + /* * Case 2: Verify that the alignment in use is the alignment set * via H5Pset_alignment when paged aggregation not enabled. */ @@ -8745,7 +8745,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) if(H5Fclose(fid) < 0) TEST_ERROR - /* + /* * Case 3: Verify that the alignment in use is the alignment set * via H5Pset_alignment when paged aggregation not enabled. */ @@ -8768,7 +8768,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - + /* Allocate 2 small raw data blocks */ saddr1 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE30); saddr2 = H5MF_alloc(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE50); @@ -8830,10 +8830,10 @@ error: int main(void) { - hid_t fapl = -1; /* File access property list for data files */ - hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */ + hid_t fapl = -1; /* File access property list for data files */ + hid_t new_fapl = -1; /* File access property list for alignment & aggr setting */ unsigned nerrors = 0; /* Cumulative error count */ - test_type_t curr_test; /* Current test being worked on */ + test_type_t curr_test; /* Current test being worked on */ const char *env_h5_drvr; /* File Driver value from environment */ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ @@ -8935,7 +8935,7 @@ main(void) nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, FALSE); nerrors += test_mf_strat_thres_persist(env_h5_drvr, fapl, TRUE); - /* Temporary skipped for multi/split drivers: + /* Temporary skipped for multi/split drivers: fail file create when persisting free-space or using paged aggregation strategy */ #ifdef PB_OUT /* Tests specific for multi and split files--persisting free-space */ @@ -8943,7 +8943,7 @@ main(void) nerrors += test_mf_fs_persist_multi(); #endif - /* + /* * Tests specific for file space paging */ /* Temporary: The following 7 tests are modified to skip testing for multi/split driver: diff --git a/test/mtime.c b/test/mtime.c index 80730eb..f7a441d 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke * Thursday, July 30, 1998 * - * Purpose: Determines if the modification time message is working - * properly. Specifically, the code in H5O_mtime_decode() is - * very OS-dependent and this test tries to figure out if it's - * working properly. + * Purpose: Determines if the modification time message is working + * properly. Specifically, the code in H5O_mtime_decode() is + * very OS-dependent and this test tries to figure out if it's + * working properly. */ #include "h5test.h" #include "H5srcdir.h" @@ -33,17 +33,17 @@ const char *FILENAME[] = { #define TESTFILE2 "tmtimen.h5" #define MTIME2 1041606478 - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: H5O_mtime_decode() test. + * Purpose: H5O_mtime_decode() test. * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 30, 1998 * * Modifications: @@ -58,13 +58,13 @@ const char *FILENAME[] = { int main(void) { - hid_t fapl, file, space, dset; - hsize_t size[1] = {2}; - time_t now; - struct tm *tm; - H5O_info_t oi1, oi2; - signed char buf1[32], buf2[32]; - char filename[1024]; + hid_t fapl, file, space, dset; + hsize_t size[1] = {2}; + time_t now; + struct tm *tm; + H5O_info_t oi1, oi2; + signed char buf1[32], buf2[32]; + char filename[1024]; h5_reset(); fapl = h5_fileaccess(); @@ -99,18 +99,18 @@ main(void) /* Compare addresses & times from the two ways of calling H5Oget_info() */ if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) { H5_FAILED(); - puts(" Calling H5Oget_info() with the dataset ID returned"); - puts(" different values than calling it with a file and dataset"); - puts(" name."); + HDputs(" Calling H5Oget_info() with the dataset ID returned"); + HDputs(" different values than calling it with a file and dataset"); + HDputs(" name."); goto error; } /* Compare times -- they must be within 60 seconds of one another */ if(0 == oi1.ctime) { SKIPPED(); - puts(" The modification time could not be decoded on this OS."); - puts(" Modification times will be mantained in the file but"); - puts(" cannot be queried on this system. See H5O_mtime_decode()."); + HDputs(" The modification time could not be decoded on this OS."); + HDputs(" Modification times will be mantained in the file but"); + HDputs(" cannot be queried on this system. See H5O_mtime_decode()."); return 0; } else if(HDfabs(HDdifftime(now, oi1.ctime)) > (double)60.0F) { H5_FAILED(); @@ -118,7 +118,7 @@ main(void) HDstrftime((char*)buf1, sizeof buf1, "%Y-%m-%d %H:%M:%S", tm); tm = HDlocaltime(&now); HDstrftime((char*)buf2, sizeof buf2, "%Y-%m-%d %H:%M:%S", tm); - printf(" got: %s\n ans: %s\n", buf1, buf2); + HDprintf(" got: %s\n ans: %s\n", buf1, buf2); goto error; } PASSED(); @@ -147,7 +147,7 @@ main(void) } else { H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; } /* end else */ @@ -168,14 +168,14 @@ main(void) TEST_ERROR; if(oi2.ctime != MTIME2) { H5_FAILED(); - puts(" Modification time incorrect."); + HDputs(" Modification time incorrect."); goto error; } if(H5Fclose(file) < 0) TEST_ERROR; } else { H5_FAILED(); - printf("***cannot open the pre-created old modification test file (%s)\n", + HDprintf("***cannot open the pre-created old modification test file (%s)\n", testfile); goto error; } /* end else */ @@ -186,7 +186,7 @@ main(void) if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR /* All looks good */ - puts("All modification time tests passed."); + HDputs("All modification time tests passed."); h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/ntypes.c b/test/ntypes.c index b6f4de7..83cdfd2 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -149,8 +149,8 @@ test_atomic_dtype(hid_t file) for(j = 0; j < DIM1; j++) if(ipoints2[i][j] != icheck2[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -521,8 +521,8 @@ test_compound_dtype2(hid_t file) temp_point->st.ll2 != temp_check->st.ll2 || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ } /* end for */ @@ -728,8 +728,8 @@ test_compound_dtype(hid_t file) temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -942,16 +942,16 @@ test_compound_dtype3(hid_t file) if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ for(k = 0; k < 5; k++) { if(temp_point->a[k] != temp_check->a[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d,%d\n", i, j, k); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d,%d\n", i, j, k); goto error; } /* end if */ } /* end for */ @@ -1157,16 +1157,16 @@ test_compound_opaque(hid_t file) if(temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ for(k = 0; k < 5; k++) { if(temp_point->o[k] != temp_check->o[k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d,%d\n", i, j, k); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d,%d\n", i, j, k); goto error; } /* end if */ } /* end for */ @@ -1320,9 +1320,9 @@ test_enum_dtype(hid_t file) for(j = 0; j < DIM1; j++) if(spoints2[i][j] != scheck2[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" spoints2[i][j]=%hd, scheck2[i][j]=%hd\n", spoints2[i][j], scheck2[i][j]); goto error; } /* end if */ @@ -1476,8 +1476,8 @@ test_array_dtype(hid_t file) temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -1610,8 +1610,8 @@ test_array_dtype2(hid_t file) for(k = 0; k < 5; k++) if(icheck3[i][j][k] != ipoints3[i][j][k]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } /* end if */ @@ -1677,7 +1677,7 @@ test_vl_dtype(hid_t file) wdata[i].p = HDmalloc((i + 1) * sizeof(hvl_t)); if(NULL == wdata[i].p) { H5_FAILED(); - printf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i); + HDprintf(" Cannot allocate memory for VL data! i=%u\n",(unsigned)i); goto error; } /* end if */ wdata[i].len = i + 1; @@ -1685,7 +1685,7 @@ test_vl_dtype(hid_t file) t1->p = HDmalloc((j + 1) * sizeof(unsigned int)); if(NULL == t1->p) { H5_FAILED(); - printf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j); + HDprintf(" Cannot allocate memory for VL data! i=%u, j=%u\n",(unsigned)i,(unsigned)j); goto error; } /* end if */ t1->len = j + 1; @@ -1745,13 +1745,13 @@ test_vl_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(wdata[i].len != rdata[i].len) { H5_FAILED(); - printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ for(t1 = (hvl_t *)wdata[i].p, t2 = (hvl_t *)rdata[i].p, j = 0; j < rdata[i].len; j++, t1++, t2++) { if(t1->len != t2->len) { H5_FAILED(); - printf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); + HDprintf(" VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); goto error; } /* end if */ @@ -1767,7 +1767,7 @@ test_vl_dtype(hid_t file) for(k = 0; k < t2->len; k++) { if(((unsigned int *)t1->p)[k] != ((unsigned int *)tmp)[k]) { H5_FAILED(); - printf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", + HDprintf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", (unsigned)i, ((unsigned int*)t1->p)[k], (unsigned)i, ((unsigned int*)tmp)[k]); goto error; } /* end if */ @@ -1903,13 +1903,13 @@ test_vlstr_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); - printf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", + HDprintf(" VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); goto error; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); - printf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + HDprintf(" VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]); goto error; } /* end if */ @@ -2026,13 +2026,13 @@ test_str_dtype(hid_t file) for(i = 0; i < SPACE1_DIM1; i++) { if(HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { H5_FAILED(); - printf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", + HDprintf(" data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); goto error; } /* end if */ if(HDstrcmp(wdata[i], rdata[i]) != 0 ) { H5_FAILED(); - printf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", + HDprintf(" data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]); goto error; } /* end if */ @@ -2507,8 +2507,8 @@ test_opaque_dtype(hid_t file) for(i = 0; i < sizeof(rbuf); i++) if(rbuf[i] != wbuf[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)i); goto error; } /* end if */ @@ -2612,8 +2612,8 @@ test_bitfield_dtype(hid_t file) for(i = 0; i < BITFIELD_ENUMB*4; i++) { if(*p != wbuf[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %zu\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %zu\n", i); TEST_ERROR; } p++; @@ -2637,8 +2637,8 @@ test_bitfield_dtype(hid_t file) for(i = 0; i < BITFIELD_ENUMB; i++) { if(intr[i] != intw[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %zu\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %zu\n", i); TEST_ERROR; } } @@ -2792,13 +2792,13 @@ test_ninteger(void) /* check */ if(H5Tget_precision(nid1) != H5Tget_precision(nid2)) { - printf(" Precision differ.\n"); + HDprintf(" Precision differ.\n"); TEST_ERROR } /* end if */ /* compare dataset creation property lists */ if(H5Pequal(dcpl1, dcpl2) <= 0) { - printf(" Property lists differ.\n"); + HDprintf(" Property lists differ.\n"); TEST_ERROR } /* end if */ @@ -2806,8 +2806,8 @@ test_ninteger(void) for(i = 0; i < DIM3; i++) if(buf[i] != chk[i]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d\n", i); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d\n", i); TEST_ERROR } /* end if */ @@ -2898,7 +2898,7 @@ main(void) if(nerrors) goto error; - printf("All native datatype tests passed.\n"); + HDprintf("All native datatype tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; @@ -2910,7 +2910,7 @@ error: } H5E_END_TRY; nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; diff --git a/test/objcopy.c b/test/objcopy.c index 489d6dd..5a5afc0 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -592,7 +592,7 @@ test_copy_attach_attributes(hid_t loc_id, hid_t type_id) goto done; for(u = 0; u < num_attributes_g; u++) { - sprintf(attr_name, "%u attr", u); + HDsprintf(attr_name, "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -661,7 +661,7 @@ test_copy_attach_paired_attributes(hid_t loc_id, hid_t loc_id2, hid_t type_id) if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0) goto done; for(u = 0; u < num_attributes_g; u++) { - sprintf(attr_name, "%u attr", u); + HDsprintf(attr_name, "%u attr", u); /* Set attribute data */ attr_data[0] = (int)(100 * u); @@ -6667,15 +6667,15 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f /* create nested sub-groups & datasets */ for(i = 0; i < NUM_SUB_GROUPS; i++) { - sprintf(objname, "Group #%d", i); + HDsprintf(objname, "Group #%d", i); if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(j = 0; j < NUM_SUB_GROUPS; j++) { - sprintf(objname, "Group #%d", j); + HDsprintf(objname, "Group #%d", j); if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(k = 0; k < NUM_DATASETS; k++) { - sprintf(objname, "Dataset #%d", k); + HDsprintf(objname, "Dataset #%d", k); /* add a dataset to the group */ if((did = H5Dcreate2(gid_sub2, objname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -6908,11 +6908,11 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t /* create wide sub-group hierarchy, with multiple links to higher groups */ for(u = 0; u < NUM_WIDE_LOOP_GROUPS; u++) { - sprintf(objname, "%s-%u", NAME_GROUP_SUB, u); + HDsprintf(objname, "%s-%u", NAME_GROUP_SUB, u); if((gid_sub = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR for(v = 0; v < NUM_WIDE_LOOP_GROUPS; v++) { - sprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); + HDsprintf(objname, "%s-%u", NAME_GROUP_SUB_SUB2, v); if((gid_sub2 = H5Gcreate2(gid_sub, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create link to top group */ diff --git a/test/reserved.c b/test/reserved.c index d8d0c59..7e53d9c 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -22,17 +22,17 @@ const char *FILENAME[] = { }; /*------------------------------------------------------------------------- - * Function: rsrv_heap + * Function: rsrv_heap * - * Purpose: Ensure that heaps reserve file address space. - * This function does this by creating datasets up to and past - * the limit of the file, then ensuring that an error (not an - * assert) was generated and that the file is readable. + * Purpose: Ensure that heaps reserve file address space. + * This function does this by creating datasets up to and past + * the limit of the file, then ensuring that an error (not an + * assert) was generated and that the file is readable. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: James Laird + * Programmer: James Laird * Nat Furrer * Friday, May 28, 2004 * @@ -71,7 +71,7 @@ rsrv_heap(void) dataspace_id = H5Screate_simple(1, dims, dims); } H5E_END_TRY - sprintf(dset_name, "Dset %d", i); + HDsprintf(dset_name, "Dset %d", i); H5E_BEGIN_TRY { dataset_id = H5Dcreate2(file_id, dset_name, H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -103,7 +103,7 @@ rsrv_heap(void) /* Re-open the library and try to read a dataset from the file we created */ if(H5open() < 0) TEST_ERROR; - sprintf(dset_name, "Dset %d", i - 2); + HDsprintf(dset_name, "Dset %d", i - 2); file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); if(file_id < 0) TEST_ERROR; @@ -135,17 +135,17 @@ error: } /*------------------------------------------------------------------------- - * Function: rsrv_ohdr + * Function: rsrv_ohdr * - * Purpose: Ensure that object headers reserve file address space. - * This function does this by creating attributes of a dataset - * past the limit of the file, then ensuring that an error (not - * an assert) was generated and that the file is readable. + * Purpose: Ensure that object headers reserve file address space. + * This function does this by creating attributes of a dataset + * past the limit of the file, then ensuring that an error (not + * an assert) was generated and that the file is readable. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: James Laird + * Programmer: James Laird * Nat Furrer * Friday, May 28, 2004 * @@ -195,7 +195,7 @@ rsrv_ohdr(void) } /* end for */ for(i = 0; i < 2000; i++) { - sprintf(attrname, "attr %d", i); + HDsprintf(attrname, "attr %d", i); H5E_BEGIN_TRY{ aid = H5Screate_simple(2, dims, NULL); attr_id = H5Acreate2(dataset_id, attrname, H5T_STD_I32BE, aid, H5P_DEFAULT, H5P_DEFAULT); @@ -257,20 +257,20 @@ error: } /*------------------------------------------------------------------------- - * Function: rsrv_vlen + * Function: rsrv_vlen * - * Purpose: Ensure that variable length datatypes properly ensure that + * Purpose: Ensure that variable length datatypes properly ensure that * enough file address space exists before writing. - * This function does this by creating a dataset containing + * This function does this by creating a dataset containing * variable length data past the limit of the file, then * ensuring that an error (not an assert) was generated and * that the file is readable. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: James Laird - * Nat Furrer + * Programmer: James Laird + * Nat Furrer * Thursday, July 1, 2004 * * Modifications: @@ -401,15 +401,15 @@ error: #endif /* BROKEN */ /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Nat Furrer and James Laird + * Programmer: Nat Furrer and James Laird * Thursday, July 1, 2004 * * Modifications: @@ -434,22 +434,22 @@ main(void) envval = "nomatch"; /* QAK: should be able to use the core driver? */ if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi") && HDstrcmp(envval, "family")) { - num_errs+=rsrv_ohdr(); - num_errs+=rsrv_heap(); - num_errs+=rsrv_vlen(); - - if(num_errs > 0) - printf("**** %d FAILURE%s! ****\n", num_errs, num_errs==1?"":"S"); - else - puts("All address space reservation tests passed."); - - fapl = h5_fileaccess(); - h5_cleanup(FILENAME, fapl); - return num_errs; + num_errs+=rsrv_ohdr(); + num_errs+=rsrv_heap(); + num_errs+=rsrv_vlen(); + + if(num_errs > 0) + HDprintf("**** %d FAILURE%s! ****\n", num_errs, num_errs==1?"":"S"); + else + HDputs("All address space reservation tests passed."); + + fapl = h5_fileaccess(); + h5_cleanup(FILENAME, fapl); + return num_errs; } else { - puts("All address space reservation tests skippped - Incompatible with current Virtual File Driver"); + HDputs("All address space reservation tests skippped - Incompatible with current Virtual File Driver"); } #endif /* BROKEN */ diff --git a/test/ros3.c b/test/ros3.c index 6d58af0..7a12a8d 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -1925,7 +1925,7 @@ main(void) s3_test_bucket_defined = TRUE; } - if (S3_TEST_MAX_URL_SIZE < snprintf( + if (S3_TEST_MAX_URL_SIZE < HDsnprintf( url_text_restricted, (size_t)S3_TEST_MAX_URL_SIZE, "%s/%s", diff --git a/test/s3comms.c b/test/s3comms.c index d636550..7bc9961 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -386,7 +386,7 @@ static hbool_t s3_test_bucket_defined = FALSE; #endif /* H5_HAVE_ROS3_VFD */ - + /*--------------------------------------------------------------------------- * * Function: test_macro_format_credential() @@ -431,7 +431,7 @@ error: } /* end test_macro_format_credential() */ - + /*--------------------------------------------------------------------------- * * Function: test_aws_canonical_request() @@ -616,7 +616,7 @@ error: } /* end test_aws_canonical_request() */ - + /*--------------------------------------------------------------------------- * * Function: test_bytes_to_hex @@ -712,7 +712,7 @@ error: } /* end test_bytes_to_hex() */ - + /*--------------------------------------------------------------------------- * * Function: test_hrb_init_request() @@ -834,7 +834,7 @@ error: } /* end test_hrb_init_request() */ - + /*--------------------------------------------------------------------------- * * Function: test_hrb_node_set() @@ -1141,7 +1141,7 @@ error: } /* end test_hrb_node_t() */ - + /*--------------------------------------------------------------------------- * * Function: test_HMAC_SHA256() @@ -1276,7 +1276,7 @@ error: } /* end test_HMAC_SHA256() */ - + /*---------------------------------------------------------------------------- * * Function: test_nlowercase() @@ -1359,7 +1359,7 @@ error: } /* end test_nlowercase() */ - + /*--------------------------------------------------------------------------- * * Function: test_parse_url() @@ -1609,7 +1609,7 @@ error: } /* end test_parse_url() */ - + /*--------------------------------------------------------------------------- * * Function: test_percent_encode_char() @@ -1693,7 +1693,7 @@ error: return -1; } /* end test_percent_encode_char() */ - + /*--------------------------------------------------------------------------- * Function: test_s3r_open() * @@ -1763,7 +1763,7 @@ error: } /* end test_s3r_get_filesize() */ - + /*--------------------------------------------------------------------------- * Function: test_s3r_open() * @@ -1902,7 +1902,7 @@ test_s3r_open(void) *************************/ #if S3_TEST_RUN_TIMEOUT -printf("Opening on inactive port may hang for a minute; waiting for timeout\n"); + HDprintf("Opening on inactive port may hang for a minute; waiting for timeout\n"); handle = H5FD_s3comms_s3r_open(url_raven_badport, NULL, NULL, NULL); FAIL_IF( handle != NULL ); #endif @@ -2004,7 +2004,7 @@ error: } /* end test_s3r_open() */ - + /*--------------------------------------------------------------------------- * * Function: test_s3r_read() @@ -2369,7 +2369,7 @@ error: } /* end test_signing_key() */ - + /*--------------------------------------------------------------------------- * * Function: test_tostringtosign() @@ -2441,7 +2441,7 @@ error : } /* end test_tostringtosign() */ - + /*---------------------------------------------------------------------------- * * Function: test_trim() @@ -2552,7 +2552,7 @@ error: } /* end test_trim() */ - + /*---------------------------------------------------------------------------- * * Function: test_uriencode() @@ -2681,7 +2681,7 @@ error: - + /*------------------------------------------------------------------------- * Function: main() * diff --git a/test/stab.c b/test/stab.c index 37097b7..80c8b06 100644 --- a/test/stab.c +++ b/test/stab.c @@ -16,13 +16,13 @@ * Tuesday, November 24, 1998 */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING #include "h5test.h" -#include "H5Gpkg.h" /* Groups */ +#include "H5Gpkg.h" /* Groups */ const char *FILENAME[] = { "stab", @@ -78,17 +78,17 @@ const char *FILENAME[] = { #define CORRUPT_STAB_TMP_FILE "corrupt_stab_msg_tmp.h5" #define CORRUPT_STAB_DSET "DS1" - + /*------------------------------------------------------------------------- - * Function: test_misc + * Function: test_misc * - * Purpose: Test miscellaneous group stuff. + * Purpose: Test miscellaneous group stuff. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * *------------------------------------------------------------------------- @@ -96,10 +96,10 @@ const char *FILENAME[] = { static int test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t g1 = (-1), g2 = (-1), g3 = (-1); - char filename[NAME_BUF_SIZE]; - char comment[64]; + hid_t fid = (-1); /* File ID */ + hid_t g1 = (-1), g2 = (-1), g3 = (-1); + char filename[NAME_BUF_SIZE]; + char comment[64]; if(new_format) TESTING("miscellaneous group tests (w/new group format)") @@ -125,10 +125,10 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Oget_comment_by_name(g3, "././.", comment, sizeof comment, H5P_DEFAULT) < 0) TEST_ERROR if(HDstrcmp(comment, "hello world")) { - H5_FAILED(); - puts(" Read the wrong comment string from the group."); - printf(" got: \"%s\"\n ans: \"hello world\"\n", comment); - TEST_ERROR + H5_FAILED(); + HDputs(" Read the wrong comment string from the group."); + HDprintf(" got: \"%s\"\n ans: \"hello world\"\n", comment); + TEST_ERROR } if(H5Gclose(g1) < 0) TEST_ERROR if(H5Gclose(g2) < 0) TEST_ERROR @@ -153,21 +153,21 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(g1); - H5Gclose(g2); - H5Gclose(g3); - H5Fclose(fid); + H5Gclose(g1); + H5Gclose(g2); + H5Gclose(g3); + H5Fclose(fid); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Purpose: Creates a group with a very long name * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Robb Matzke 2002-03-28 * @@ -177,10 +177,10 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format) static int test_long(hid_t fcpl, hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t g1 = (-1), g2 = (-1); char *name1 = NULL, *name2 = NULL; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; size_t i; if(new_format) @@ -198,7 +198,7 @@ test_long(hid_t fcpl, hid_t fapl, hbool_t new_format) name1[i] = (char)('A' + i%26); name1[LONG_NAME_LEN - 1] = '\0'; name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2)); - sprintf(name2, "%s/%s", name1, name1); + HDsprintf(name2, "%s/%s", name1, name1); /* Create groups */ if((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -226,22 +226,22 @@ error: H5E_BEGIN_TRY { H5Gclose(g1); H5Gclose(g2); - H5Fclose(fid); + H5Fclose(fid); HDfree(name2); HDfree(name1); } H5E_END_TRY; return 1; } /* end test_long() */ - + /*------------------------------------------------------------------------- * Function: test_large * * Purpose: Creates a really large directory. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * * Programmer: Robb Matzke * robb@maya.nuance.com @@ -252,9 +252,9 @@ error: static int test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t cwg = (-1), dir = (-1); /* Group IDs */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char name[NAME_BUF_SIZE]; int i; @@ -275,8 +275,8 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) if(new_format) if(H5G__has_stab_test(cwg) != FALSE) TEST_ERROR for(i = 0; i < LARGE_NOBJS; i++) { - sprintf(name, "%05d%05d", (HDrandom() % 100000), i); - if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i); + if((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(dir) < 0) TEST_ERROR } if(new_format) @@ -291,14 +291,14 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) error: H5E_BEGIN_TRY { - H5Gclose(dir); - H5Gclose(cwg); - H5Fclose(fid); + H5Gclose(dir); + H5Gclose(cwg); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end test_large() */ - + /*------------------------------------------------------------------------- * Function: lifecycle * @@ -318,19 +318,19 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) static int lifecycle(hid_t fcpl, hid_t fapl2) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ hid_t gcpl = (-1); /* Group creation property list ID */ size_t lheap_size_hint; /* Local heap size hint */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned est_num_entries; /* Estimated # of entries in group */ - unsigned est_name_len; /* Estimated length of entry name */ - unsigned nmsgs; /* Number of messages in group's header */ + unsigned est_num_entries; /* Estimated # of entries in group */ + unsigned est_name_len; /* Estimated length of entry name */ + unsigned nmsgs; /* Number of messages in group's header */ H5O_info_t oinfo; /* Object info */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ unsigned u; /* Local index variable */ h5_stat_size_t file_size; /* Size of each file created */ @@ -385,7 +385,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -402,7 +402,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Create several more bottom groups, to push the top group almost to a symbol table */ /* (Start counting at '1', since we've already created one bottom group */ for(u = 1; u < LIFECYCLE_MAX_COMPACT; u++) { - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -426,7 +426,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(oinfo.hdr.nchunks != 1) TEST_ERROR /* Create one more "bottom" group, which should push top group into using a symbol table */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -449,7 +449,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Unlink objects from top group */ while(u >= LIFECYCLE_MIN_DENSE) { - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -462,7 +462,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink one more object from the group, which should transform back to using links */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; @@ -472,10 +472,10 @@ lifecycle(hid_t fcpl, hid_t fapl2) if(nmsgs != (LIFECYCLE_MIN_DENSE - 1)) TEST_ERROR /* Unlink last two objects from top group */ - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; - sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ @@ -505,15 +505,15 @@ lifecycle(hid_t fcpl, hid_t fapl2) error: H5E_BEGIN_TRY { - H5Gclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gcpl); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end lifecycle() */ - + /*------------------------------------------------------------------------- * Function: long_compact * @@ -532,11 +532,11 @@ error: static int long_compact(hid_t fcpl, hid_t fapl2) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Group ID */ char *objname = NULL; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ @@ -638,9 +638,9 @@ long_compact(hid_t fcpl, hid_t fapl2) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; if(objname) @@ -649,7 +649,7 @@ error: return 1; } /* end long_compact() */ - + /*------------------------------------------------------------------------- * Function: read_old * @@ -691,7 +691,7 @@ read_old(void) /* Create a bunch of objects in the group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { - sprintf(objname, "Group %u", u); + HDsprintf(objname, "Group %u", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -709,7 +709,7 @@ read_old(void) /* Delete new objects from old group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { - sprintf(objname, "Group %u", u); + HDsprintf(objname, "Group %u", u); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -730,13 +730,13 @@ read_old(void) error: H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end read_old() */ - + /*------------------------------------------------------------------------- * Function: no_compact * @@ -755,16 +755,16 @@ error: static int no_compact(hid_t fcpl, hid_t fapl2) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ hid_t gcpl = (-1); /* Group creation property list ID */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ - unsigned est_num_entries; /* Estimated # of entries in group */ - unsigned est_name_len; /* Estimated length of entry name */ + unsigned est_num_entries; /* Estimated # of entries in group */ + unsigned est_name_len; /* Estimated length of entry name */ TESTING("group without compact form"); @@ -802,7 +802,7 @@ no_compact(hid_t fcpl, hid_t fapl2) if(H5G__is_empty_test(gid) != TRUE) TEST_ERROR /* Create first "bottom" group */ - sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Check on bottom group's status */ @@ -817,7 +817,7 @@ no_compact(hid_t fcpl, hid_t fapl2) if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink object from top group */ - sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ @@ -843,15 +843,15 @@ no_compact(hid_t fcpl, hid_t fapl2) error: H5E_BEGIN_TRY { - H5Gclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gcpl); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end no_compact() */ - + /*------------------------------------------------------------------------- * Function: gcpl_on_root * @@ -869,15 +869,15 @@ error: static int gcpl_on_root(hid_t fapl2) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ + hid_t gid2 = (-1); /* Datatype ID */ hid_t fcpl = (-1); /* File creation property list ID */ hid_t gcpl = (-1); /* Group creation property list ID */ hid_t lcpl = (-1); /* Link creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("setting root group creation properties"); @@ -962,17 +962,17 @@ gcpl_on_root(hid_t fapl2) error: H5E_BEGIN_TRY { - H5Gclose(lcpl); - H5Gclose(gcpl); - H5Gclose(gid2); - H5Gclose(gid); - H5Gclose(fcpl); - H5Fclose(fid); + H5Gclose(lcpl); + H5Gclose(gcpl); + H5Gclose(gid2); + H5Gclose(gid); + H5Gclose(fcpl); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end gcpl_on_root() */ - + /*------------------------------------------------------------------------- * Function: old_api * @@ -990,11 +990,11 @@ static int old_api(hid_t fapl) { #ifndef H5_NO_DEPRECATED_SYMBOLS - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group ID */ h5_stat_size_t small_file_size; /* Size of small group file */ h5_stat_size_t large_file_size; /* Size of large group file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; #endif /* H5_NO_DEPRECATED_SYMBOLS */ TESTING("old API routines"); @@ -1049,7 +1049,7 @@ old_api(hid_t fapl) fapl = fapl; SKIPPED(); - puts(" Deprecated API symbols not enabled"); + HDputs(" Deprecated API symbols not enabled"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ return 0; @@ -1057,14 +1057,14 @@ old_api(hid_t fapl) #ifndef H5_NO_DEPRECATED_SYMBOLS error: H5E_BEGIN_TRY { - H5Gclose(gid); - H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; return 1; #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end old_api() */ - + /*------------------------------------------------------------------------- * Function: corrupt_stab_msg * @@ -1136,24 +1136,24 @@ corrupt_stab_msg(void) error: H5E_BEGIN_TRY { - H5Dclose(did); - H5Fclose(fid); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return 1; } /* end corrupt_stab_msg() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test groups + * Purpose: Test groups * - * Return: Success: zero + * Return: Success: zero * - * Failure: non-zero + * Failure: non-zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, November 24, 1998 * * Modifications: @@ -1163,12 +1163,12 @@ error: int main(void) { - hid_t fapl, fapl2; /* File access property list IDs */ - hid_t fcpl, fcpl2; /* File creation property list ID */ - unsigned new_format; /* Whether to use the new format or not */ - const char *env_h5_drvr; /* File Driver value from environment */ - hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ - int nerrors = 0; + hid_t fapl, fapl2; /* File access property list IDs */ + hid_t fcpl, fcpl2; /* File creation property list ID */ + unsigned new_format; /* Whether to use the new format or not */ + const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ + int nerrors = 0; /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -1191,7 +1191,7 @@ main(void) /* Set up file creation property list */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR - + /* Set to use paged aggregation strategy and persisting free-space */ /* Skip testing for multi/split drivers */ if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) < 0) @@ -1241,7 +1241,7 @@ main(void) if(nerrors) goto error; - puts("All symbol table tests passed."); + HDputs("All symbol table tests passed."); /* Cleanup */ if (GetTestCleanup()) { @@ -1253,7 +1253,7 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index 51caa3d..01e2ce1 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -288,20 +288,20 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_addrem_writer [-q] [-f <# of operations between flushing\n"); - printf(" file contents>] [-r ] <# of operations>\n"); - printf("\n"); - printf("<# of operations between flushing file contents> should be 0 (for\n"); - printf("no flushing) or between 1 and (<# of operations> - 1).\n"); - printf("\n"); - printf("<# of operations> must be specified.\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), flushing every 1000 operations\n"); - printf("('-f 1000'), and will generate a random seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_addrem_writer [-q] [-f <# of operations between flushing\n"); + HDprintf(" file contents>] [-r ] <# of operations>\n"); + HDprintf("\n"); + HDprintf("<# of operations between flushing file contents> should be 0 (for\n"); + HDprintf("no flushing) or between 1 and (<# of operations> - 1).\n"); + HDprintf("\n"); + HDprintf("<# of operations> must be specified.\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), flushing every 1000 operations\n"); + HDprintf("('-f 1000'), and will generate a random seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/swmr_common.c b/test/swmr_common.c index a0d79e3..b323769 100644 --- a/test/swmr_common.c +++ b/test/swmr_common.c @@ -73,7 +73,7 @@ unsigned symbol_count[NLEVELS] = {100, 200, 400, 800, 1600}; /* Array of dataset information entries (1 per dataset) */ symbol_info_t *symbol_info[NLEVELS]; - + /*------------------------------------------------------------------------- * Function: choose_dataset * @@ -101,7 +101,7 @@ choose_dataset(void) return &symbol_info[level][offset]; } /* end choose_dataset() */ - + /*------------------------------------------------------------------------- * Function: create_symbol_datatype * @@ -142,7 +142,7 @@ create_symbol_datatype(void) return sym_type_id; } /* end create_symbol_datatype() */ - + /*------------------------------------------------------------------------- * Function: generate_name * @@ -161,7 +161,7 @@ create_symbol_datatype(void) * The dataset's count * * Return: Success: 0 - * + * * Failure: Can't fail * *------------------------------------------------------------------------- @@ -170,13 +170,13 @@ int generate_name(char *name_buf, unsigned level, unsigned count) { HDassert(name_buf); - - sprintf(name_buf, "%u-%04u", level, count); + + HDsprintf(name_buf, "%u-%04u", level, count); return 0; } /* end generate_name() */ - + /*------------------------------------------------------------------------- * Function: generate_symbols * @@ -210,7 +210,7 @@ generate_symbols(void) return 0; } /* end generate_symbols() */ - + /*------------------------------------------------------------------------- * Function: shutdown_symbols * @@ -238,7 +238,7 @@ shutdown_symbols(void) return 0; } /* end shutdown_symbols() */ - + /*------------------------------------------------------------------------- * Function: print_metadata_retries_info * @@ -273,7 +273,7 @@ print_metadata_retries_info(hid_t fid) power = 1; for(j = 0; j < info.nbins; j++) { if(info.retries[i][j]) - HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n", + HDfprintf(stderr, "\t# of retries for %u - %u retries: %u\n", power, (power * 10) - 1, info.retries[i][j]); power *= 10; } /* end for */ diff --git a/test/swmr_generator.c b/test/swmr_generator.c index 23620fb..d986696 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -266,23 +266,23 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_generator [-q] [-s] [-c ]\n"); - printf(" [-i ] [-r ]\n"); - printf("\n"); - printf("NOTE: The random seed option is only used by the sparse test. Other\n"); - printf(" tests specify the random seed as a reader/writer option.\n"); - printf("\n"); - printf(" should be -1 (for no compression) or 0-9\n"); - printf("\n"); - printf(" should be b2 or ea\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), no SWMR_WRITE mode (no '-s' given) no\n"); - printf("compression ('-c -1'), v1 b-tree indexing (-i b1), and will generate a random\n"); - printf("seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_generator [-q] [-s] [-c ]\n"); + HDprintf(" [-i ] [-r ]\n"); + HDprintf("\n"); + HDprintf("NOTE: The random seed option is only used by the sparse test. Other\n"); + HDprintf(" tests specify the random seed as a reader/writer option.\n"); + HDprintf("\n"); + HDprintf(" should be -1 (for no compression) or 0-9\n"); + HDprintf("\n"); + HDprintf(" should be b2 or ea\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), no SWMR_WRITE mode (no '-s' given) no\n"); + HDprintf("compression ('-c -1'), v1 b-tree indexing (-i b1), and will generate a random\n"); + HDprintf("seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } /* end usage() */ diff --git a/test/swmr_reader.c b/test/swmr_reader.c index e181d3a..c994a71 100644 --- a/test/swmr_reader.c +++ b/test/swmr_reader.c @@ -371,19 +371,19 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_reader [-q] [-s <# of seconds to sleep between polling>]\n"); - printf(" [-h <# of common symbols to poll>] [-l <# of random symbols to poll>]\n"); - printf(" [-r ] <# of seconds to test>\n"); - printf("\n"); - printf("<# of seconds to test> must be specified.\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), 1 second between polling ('-s 1'),\n"); - printf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); - printf("and will generate a random seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_reader [-q] [-s <# of seconds to sleep between polling>]\n"); + HDprintf(" [-h <# of common symbols to poll>] [-l <# of random symbols to poll>]\n"); + HDprintf(" [-r ] <# of seconds to test>\n"); + HDprintf("\n"); + HDprintf("<# of seconds to test> must be specified.\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), 1 second between polling ('-s 1'),\n"); + HDprintf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); + HDprintf("and will generate a random seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c index 1fae5e7..b4f0d5b 100644 --- a/test/swmr_remove_reader.c +++ b/test/swmr_remove_reader.c @@ -359,17 +359,17 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_remove_reader [-q] [-s <# of seconds to sleep between\n"); - printf(" polling>] [-h <# of common symbols to poll>] [-l <# of random symbols\n"); - printf(" to poll>] [-r ] <# of seconds to test>\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), 1 second between polling ('-s 1'),\n"); - printf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); - printf("and will generate a random seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_remove_reader [-q] [-s <# of seconds to sleep between\n"); + HDprintf(" polling>] [-h <# of common symbols to poll>] [-l <# of random symbols\n"); + HDprintf(" to poll>] [-r ] <# of seconds to test>\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), 1 second between polling ('-s 1'),\n"); + HDprintf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); + HDprintf("and will generate a random seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index 43743d9..c4f7b6e 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -224,18 +224,18 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_remove_writer [-q] [-o] [-f <# of shrinks between flushing\n"); - printf(" file contents>] [-r ] <# of shrinks>\n"); - printf("\n"); - printf("<# of shrinks between flushing file contents> should be 0 (for no\n"); - printf("flushing) or between 1 and (<# of shrinks> - 1)\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); - printf("flushing every 1000 shrinks ('-f 1000'), and will generate a random seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_remove_writer [-q] [-o] [-f <# of shrinks between flushing\n"); + HDprintf(" file contents>] [-r ] <# of shrinks>\n"); + HDprintf("\n"); + HDprintf("<# of shrinks between flushing file contents> should be 0 (for no\n"); + HDprintf("flushing) or between 1 and (<# of shrinks> - 1)\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); + HDprintf("flushing every 1000 shrinks ('-f 1000'), and will generate a random seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index 3c98f48..cd0ece6 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -326,18 +326,18 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_sparse_reader [-q] [-s <# of seconds to wait for writer>]\n"); - printf(" [-n <# of reads between reopens>] <# of records>\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), 1 second wait ('-s 1') and 1 read\n"); - printf("between reopens ('-r 1')\n"); - printf("\n"); - printf("Note that the # of records *must* be the same as that supplied to\n"); - printf("swmr_sparse_writer\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_sparse_reader [-q] [-s <# of seconds to wait for writer>]\n"); + HDprintf(" [-n <# of reads between reopens>] <# of records>\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), 1 second wait ('-s 1') and 1 read\n"); + HDprintf("between reopens ('-r 1')\n"); + HDprintf("\n"); + HDprintf("Note that the # of records *must* be the same as that supplied to\n"); + HDprintf("swmr_sparse_writer\n"); + HDprintf("\n"); HDexit(1); } /* end usage() */ diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index e46f54c..17d8c61 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -49,7 +49,7 @@ static int add_records(hid_t fid, unsigned verbose, unsigned long nrecords, static void usage(void); - + /*------------------------------------------------------------------------- * Function: open_skeleton * @@ -117,7 +117,7 @@ open_skeleton(const char *filename, unsigned verbose) /* Emit informational message */ if(verbose) - fprintf(stderr, "Opening datasets\n"); + HDfprintf(stderr, "Opening datasets\n"); /* Seed the random number generator with the attribute in the file */ if((aid = H5Aopen(fid, "seed", H5P_DEFAULT)) < 0) @@ -139,7 +139,7 @@ open_skeleton(const char *filename, unsigned verbose) return fid; } - + /*------------------------------------------------------------------------- * Function: add_records * @@ -311,7 +311,7 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Emit informational message */ if(verbose) - fprintf(stderr, "Closing datasets\n"); + HDfprintf(stderr, "Closing datasets\n"); /* Close the datasets */ for(u = 0; u < NLEVELS; u++) @@ -325,18 +325,18 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_sparse_writer [-q] [-f <# of records to write between\n"); - printf(" flushing file contents>] <# of records>\n"); - printf("\n"); - printf("<# of records to write between flushing file contents> should be 0\n"); - printf("(for no flushing) or between 1 and (<# of records> - 1)\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given) and flushing every 1000 records\n"); - printf("('-f 1000')\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_sparse_writer [-q] [-f <# of records to write between\n"); + HDprintf(" flushing file contents>] <# of records>\n"); + HDprintf("\n"); + HDprintf("<# of records to write between flushing file contents> should be 0\n"); + HDprintf("(for no flushing) or between 1 and (<# of records> - 1)\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given) and flushing every 1000 records\n"); + HDprintf("('-f 1000')\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index af4b743..0ee382d 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -337,26 +337,26 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_start_write [-f <# of records to write between flushing file contents>]\n"); - printf(" [-i ] [-c ]\n"); - printf(" [-r ] [-q] <# of records>\n"); - printf("\n"); - printf("<# of records to write between flushing file contents> should be 0\n"); - printf("(for no flushing) or between 1 and (<# of records> - 1).\n"); - printf("\n"); - printf(" should be b2 or ea\n"); - printf("\n"); - printf(" should be -1 (for no compression) or 0-9\n"); - printf("\n"); - printf("<# of records> must be specified.\n"); - printf("\n"); - printf("Defaults to flushing every 10000 records ('-f 10000'),\n"); - printf("v1 b-tree indexing (-i b1), compression ('-c -1'),\n"); - printf("will generate a random seed (no -r given), and verbose (no '-q' given)\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_start_write [-f <# of records to write between flushing file contents>]\n"); + HDprintf(" [-i ] [-c ]\n"); + HDprintf(" [-r ] [-q] <# of records>\n"); + HDprintf("\n"); + HDprintf("<# of records to write between flushing file contents> should be 0\n"); + HDprintf("(for no flushing) or between 1 and (<# of records> - 1).\n"); + HDprintf("\n"); + HDprintf(" should be b2 or ea\n"); + HDprintf("\n"); + HDprintf(" should be -1 (for no compression) or 0-9\n"); + HDprintf("\n"); + HDprintf("<# of records> must be specified.\n"); + HDprintf("\n"); + HDprintf("Defaults to flushing every 10000 records ('-f 10000'),\n"); + HDprintf("v1 b-tree indexing (-i b1), compression ('-c -1'),\n"); + HDprintf("will generate a random seed (no -r given), and verbose (no '-q' given)\n"); + HDprintf("\n"); HDexit(1); } /* usage() */ diff --git a/test/swmr_writer.c b/test/swmr_writer.c index ee7e32e..6df7355 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -277,20 +277,20 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, static void usage(void) { - printf("\n"); - printf("Usage error!\n"); - printf("\n"); - printf("Usage: swmr_writer [-q] [-o] [-f <# of records to write between flushing\n"); - printf(" file contents>] [-r ] <# of records>\n"); - printf("\n"); - printf("<# of records to write between flushing file contents> should be 0\n"); - printf("(for no flushing) or between 1 and (<# of records> - 1).\n"); - printf("\n"); - printf("<# of records> must be specified.\n"); - printf("\n"); - printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); - printf("flushing every 10000 records ('-f 10000'), and will generate a random seed (no -r given).\n"); - printf("\n"); + HDprintf("\n"); + HDprintf("Usage error!\n"); + HDprintf("\n"); + HDprintf("Usage: swmr_writer [-q] [-o] [-f <# of records to write between flushing\n"); + HDprintf(" file contents>] [-r ] <# of records>\n"); + HDprintf("\n"); + HDprintf("<# of records to write between flushing file contents> should be 0\n"); + HDprintf("(for no flushing) or between 1 and (<# of records> - 1).\n"); + HDprintf("\n"); + HDprintf("<# of records> must be specified.\n"); + HDprintf("\n"); + HDprintf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); + HDprintf("flushing every 10000 records ('-f 10000'), and will generate a random seed (no -r given).\n"); + HDprintf("\n"); HDexit(1); } diff --git a/test/tarray.c b/test/tarray.c index eb71ad6..0024746 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -65,7 +65,7 @@ typedef struct void *test_array_alloc_custom(size_t size, void *info); void test_array_free_custom(void *mem, void *info); - + /*------------------------------------------------------------------------- * Function: test_array_atomic_1d * @@ -189,7 +189,7 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ - + /*------------------------------------------------------------------------- * Function: test_array_funcs * @@ -252,7 +252,7 @@ test_array_funcs(void) CHECK(ret, FAIL, "H5Tclose"); } /* end test_array_funcs() */ - + /*------------------------------------------------------------------------- * Function: test_array_atomic_3d * @@ -381,7 +381,7 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ - + /*------------------------------------------------------------------------- * Function: test_array_array_atomic * @@ -540,7 +540,7 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_atomic * @@ -747,7 +747,7 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_compound_array * @@ -1006,7 +1006,7 @@ test_array_compound_array(void) ** allocated. ** ****************************************************************/ - + /*------------------------------------------------------------------------- * Function: test_array_alloc_custom * @@ -1045,7 +1045,7 @@ test_array_alloc_custom(size_t size, void *info) return ret_value; } /* end test_array_alloc_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_free_custom * @@ -1081,7 +1081,7 @@ test_array_free_custom(void *_mem, void *info) return; } /* end test_array_free_custom() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_atomic * @@ -1296,7 +1296,7 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ - + /*------------------------------------------------------------------------- * Function: test_array_vlen_array * @@ -1551,7 +1551,7 @@ test_array_vlen_array(void) } /* end test_array_vlen_array() */ - + /*------------------------------------------------------------------------- * Function: test_array_bkg * @@ -1855,7 +1855,7 @@ test_array_bkg(void) HDfree(dtsinfo); } /* end test_array_bkg() */ - + /*------------------------------------------------------------------------- * Function: test_compat * @@ -2146,11 +2146,11 @@ test_compat(void) CHECK_I(ret, "H5Fclose"); } /* end if */ else - printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); + HDprintf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); } /* end test_compat() */ - + /*------------------------------------------------------------------------- * Function: test_array * @@ -2183,7 +2183,7 @@ test_array(void) } /* end test_array() */ - + /*------------------------------------------------------------------------- * Function: cleanup_array * diff --git a/test/tattr.c b/test/tattr.c index c7a2c23..50704c6 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -174,7 +174,7 @@ static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo, static hid_t dcpl_g = H5P_DEFAULT; - + /**************************************************************** ** ** test_attr_basic_write(): Test basic H5A (attribute) code. @@ -414,7 +414,7 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_basic_write() */ - + /**************************************************************** ** ** test_attr_basic_read(): Test basic H5A (attribute) code. @@ -505,7 +505,7 @@ test_attr_basic_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_basic_read() */ - + /**************************************************************** ** ** test_attr_flush(): Test H5A (attribute) code for performing @@ -572,7 +572,7 @@ test_attr_flush(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_flush() */ - + /**************************************************************** ** ** test_attr_plist(): Test Attribute Creation Property Lists @@ -696,7 +696,7 @@ test_attr_plist(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_plist() */ - + /**************************************************************** ** ** test_attr_compound_write(): Test H5A (attribute) code. @@ -785,7 +785,7 @@ test_attr_compound_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_compound_write() */ - + /**************************************************************** ** ** test_attr_compound_read(): Test basic H5A (attribute) code. @@ -907,8 +907,8 @@ test_attr_compound_read(hid_t fapl) for(i = 0; i < ATTR4_DIM1; i++) for(j = 0; j < ATTR4_DIM2; j++) if(HDmemcmp(&attr_data4[i][j], &read_data4[i][j], sizeof(struct attr4_struct))) { - printf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); - printf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); + HDprintf("%d: attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n", __LINE__, i, j, attr_data4[i][j].i, i, j, read_data4[i][j].i); + HDprintf("%d: attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n", __LINE__, i, j, attr_data4[i][j].d, i, j, read_data4[i][j].d); TestErrPrintf("%d: attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n", __LINE__, i, j, attr_data4[i][j].c, i, j, read_data4[i][j].c); } /* end if */ @@ -935,7 +935,7 @@ test_attr_compound_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_compound_read() */ - + /**************************************************************** ** ** test_attr_scalar_write(): Test scalar H5A (attribute) writing code. @@ -1001,7 +1001,7 @@ test_attr_scalar_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_scalar_write() */ - + /**************************************************************** ** ** test_attr_scalar_read(): Test scalar H5A (attribute) reading code. @@ -1045,7 +1045,7 @@ test_attr_scalar_read(hid_t fapl) /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(rdata, attr_data5)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Aread", (double)attr_data5, (double)rdata, (int)__LINE__, __FILE__); /* Get the attribute's dataspace */ @@ -1072,7 +1072,7 @@ test_attr_scalar_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_scalar_read() */ - + /**************************************************************** ** ** test_attr_mult_write(): Test basic H5A (attribute) code. @@ -1193,7 +1193,7 @@ test_attr_mult_write(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_mult_write() */ - + /**************************************************************** ** ** test_attr_mult_read(): Test basic H5A (attribute) code. @@ -1415,7 +1415,7 @@ test_attr_mult_read(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_mult_read() */ - + /**************************************************************** ** ** attr_op1(): Attribute operator @@ -1455,7 +1455,7 @@ attr_op1(hid_t H5_ATTR_UNUSED loc_id, const char *name, const H5A_info_t H5_ATTR return(ret); } /* end attr_op1() */ - + /**************************************************************** ** ** test_attr_iterate(): Test H5A (attribute) iterator code. @@ -1527,7 +1527,7 @@ test_attr_iterate(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_iterate() */ - + /**************************************************************** ** ** test_attr_delete(): Test H5A (attribute) code for deleting objects. @@ -1647,7 +1647,7 @@ test_attr_delete(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_delete() */ - + /**************************************************************** ** ** test_attr_dtype_shared(): Test H5A (attribute) code for using @@ -1823,7 +1823,7 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dtype_shared() */ - + /**************************************************************** ** ** test_attr_duplicate_ids(): Test operations with more than @@ -2068,7 +2068,7 @@ test_attr_duplicate_ids(hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_duplicate_ids() */ - + /**************************************************************** ** ** test_attr_dense_verify(): Test basic H5A (attribute) code. @@ -2091,7 +2091,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) /* Re-open all the attributes by name and verify the data */ for(u = 0; u < max_attr; u++) { /* Open attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Aopen(loc_id, attrname, H5P_DEFAULT); CHECK(attr, FAIL, "H5Aopen"); @@ -2115,7 +2115,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) CHECK(attr, FAIL, "H5Aopen_by_idx"); /* Verify Name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); name_len = H5Aget_name(attr, (size_t)ATTR_NAME_LEN, check_name); VERIFY(name_len, HDstrlen(attrname), "H5Aget_name"); if(HDstrcmp(check_name, attrname)) @@ -2138,7 +2138,7 @@ test_attr_dense_verify(hid_t loc_id, unsigned max_attr) return(-1); } /* test_attr_dense_verify() */ - + /**************************************************************** ** ** test_attr_dense_create(): Test basic H5A (attribute) code. @@ -2214,7 +2214,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2233,7 +2233,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2274,7 +2274,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_create() */ - + /**************************************************************** ** ** test_attr_dense_open(): Test basic H5A (attribute) code. @@ -2354,7 +2354,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2377,7 +2377,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) /* Add one more attribute, to push into "dense" storage */ /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2418,7 +2418,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_open() */ - + /**************************************************************** ** ** test_attr_dense_delete(): Test basic H5A (attribute) code. @@ -2510,7 +2510,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2556,7 +2556,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) /* Delete attributes until the attributes revert to compact storage again */ for(u--; u >= min_dense; u--) { /* Delete attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2570,7 +2570,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) VERIFY(is_dense, TRUE, "H5O__is_attr_dense_test"); /* Delete one more attribute, which should cause reversion to compact storage */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2583,7 +2583,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "test_attr_dense_verify"); /* Delete another attribute, to verify deletion in compact storage */ - sprintf(attrname, "attr %02u", (u - 1)); + HDsprintf(attrname, "attr %02u", (u - 1)); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -2612,7 +2612,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_delete() */ - + /**************************************************************** ** ** test_attr_dense_rename(): Test basic H5A (attribute) code. @@ -2706,7 +2706,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Acreate2"); @@ -2719,7 +2719,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Rename attribute */ - sprintf(new_attrname, "new attr %02u", u); + HDsprintf(new_attrname, "new attr %02u", u); /* Rename attribute */ ret = H5Arename_by_name(fid, DSET1_NAME, attrname, new_attrname, H5P_DEFAULT); @@ -2773,7 +2773,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) unsigned value; /* Attribute value */ /* Open attribute */ - sprintf(attrname, "new attr %02u", u); + HDsprintf(attrname, "new attr %02u", u); attr = H5Aopen(dataset, attrname, H5P_DEFAULT); CHECK(attr, H5I_INVALID_HID, "H5Aopen"); @@ -2804,7 +2804,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_rename() */ - + /**************************************************************** ** ** test_attr_dense_unlink(): Test basic H5A (attribute) code. @@ -2891,7 +2891,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) /* Add attributes, until well into dense storage */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -2948,7 +2948,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_unlink() */ - + /**************************************************************** ** ** test_attr_dense_limits(): Test basic H5A (attribute) code. @@ -3035,7 +3035,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3056,7 +3056,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3088,7 +3088,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3118,7 +3118,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_dense_limits() */ - + /**************************************************************** ** ** test_attr_dense_dup_ids(): Test operations with multiple ID @@ -3196,7 +3196,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3219,7 +3219,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(sid2, FAIL, "H5Screate_simple"); /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3507,7 +3507,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Delete a few attributes until the storage switches to compact */ for(u = min_dense-1; u <= max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); add_attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(add_attr, FAIL, "H5Acreate2"); @@ -3577,7 +3577,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) /* Add attributes, until just before converting to dense storage */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(gid1, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3646,7 +3646,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_dense_dup_ids() */ - + /**************************************************************** ** ** test_attr_big(): Test basic H5A (attribute) code. @@ -3744,7 +3744,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3763,7 +3763,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3782,7 +3782,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 2; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); if(low == H5F_LIBVER_LATEST) { CHECK(attr, FAIL, "H5Acreate2"); @@ -3806,7 +3806,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Create attribute */ u = 3; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(dataset, attrname, H5T_NATIVE_UINT, big_sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -3829,7 +3829,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 1; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3844,7 +3844,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 3; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3859,7 +3859,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 2; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3874,7 +3874,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) /* Delete attribute */ u = 0; - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -3921,7 +3921,7 @@ test_attr_big(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_big() */ - + /**************************************************************** ** ** test_attr_null_space(): Test basic H5A (attribute) code. @@ -4139,7 +4139,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) VERIFY(filesize, empty_filesize, "h5_get_file_size"); } /* test_attr_null_space() */ - + /**************************************************************** ** ** test_attr_deprec(): Test basic H5A (attribute) code. @@ -4247,7 +4247,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* test_attr_deprec() */ - + /**************************************************************** ** ** test_attr_many(): Test basic H5A (attribute) code. @@ -4284,7 +4284,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create many attributes */ for(u = 0; u < nattr; u++) { - sprintf(attrname, "a-%06u", u); + HDsprintf(attrname, "a-%06u", u); exists = H5Aexists(gid, attrname); VERIFY(exists, FALSE, "H5Aexists"); @@ -4337,7 +4337,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) for(u = 0; u < nattr; u++) { unsigned value; /* Attribute value */ - sprintf(attrname, "a-%06u", u); + HDsprintf(attrname, "a-%06u", u); exists = H5Aexists(gid, attrname); VERIFY(exists, TRUE, "H5Aexists"); @@ -4376,7 +4376,7 @@ test_attr_many(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_many() */ - + /**************************************************************** ** ** test_attr_corder_create_empty(): Test basic H5A (attribute) code. @@ -4497,7 +4497,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_basic() */ - + /**************************************************************** ** ** test_attr_corder_create_compact(): Test basic H5A (attribute) code. @@ -4587,7 +4587,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4677,7 +4677,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); @@ -4700,7 +4700,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_compact() */ - + /**************************************************************** ** ** test_attr_corder_create_dense(): Test basic H5A (attribute) code. @@ -4792,7 +4792,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4815,7 +4815,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) } /* end for */ /* Create another attribute, to push into dense storage */ - sprintf(attrname, "attr %02u", max_compact); + HDsprintf(attrname, "attr %02u", max_compact); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -4909,7 +4909,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) H5A_info_t ainfo; /* Attribute information */ /* Retrieve information for attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Aget_info_by_name(my_dataset, ".", attrname, &ainfo, H5P_DEFAULT); CHECK(ret, FAIL, "H5Aget_info_by_name"); @@ -4932,7 +4932,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Fclose"); } /* test_attr_corder_create_dense() */ - + /**************************************************************** ** ** test_attr_corder_create_reopen(): Test basic H5A (attribute) code. @@ -5040,7 +5040,7 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_create_reopen() */ - + /**************************************************************** ** ** test_attr_corder_transition(): Test basic H5A (attribute) code. @@ -5185,7 +5185,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Create several attributes, but keep storage in compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5208,7 +5208,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Create another attribute, to push into dense storage */ - sprintf(attrname, "attr %02u", max_compact); + HDsprintf(attrname, "attr %02u", max_compact); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5236,7 +5236,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5256,7 +5256,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ - sprintf(attrname, "attr %02u", (min_dense - 1)); + HDsprintf(attrname, "attr %02u", (min_dense - 1)); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5272,7 +5272,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5360,7 +5360,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete several attributes from object, until attribute storage resumes compact form */ for(u = max_compact; u >= min_dense; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5380,7 +5380,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) } /* end for */ /* Delete another attribute, to push attribute storage into compact form */ - sprintf(attrname, "attr %02u", (min_dense - 1)); + HDsprintf(attrname, "attr %02u", (min_dense - 1)); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); @@ -5396,7 +5396,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Re-add attributes to get back into dense form */ for(u = (min_dense - 1); u < (max_compact + 1); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5425,11 +5425,11 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) /* Delete all attributes */ for(u = max_compact; u > 0; u--) { - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); } /* end for */ - sprintf(attrname, "attr %02u", 0); + HDsprintf(attrname, "attr %02u", 0); ret = H5Adelete(my_dataset, attrname); CHECK(ret, FAIL, "H5Adelete"); } /* end for */ @@ -5451,7 +5451,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_transition() */ - + /**************************************************************** ** ** test_attr_corder_delete(): Test basic H5A (attribute) code. @@ -5571,7 +5571,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) /* Create attributes, until attribute storage is in dense form */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5657,7 +5657,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_corder_delete() */ - + /*------------------------------------------------------------------------- * Function: attr_info_by_idx_check * @@ -5804,7 +5804,7 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, return(-1); } /* end attr_info_by_idx_check() */ - + /**************************************************************** ** ** test_attr_info_by_idx(): Test basic H5A (attribute) code. @@ -5912,7 +5912,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -5949,7 +5949,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6019,7 +6019,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_info_by_idx() */ - + /*************************************************************** ** ** test_attr_info_null_info_pointer(): A test to ensure that @@ -6078,7 +6078,7 @@ test_attr_info_null_info_pointer(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - + /*************************************************************** ** ** test_attr_rename_invalid_name(): A test to ensure that @@ -6167,7 +6167,7 @@ test_attr_rename_invalid_name(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - + /*************************************************************** ** ** test_attr_get_name_invalid_buf(): A test to ensure that @@ -6221,7 +6221,7 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) CHECK(err_ret, FAIL, "H5Fclose"); } - + /**************************************************************** ** ** test_attr_delete_by_idx(): Test basic H5A (attribute) code. @@ -6357,7 +6357,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6429,9 +6429,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", (u + 1)); + HDsprintf(attrname, "attr %02u", (u + 1)); else - sprintf(attrname, "attr %02u", (max_compact - (u + 2))); + HDsprintf(attrname, "attr %02u", (max_compact - (u + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6467,7 +6467,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6554,9 +6554,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", (u + 1)); + HDsprintf(attrname, "attr %02u", (u + 1)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - (u + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6600,7 +6600,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, to push into dense form */ for(u = 0; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -6665,9 +6665,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", ((u * 2) + 1)); + HDsprintf(attrname, "attr %02u", ((u * 2) + 1)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 2))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6714,9 +6714,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE); ret = (herr_t)H5Aget_name_by_idx(my_dataset, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); if(order == H5_ITER_INC) - sprintf(attrname, "attr %02u", ((u * 2) + 3)); + HDsprintf(attrname, "attr %02u", ((u * 2) + 3)); else - sprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4))); + HDsprintf(attrname, "attr %02u", ((max_compact * 2) - ((u * 2) + 4))); ret = HDstrcmp(attrname, tmpname); VERIFY(ret, 0, "H5Aget_name_by_idx"); } /* end for */ @@ -6758,7 +6758,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_delete_by_idx() */ - + /**************************************************************** ** ** attr_iterate2_cb(): Revised attribute operator @@ -6806,7 +6806,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end if */ /* Verify name of link */ - sprintf(attrname, "attr %02u", (unsigned)my_info.corder); + HDsprintf(attrname, "attr %02u", (unsigned)my_info.corder); if(HDstrcmp(attr_name, attrname)) return(H5_ITER_ERROR); @@ -6832,7 +6832,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); } /* end attr_iterate2_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS - + /**************************************************************** ** ** attr_iterate1_cb(): Attribute operator @@ -6845,7 +6845,7 @@ attr_iterate1_cb(hid_t loc_id, const char *attr_name, void *_op_data) } /* end attr_iterate1_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- * Function: attr_iterate2_fail_cb * @@ -6867,7 +6867,7 @@ attr_iterate2_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED * return(H5_ITER_ERROR); } /* end attr_iterate2_fail_cb() */ - + /*------------------------------------------------------------------------- * Function: attr_iterate_check * @@ -7167,7 +7167,7 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_iterate_check() */ - + /**************************************************************** ** ** test_attr_iterate2(): Test basic H5A (attribute) code. @@ -7320,7 +7320,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7390,7 +7390,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7476,7 +7476,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) HDfree(visited); } /* test_attr_iterate2() */ - + /*------------------------------------------------------------------------- * Function: attr_open_by_idx_check * @@ -7536,7 +7536,7 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, return(-1); } /* end attr_open_by_idx_check() */ - + /**************************************************************** ** ** test_attr_open_by_idx(): Test basic H5A (attribute) code. @@ -7671,7 +7671,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7729,7 +7729,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -7803,7 +7803,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_idx() */ - + /*------------------------------------------------------------------------- * Function: attr_open_check * @@ -7834,7 +7834,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, /* Open each attribute on object by index and check that it's the correct one */ for(u = 0; u < max_attrs; u++) { /* Open the attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr_id = H5Aopen(obj_id, attrname, H5P_DEFAULT); CHECK(attr_id, FAIL, "H5Aopen"); @@ -7889,7 +7889,7 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, return(-1); } /* end attr_open_check() */ - + /**************************************************************** ** ** test_attr_open_by_name(): Test basic H5A (attribute) code. @@ -8004,7 +8004,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8071,7 +8071,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate2(my_dataset, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate2"); @@ -8149,7 +8149,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Sclose"); } /* test_attr_open_by_name() */ - + /**************************************************************** ** ** test_attr_create_by_name(): Test basic H5A (attribute) code. @@ -8253,7 +8253,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create attributes, up to limit of compact form */ for(u = 0; u < max_compact; u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); @@ -8310,7 +8310,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) /* Create more attributes, to push into dense form */ for(u = max_compact; u < (max_compact * 2); u++) { /* Create attribute */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); attr = H5Acreate_by_name(fid, dsetname, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(attr, FAIL, "H5Acreate_by_name"); @@ -8534,7 +8534,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -8870,7 +8870,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -8977,7 +8977,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) /* Create new attribute name */ - sprintf(attrname2, "new attr %02u", u); + HDsprintf(attrname2, "new attr %02u", u); /* Change second dataset's attribute's name */ ret = H5Arename_by_name(fid, DSET2_NAME, attrname, attrname2, H5P_DEFAULT); @@ -9321,7 +9321,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -9431,7 +9431,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) /* Delete attributes from second dataset */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Delete second dataset's attribute */ ret = H5Adelete_by_name(fid, DSET2_NAME, attrname, H5P_DEFAULT); @@ -9695,7 +9695,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Add attributes to each dataset, until after converting to dense storage */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Alternate between creating "small" & "big" attributes */ if(u % 2) { @@ -9822,7 +9822,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) /* Check ref count on attributes of first dataset */ for(u = 0; u < max_compact * 2; u++) { /* Create attribute name */ - sprintf(attrname, "attr %02u", u); + HDsprintf(attrname, "attr %02u", u); /* Open attribute on first dataset */ attr = H5Aopen(dataset, attrname, H5P_DEFAULT); @@ -10097,7 +10097,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) /* Create attributes on group */ for (i=0; i]\n"); - printf("\t-h\tShow this page and version information\n"); - printf("\t-t: Test by changing (adding 1 to) the to trigger\n"); - printf("\t\t the warning. can be:\n"); - printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); - printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); - printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); + HDprintf("Usage: " progname " [-h] [-t]\n"); + HDprintf("\t-h\tShow this page and version information\n"); + HDprintf("\t-t: Test by changing (adding 1 to) the to trigger\n"); + HDprintf("\t\t the warning. can be:\n"); + HDprintf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); + HDprintf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); + HDprintf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); } @@ -60,36 +60,36 @@ parse(int ac, char **av) char *pt; while (--ac > 0){ - pt = *(++av); - if (*pt != '-') { - fprintf(stderr, "Unknown option(%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - }else{ - switch(*(++pt)) { - case 't': /* option -t */ - switch(*(++pt)) { - case 'M': - major++; - break; - case 'm': - minor++; - break; - case 'r': - release++; - break; - default: - fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - } - break; - case 'h': /* help page */ - showhelp(); - exit(EXIT_SUCCESS); - default: - fprintf(stderr, "Unknown option(%s). Aborted.\n", *av); - exit(EXIT_FAILURE); - } - } + pt = *(++av); + if (*pt != '-') { + HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + }else{ + switch(*(++pt)) { + case 't': /* option -t */ + switch(*(++pt)) { + case 'M': + major++; + break; + case 'm': + minor++; + break; + case 'r': + release++; + break; + default: + HDfprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + break; + case 'h': /* help page */ + showhelp(); + HDexit(EXIT_SUCCESS); + default: + HDfprintf(stderr, "Unknown option(%s). Aborted.\n", *av); + HDexit(EXIT_FAILURE); + } + } } } diff --git a/test/testframe.c b/test/testframe.c index 97b2d1f..a096f36 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -74,12 +74,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con { /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { - printf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", + HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", TheDescr, MAXTESTDESC); exit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { - printf("Test name too long, increase MAXTESTNAME(%d).\n", + HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", MAXTESTNAME); exit(EXIT_FAILURE); } /* end if */ @@ -91,7 +91,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Reallocate array */ if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) { - printf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc); + HDprintf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc); exit(EXIT_FAILURE); } /* end if */ @@ -559,9 +559,9 @@ TestErrPrintf(const char *format, ...) num_errs++; /* Print the requested information */ - va_start(arglist, format); - ret_value = vprintf(format, arglist); - va_end(arglist); + HDva_start(arglist, format); + ret_value = HDvprintf(format, arglist); + HDva_end(arglist); /* Return the length of the string produced (like printf() does) */ return ret_value; @@ -609,7 +609,7 @@ void SetTest(const char *testname, int action) break; default: /* error */ - printf("*** ERROR: Unknown action (%d) for SetTest\n", action); + HDprintf("*** ERROR: Unknown action (%d) for SetTest\n", action); break; } } diff --git a/test/tfile.c b/test/tfile.c index 0fc391e..40c2d4b 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1098,14 +1098,14 @@ test_get_obj_ids(void) /* creates NGROUPS groups under the root group */ for(m = 0; m < NGROUPS; m++) { - sprintf(gname, "group%d", m); + HDsprintf(gname, "group%d", m); gid[m] = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid[m], FAIL, "H5Gcreate2"); } /* create NDSETS datasets under the root group */ for(n = 0; n < NDSETS; n++) { - sprintf(dname, "dataset%d", n); + HDsprintf(dname, "dataset%d", n); dset[n] = H5Dcreate2(fid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -1166,7 +1166,7 @@ test_get_obj_ids(void) /* Open NDSETS datasets under the root group */ for(n = 0; n < NDSETS; n++) { - sprintf(dname, "dataset%d", n); + HDsprintf(dname, "dataset%d", n); dset[n] = H5Dopen2(fid, dname, H5P_DEFAULT); CHECK(dset[n], FAIL, "H5Dcreate2"); } @@ -4365,7 +4365,7 @@ test_file_freespace(const char *env_h5_drvr) /* Create datasets in file */ for(u = 0; u < 10; u++) { - sprintf(name, "Dataset %u", u); + HDsprintf(name, "Dataset %u", u); dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); @@ -4388,7 +4388,7 @@ test_file_freespace(const char *env_h5_drvr) /* Delete datasets in file */ for(k = 9; k >= 0; k--) { - sprintf(name, "Dataset %u", (unsigned)k); + HDsprintf(name, "Dataset %u", (unsigned)k); ret = H5Ldelete(file, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ @@ -4516,7 +4516,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Create datasets in file */ for(u = 0; u < 10; u++) { - sprintf(name, "Dataset %u", u); + HDsprintf(name, "Dataset %u", u); dset = H5Dcreate2(file, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); @@ -4534,7 +4534,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) /* Delete odd-numbered datasets in file */ for(u = 0; u < 10; u++) { - sprintf(name, "Dataset %u", u); + HDsprintf(name, "Dataset %u", u); if(u % 2) { ret = H5Ldelete(file, name, H5P_DEFAULT); CHECK(ret, FAIL, "H5Ldelete"); @@ -5393,13 +5393,13 @@ test_libver_bounds_open(void) * This test is copied from the user test program: copy10.c. * (See attached programs in the jira issue.) * - * The source file used in the test is generated by the user test - * program "fill18.c" with the 1.8 library. The file is created + * The source file used in the test is generated by the user test + * program "fill18.c" with the 1.8 library. The file is created * with the latest format and the dataset created in the file * has version 3 fill value message (latest). * * The test creates the destination file with (v18, v18) version bounds. - * H5Ocopy() should succeed in copying the dataset in the source file + * H5Ocopy() should succeed in copying the dataset in the source file * to the destination file. * * Return: Success: 0 @@ -5420,7 +5420,7 @@ test_libver_bounds_copy(void) MESSAGE(5, ("Testing H5Ocopy a dataset in a 1.8 library file to a 1.10 library file\n")); /* Get the test file name */ - src_fname = H5_get_srcdir_filename(SRC_FILE); + src_fname = H5_get_srcdir_filename(SRC_FILE); /* Open the source test file */ src_fid = H5Fopen(src_fname, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -5696,7 +5696,7 @@ test_libver_bounds_super(hid_t fapl) ** File creation | succeed | ** |______________________________________________________________________________| ** -** Creating a file with SWMR-write access +** Creating a file with SWMR-write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -7409,7 +7409,7 @@ test_incr_filesize(void) /* Create datasets in file */ for(u = 0; u < 10; u++) { - sprintf(name, "Dataset %u", u); + HDsprintf(name, "Dataset %u", u); dset = H5Dcreate2(fid, name, H5T_STD_U32LE, dspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); CHECK(dset, FAIL, "H5Dcreate2"); @@ -7439,7 +7439,7 @@ test_incr_filesize(void) /* Get the stored EOA */ ret = H5Fget_eoa(fid, &stored_eoa); CHECK(ret, FAIL, "H5Fget_eoa"); - + /* Verify the stored EOA is the same as filesize */ VERIFY(filesize, stored_eoa, "file size"); @@ -7898,7 +7898,7 @@ test_file(void) } /* test_file() */ - + /*------------------------------------------------------------------------- * Function: cleanup_file * diff --git a/test/tgenprop.c b/test/tgenprop.c index 151913c..7ca7dca 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -678,7 +678,7 @@ test_genprop_basic_list(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__); @@ -770,7 +770,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__); @@ -783,7 +783,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Delete permanent property */ @@ -820,7 +820,7 @@ test_genprop_basic_list_prop(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Close list */ @@ -1225,7 +1225,7 @@ test_genprop_list_callback(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_FLT_ABS_EQUAL(prop2_value,*PROP2_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", (double)*PROP2_DEF_VALUE, (double)prop2_value, (int)__LINE__, __FILE__); /* Check values of temporary properties (set with regular values) */ @@ -1240,7 +1240,7 @@ test_genprop_list_callback(void) CHECK_I(ret, "H5Pget"); /* Verify the floating-poing value in this way to avoid compiler warning. */ if(!H5_DBL_ABS_EQUAL(prop4_value, *PROP4_DEF_VALUE)) - printf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", + HDprintf("*** UNEXPECTED VALUE from %s should be %f, but is %f at line %4d in %s\n", "H5Pget", *PROP4_DEF_VALUE, prop4_value, (int)__LINE__, __FILE__); /* Verify get callback information for properties tracked */ diff --git a/test/th5o.c b/test/th5o.c index 099bb92..93a12e8 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -13,7 +13,7 @@ /*********************************************************** * -* Test program: th5o +* Test program: th5o * * Test public H5O functions for accessing * @@ -30,7 +30,7 @@ #define TEST6_DIM1 100 #define TEST6_DIM2 100 - + /**************************************************************** ** ** test_h5o_open(): Test H5Oopen function. @@ -140,7 +140,7 @@ test_h5o_open(void) } /* test_h5o_open() */ - + /**************************************************************** ** ** test_h5o_close(): Test H5Oclose function. @@ -230,7 +230,7 @@ test_h5o_close(void) CHECK(ret, FAIL, "H5Fclose"); } - + /**************************************************************** ** ** test_h5o_open_by_addr(): Test H5Oopen_by_addr function. @@ -367,7 +367,7 @@ test_h5o_open_by_addr(void) VERIFY(dtype, FAIL, "H5Oopen_by_addr"); } /* test_h5o_open_by_addr() */ - + /**************************************************************** ** ** test_h5o_refcount(): Test H5O refcounting functions. @@ -562,7 +562,7 @@ test_h5o_refcount(void) CHECK(ret, FAIL, "H5Fclose"); } /* test_h5o_refcount() */ - + /**************************************************************** ** ** test_h5o_plist(): Test object creation properties @@ -756,7 +756,7 @@ test_h5o_plist(void) CHECK(ret, FAIL, "H5Pclose"); } /* test_h5o_plist() */ - + /**************************************************************** ** ** test_h5o_link(): Test creating link to object @@ -910,7 +910,7 @@ test_h5o_link(void) HDfree(rdata); } /* end test_h5o_link() */ - + /**************************************************************** ** ** test_h5o_comment(): Test H5Oset(get)_comment functions. @@ -1083,7 +1083,7 @@ test_h5o_comment(void) } /* test_h5o_comment() */ - + /**************************************************************** ** ** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions. @@ -1242,7 +1242,7 @@ test_h5o_comment_by_name(void) } /* test_h5o_comment_by_name() */ - + /**************************************************************** ** ** test_h5o_getinfo_same_file(): Test that querying the object info for @@ -1353,7 +1353,7 @@ test_h5o_getinfo_same_file(void) /**************************************************************** ** ** visit_obj_cb(): -** This is the callback function invoked by H5Ovisit1() in +** This is the callback function invoked by H5Ovisit1() in ** test_h5o_getinfo_visit(): ** --Verify that the object info returned to the callback ** function is the same as H5Oget_info2(). @@ -1382,10 +1382,10 @@ visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1, return(H5_ITER_CONT); } /* end visit_obj_cb() */ - + /**************************************************************** ** -** test_h5o_getinfo_visit(): +** test_h5o_getinfo_visit(): ** Verify that the object info returned via H5Oget_info1() ** and H5Oget_info2() are the same. ** Verify that the object info retrieved via H5Ovisit1() is @@ -1419,7 +1419,7 @@ test_h5o_getinfo_visit(void) /* Attach 10 attributes to "group1" */ for(j = 0; j <10; j++) { /* Create the attribute name */ - sprintf(attrname, "attr%u", j); + HDsprintf(attrname, "attr%u", j); /* Create the attribute */ aid = H5Acreate2(gid1, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); CHECK(aid, FAIL, "H5Acreate2"); @@ -1479,7 +1479,7 @@ test_h5o_getinfo_visit(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /**************************************************************** ** ** test_h5o(): Main H5O (generic object) testing routine. @@ -1505,7 +1505,7 @@ test_h5o(void) #endif } /* test_h5o() */ - + /*------------------------------------------------------------------------- * Function: cleanup_h5o * diff --git a/test/th5s.c b/test/th5s.c index f0365de..16e20b1 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -214,7 +214,7 @@ test_h5s_basic(void) CHECK_I(ret, "H5Fclose"); } else - printf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile); + HDprintf("***cannot open the pre-created H5S_MAX_RANK test file (%s)\n", testfile); } /* Verify that incorrect dimensions don't work */ @@ -683,7 +683,7 @@ test_h5s_zero_dim(void) for(j=0; j 10 ? 1 : 0); default: - printf("invalid iteration command"); + HDprintf("invalid iteration command"); return(-1); } /* end switch */ } /* end aiter_cb() */ @@ -416,7 +416,7 @@ static void test_iter_attr(hid_t fapl, hbool_t new_format) CHECK(dataset, FAIL, "H5Dcreate2"); for(i = 0; i < NATTR; i++) { - sprintf(name, "Attribute %02d", i); + HDsprintf(name, "Attribute %02d", i); attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT); CHECK(attribute, FAIL, "H5Acreate2"); @@ -621,7 +621,7 @@ test_iter_group_large(hid_t fapl) /* Create a bunch of groups */ for(i = 0; i < ITER_NGROUPS; i++) { - sprintf(gname, "Group_%d", i); + HDsprintf(gname, "Group_%d", i); /* Add the name to the list of objects in the root group */ HDstrcpy(names[i].name, gname); diff --git a/test/tmisc.c b/test/tmisc.c index fef94dd..5225333 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -981,13 +981,13 @@ test_misc5(void) /* Verify the correct information was read in */ for(i=0; i<(buf.len); i++) { - /* printf("[%d]=%d\n",i, ((misc5_struct1 *)(buf.p))[i].st1_el1); */ + /* HDprintf("[%d]=%d\n",i, ((misc5_struct1 *)(buf.p))[i].st1_el1); */ VERIFY(((misc5_struct1 *)(buf.p))[i].st1_el1,MISC5_DBGELVAL1,"H5Dread"); for(j=0; j<(((misc5_struct1 *)(buf.p)) [i].st1_el2.len); j++) { - /* printf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1); */ + /* HDprintf(" [%d]=%d\n",j, ((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1); */ VERIFY(((misc5_struct2 *)(((misc5_struct1 *) (buf.p))[i].st1_el2.p))[j].st2_el1, MISC5_DBGELVAL2,"H5Dread"); for(k=0; k<(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.len); k++) { - /* printf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */ + /* HDprintf(" [%d]=%d\n",k, ((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1); */ VERIFY(((misc5_struct3 *)(((misc5_struct2 *) (((misc5_struct1 *)(buf.p))[i]. st1_el2.p))[j].st2_el2.p))[k].st3_el1, MISC5_DBGELVAL3,"H5Dread"); } /* end for */ } @@ -1064,7 +1064,7 @@ test_misc6(void) /* Loop through adding attributes to each dataset */ for(u = 0; u < MISC6_NUMATTR; u++) { /* Create name for attribute */ - sprintf(attr_name, "Attr#%u", u); + HDsprintf(attr_name, "Attr#%u", u); /* Open the file */ loc_id = H5Fopen(MISC6_FILE, H5F_ACC_RDWR, H5P_DEFAULT); @@ -2953,7 +2953,7 @@ test_misc18(void) /* Loop creating attributes on each dataset, flushing them to the file each time */ for(u = 0; u < 10; u++) { /* Set up attribute name */ - sprintf(attr_name, "Attr %u", u); + HDsprintf(attr_name, "Attr %u", u); /* Create & close attribute on first dataset */ aid = H5Acreate2(did1, attr_name, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT); @@ -4761,7 +4761,7 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25a() */ - + /**************************************************************** ** ** test_misc25b(): Exercise null object header message merge bug @@ -4797,7 +4797,7 @@ test_misc25b(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25b() */ - + /**************************************************************** ** ** test_misc25c(): Exercise another null object header message merge bug. @@ -4931,7 +4931,7 @@ test_misc25c(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc25c() */ - + /**************************************************************** ** ** test_misc26(): Regression test: ensure that copying filter @@ -5017,7 +5017,7 @@ test_misc26(void) CHECK_I(ret, "H5Pclose"); } - + /**************************************************************** ** ** test_misc27(): Ensure that objects with incorrect # of object @@ -5062,7 +5062,7 @@ test_misc27(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_misc27() */ - + /**************************************************************** ** ** test_misc28(): Ensure that the dataset chunk cache will hold @@ -5239,7 +5239,7 @@ test_misc28(void) CHECK_I(ret, "H5Pclose"); } /* end test_misc28() */ - + /**************************************************************** ** ** test_misc29(): Ensure that speculative metadata reads don't @@ -5288,7 +5288,7 @@ test_misc30_get_info(hid_t loc_id) return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL); } - + /**************************************************************** ** ** test_misc30(): Exercise local heap code that loads prefix @@ -5332,7 +5332,7 @@ test_misc30(void) CHECK(ret, FAIL, "test_misc30_get_info"); } - sprintf(gname, "/g0/group%d", i); + HDsprintf(gname, "/g0/group%d", i); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(gid, FAIL, "H5Gcreate2"); @@ -5353,7 +5353,7 @@ test_misc30(void) VERIFY(file_size[0], file_size[1], "test_misc30"); } /* end test_misc30() */ - + /**************************************************************** ** ** test_misc31(): Test reentering library through deprecated @@ -5451,7 +5451,7 @@ test_misc31(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end test_misc31() */ - + /**************************************************************** * * test_misc32(): Simple test of filter memory allocation @@ -5625,7 +5625,7 @@ test_misc34(void) } /* end test_misc34() */ - + /**************************************************************** ** ** test_misc(): Main misc. test routine. @@ -5678,7 +5678,7 @@ test_misc(void) } /* test_misc() */ - + /*------------------------------------------------------------------------- * Function: cleanup_misc * diff --git a/test/tselect.c b/test/tselect.c index 4a47929..9cfa922 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -13,50 +13,50 @@ /*********************************************************** * -* Test program: tselect +* Test program: tselect * * Test the Dataspace selection functionality * *************************************************************/ -#define H5S_FRIEND /*suppress error about including H5Spkg */ +#define H5S_FRIEND /*suppress error about including H5Spkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5S_TESTING #include "testhdf5.h" #include "hdf5.h" -#include "H5Spkg.h" /* Dataspaces */ +#include "H5Spkg.h" /* Dataspaces */ #define FILENAME "tselect.h5" /* 3-D dataset with fixed dimensions */ #define SPACE1_NAME "Space1" -#define SPACE1_RANK 3 -#define SPACE1_DIM1 3 -#define SPACE1_DIM2 15 -#define SPACE1_DIM3 13 +#define SPACE1_RANK 3 +#define SPACE1_DIM1 3 +#define SPACE1_DIM2 15 +#define SPACE1_DIM3 13 /* 2-D dataset with fixed dimensions */ #define SPACE2_NAME "Space2" -#define SPACE2_RANK 2 -#define SPACE2_DIM1 30 -#define SPACE2_DIM2 26 -#define SPACE2A_RANK 1 -#define SPACE2A_DIM1 (SPACE2_DIM1*SPACE2_DIM2) +#define SPACE2_RANK 2 +#define SPACE2_DIM1 30 +#define SPACE2_DIM2 26 +#define SPACE2A_RANK 1 +#define SPACE2A_DIM1 (SPACE2_DIM1*SPACE2_DIM2) /* 2-D dataset with fixed dimensions */ #define SPACE3_NAME "Space3" -#define SPACE3_RANK 2 -#define SPACE3_DIM1 15 -#define SPACE3_DIM2 26 +#define SPACE3_RANK 2 +#define SPACE3_DIM1 15 +#define SPACE3_DIM2 26 /* 3-D dataset with fixed dimensions */ #define SPACE4_NAME "Space4" -#define SPACE4_RANK 3 -#define SPACE4_DIM1 11 -#define SPACE4_DIM2 13 -#define SPACE4_DIM3 17 +#define SPACE4_RANK 3 +#define SPACE4_DIM1 11 +#define SPACE4_DIM2 13 +#define SPACE4_DIM3 17 /* Number of random hyperslabs to test */ #define NHYPERSLABS 10 @@ -66,22 +66,22 @@ /* 5-D dataset with fixed dimensions */ #define SPACE5_NAME "Space5" -#define SPACE5_RANK 5 -#define SPACE5_DIM1 10 -#define SPACE5_DIM2 10 -#define SPACE5_DIM3 10 -#define SPACE5_DIM4 10 -#define SPACE5_DIM5 10 +#define SPACE5_RANK 5 +#define SPACE5_DIM1 10 +#define SPACE5_DIM2 10 +#define SPACE5_DIM3 10 +#define SPACE5_DIM4 10 +#define SPACE5_DIM5 10 /* 1-D dataset with same size as 5-D dataset */ -#define SPACE6_RANK 1 -#define SPACE6_DIM1 (SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5) +#define SPACE6_RANK 1 +#define SPACE6_DIM1 (SPACE5_DIM1*SPACE5_DIM2*SPACE5_DIM3*SPACE5_DIM4*SPACE5_DIM5) /* 2-D dataset with easy dimension sizes */ #define SPACE7_NAME "Space7" -#define SPACE7_RANK 2 -#define SPACE7_DIM1 10 -#define SPACE7_DIM2 10 +#define SPACE7_RANK 2 +#define SPACE7_DIM1 10 +#define SPACE7_DIM2 10 #define SPACE7_FILL 254 #define SPACE7_CHUNK_DIM1 5 #define SPACE7_CHUNK_DIM2 5 @@ -89,16 +89,16 @@ /* 4-D dataset with fixed dimensions */ #define SPACE8_NAME "Space8" -#define SPACE8_RANK 4 -#define SPACE8_DIM1 11 -#define SPACE8_DIM2 13 -#define SPACE8_DIM3 17 -#define SPACE8_DIM4 19 +#define SPACE8_RANK 4 +#define SPACE8_DIM1 11 +#define SPACE8_DIM2 13 +#define SPACE8_DIM3 17 +#define SPACE8_DIM4 19 /* Another 2-D dataset with easy dimension sizes */ -#define SPACE9_RANK 2 -#define SPACE9_DIM1 12 -#define SPACE9_DIM2 12 +#define SPACE9_RANK 2 +#define SPACE9_DIM1 12 +#define SPACE9_DIM2 12 /* Element selection information */ #define POINT1_NPOINTS 10 @@ -125,13 +125,13 @@ #define SPACE10_CHUNK_SIZE 12 /* Information for bounds checking test */ -#define SPACE11_RANK 2 +#define SPACE11_RANK 2 #define SPACE11_DIM1 100 #define SPACE11_DIM2 100 #define SPACE11_NPOINTS 4 /* Information for offsets w/chunks test #2 */ -#define SPACE12_RANK 1 +#define SPACE12_RANK 1 #define SPACE12_DIM0 25 #define SPACE12_CHUNK_DIM0 5 @@ -164,10 +164,10 @@ #define SPACEUD3_DIM2 13 /* #defines for shape same / different rank tests */ -#define SS_DR_MAX_RANK 5 +#define SS_DR_MAX_RANK 5 /* Information for regular hyperslab query test */ -#define SPACE13_RANK 3 +#define SPACE13_RANK 3 #define SPACE13_DIM1 50 #define SPACE13_DIM2 50 #define SPACE13_DIM3 50 @@ -215,21 +215,21 @@ test_select_hyper_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_A static void test_select_hyper(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ H5S_class_t ext_type; /* Extent type */ /* Output message about test being performed */ @@ -380,7 +380,7 @@ test_select_hyper(hid_t xfer_plist) } /* test_select_hyper() */ struct pnt_iter { - hsize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */ uint8_t *buf; /* Buffer the points are in */ int offset; /* Which point we are looking at */ }; @@ -417,24 +417,24 @@ test_select_point_iter1(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned H5_A static void test_select_point(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ struct pnt_iter pi; /* Custom Pointer iterator struct */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Element Selection Functions\n")); @@ -703,15 +703,15 @@ test_select_none_iter1(void H5_ATTR_UNUSED *_elem, hid_t H5_ATTR_UNUSED type_id, static void test_select_all(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hsize_t dims1[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hsize_t dims1[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j,k; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ H5S_class_t ext_type; /* Extent type */ /* Output message about test being performed */ @@ -784,21 +784,21 @@ test_select_all(hid_t xfer_plist) static void test_select_all_hyper(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ H5S_class_t ext_type; /* Extent type */ /* Output message about test being performed */ @@ -925,23 +925,23 @@ test_select_all_hyper(hid_t xfer_plist) static void test_select_combo(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Combination of Hyperslab & Element Selection Functions\n")); @@ -1069,16 +1069,16 @@ compare_size_t(const void *s1, const void *s2) static void test_select_hyper_stride(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ @@ -1108,7 +1108,7 @@ test_select_hyper_stride(hid_t xfer_plist) 220,221,222,246,247,248, /* Block #12 */ }; int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); @@ -1188,8 +1188,8 @@ test_select_hyper_stride(hid_t xfer_plist) tbuf=wbuf+loc1[i]; tbuf2=rbuf+loc2[i]; if(*tbuf!=*tbuf2) { - printf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); - printf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); + HDprintf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); + HDprintf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); TestErrPrintf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end for */ @@ -1224,19 +1224,19 @@ test_select_hyper_stride(hid_t xfer_plist) static void test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Contiguous Hyperslabs Functionality\n")); @@ -1350,17 +1350,17 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) static void test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; - hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ - hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; + hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ + hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j,k,l; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing More Contiguous Hyperslabs Functionality\n")); @@ -1471,17 +1471,17 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) static void test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; - hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ - hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; + hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ + hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ uint16_t *wbuf, /* Buffer to write to disk */ *rbuf, /* Buffer read from disk */ *tbuf, *tbuf2; /* Temporary buffer pointers */ unsigned i,j,k,l; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Yet More Contiguous Hyperslabs Functionality\n")); @@ -1565,13 +1565,13 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) (k>=start[2] && k<(start[2]+count[2])) && (l>=start[3] && l<(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { - printf("Error: hyperslab values don't match!\n"); + HDprintf("Error: hyperslab values don't match!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { - printf("Error: invalid data in read buffer!\n"); + HDprintf("Error: invalid data in read buffer!\n"); TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end else */ @@ -1597,7 +1597,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) HDfree(rbuf); } /* test_select_hyper_contig3() */ - + /**************************************************************** ** ** verify_select_hyper_contig_dr__run_test(): Verify data from @@ -1609,10 +1609,10 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t cube_size, unsigned edge_size, unsigned cube_rank) { const uint16_t *cube_ptr; /* Pointer into the cube buffer */ - uint16_t expected_value; /* Expected value in dataset */ + uint16_t expected_value; /* Expected value in dataset */ unsigned i, j, k, l, m; /* Local index variables */ size_t s; /* Local index variable */ - hbool_t mis_match; /* Flag to indicate mis-match in expected value */ + hbool_t mis_match; /* Flag to indicate mis-match in expected value */ HDassert(cube_buf); HDassert(cube_size > 0); @@ -1656,14 +1656,14 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, TestErrPrintf("Initial cube data don't match! Line = %d\n", __LINE__); } /* verify_select_hyper_contig_dr__run_test() */ - + /**************************************************************** ** ** test_select_hyper_contig_dr__run_test(): Test H5S (dataspace) -** selection code with contiguous source and target having -** different ranks but the same shape. We have already -** tested H5Sselect_shape_same in isolation, so now we try to do -** I/O. +** selection code with contiguous source and target having +** different ranks but the same shape. We have already +** tested H5Sselect_shape_same in isolation, so now we try to do +** I/O. ** ****************************************************************/ static void @@ -1671,37 +1671,37 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, const uint16_t *zero_buf, unsigned edge_size, unsigned chunk_edge_size, unsigned small_rank, unsigned large_rank, hid_t dset_type, hid_t xfer_plist) { - hbool_t mis_match; /* Flag indicating a value read in wasn't what was expected */ + hbool_t mis_match; /* Flag indicating a value read in wasn't what was expected */ hid_t fapl; /* File access property list */ - hid_t fid1; /* File ID */ - hid_t small_cube_sid; /* Dataspace ID for small cube in memory & file */ - hid_t mem_large_cube_sid; /* Dataspace ID for large cube in memory */ - hid_t file_large_cube_sid; /* Dataspace ID for large cube in file */ - hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */ - hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */ - hid_t small_cube_dataset; /* Dataset ID */ - hid_t large_cube_dataset; /* Dataset ID */ + hid_t fid1; /* File ID */ + hid_t small_cube_sid; /* Dataspace ID for small cube in memory & file */ + hid_t mem_large_cube_sid; /* Dataspace ID for large cube in memory */ + hid_t file_large_cube_sid; /* Dataspace ID for large cube in file */ + hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */ + hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */ + hid_t small_cube_dataset; /* Dataset ID */ + hid_t large_cube_dataset; /* Dataset ID */ size_t start_index; /* Offset within buffer to begin inspecting */ size_t stop_index; /* Offset within buffer to end inspecting */ - uint16_t expected_value; /* Expected value in dataset */ - uint16_t * small_cube_buf_1; /* Buffer for small cube data */ - uint16_t * large_cube_buf_1; /* Buffer for large cube data */ - uint16_t * ptr_1; /* Temporary pointer into cube data */ - hsize_t dims[SS_DR_MAX_RANK]; /* Dataspace dimensions */ - hsize_t start[SS_DR_MAX_RANK]; /* Shared hyperslab start offset */ - hsize_t stride[SS_DR_MAX_RANK]; /* Shared hyperslab stride */ - hsize_t count[SS_DR_MAX_RANK]; /* Shared hyperslab count */ - hsize_t block[SS_DR_MAX_RANK]; /* Shared hyperslab block size */ - hsize_t * start_ptr; /* Actual hyperslab start offset */ - hsize_t * stride_ptr; /* Actual hyperslab stride */ - hsize_t * count_ptr; /* Actual hyperslab count */ - hsize_t * block_ptr; /* Actual hyperslab block size */ + uint16_t expected_value; /* Expected value in dataset */ + uint16_t * small_cube_buf_1; /* Buffer for small cube data */ + uint16_t * large_cube_buf_1; /* Buffer for large cube data */ + uint16_t * ptr_1; /* Temporary pointer into cube data */ + hsize_t dims[SS_DR_MAX_RANK]; /* Dataspace dimensions */ + hsize_t start[SS_DR_MAX_RANK]; /* Shared hyperslab start offset */ + hsize_t stride[SS_DR_MAX_RANK]; /* Shared hyperslab stride */ + hsize_t count[SS_DR_MAX_RANK]; /* Shared hyperslab count */ + hsize_t block[SS_DR_MAX_RANK]; /* Shared hyperslab block size */ + hsize_t * start_ptr; /* Actual hyperslab start offset */ + hsize_t * stride_ptr; /* Actual hyperslab stride */ + hsize_t * count_ptr; /* Actual hyperslab count */ + hsize_t * block_ptr; /* Actual hyperslab block size */ size_t small_cube_size; /* Number of elements in small cube */ size_t large_cube_size; /* Number of elements in large cube */ unsigned u, v, w, x; /* Local index variables */ size_t s; /* Local index variable */ - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ MESSAGE(7, ("\tn-cube slice through m-cube I/O test %d.\n", test_num)); MESSAGE(7, ("\tranks = %u/%u, edge_size = %u, chunk_edge_size = %u.\n", small_rank, large_rank, edge_size, chunk_edge_size)); @@ -1770,10 +1770,10 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, * datasets. */ if(chunk_edge_size > 0) { - hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */ + hsize_t chunk_dims[SS_DR_MAX_RANK]; /* Chunk dimensions */ chunk_dims[0] = chunk_dims[1] = - chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; + chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = (hsize_t)chunk_edge_size; small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); CHECK(small_cube_dcpl_id, FAIL, "H5Pcreate"); @@ -2093,7 +2093,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, VERIFY(check, TRUE, "H5Sselect_shape_same"); - /* write the slice from the in memory large cube to the on disk small cube */ + /* write the slice from the in memory large cube to the on disk small cube */ ret = H5Dwrite(small_cube_dataset, H5T_NATIVE_UINT16, mem_large_cube_sid, @@ -2203,7 +2203,7 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, VERIFY(check, TRUE, "H5Sselect_shape_same"); - /* write the cube from memory to the target slice of the disk cube */ + /* write the cube from memory to the target slice of the disk cube */ ret = H5Dwrite(large_cube_dataset, H5T_NATIVE_UINT16, small_cube_sid, @@ -2299,14 +2299,14 @@ test_select_hyper_contig_dr__run_test(int test_num, const uint16_t *cube_buf, } /* test_select_hyper_contig_dr__run_test() */ - + /**************************************************************** ** ** test_select_hyper_contig_dr(): Test H5S (dataspace) -** selection code with contiguous source and target having -** different ranks but the same shape. We have already -** tested H5Sselect_shape_same in isolation, so now we try to do -** I/O. +** selection code with contiguous source and target having +** different ranks but the same shape. We have already +** tested H5Sselect_shape_same in isolation, so now we try to do +** I/O. ** ****************************************************************/ static void @@ -2367,25 +2367,25 @@ test_select_hyper_contig_dr(hid_t dset_type, hid_t xfer_plist) } /* test_select_hyper_contig_dr() */ - + /**************************************************************** ** ** test_select_hyper_checker_board_dr__select_checker_board(): -** Given an n-cube dataspace with each edge of length -** edge_size, and a checker_edge_size either select a checker -** board selection of the entire cube(if sel_rank == n), -** or select a checker board selection of a -** sel_rank dimensional slice through n-cube parallel to the +** Given an n-cube dataspace with each edge of length +** edge_size, and a checker_edge_size either select a checker +** board selection of the entire cube(if sel_rank == n), +** or select a checker board selection of a +** sel_rank dimensional slice through n-cube parallel to the ** sel_rank fastest changing indices, with origin (in the -** higher indices) as indicated by the start array. +** higher indices) as indicated by the start array. ** -** Note that this function, like all its relatives, is -** hard coded to presume a maximum n-cube rank of 5. -** While this maximum is declared as a constant, increasing -** it will require extensive coding in addition to changing +** Note that this function, like all its relatives, is +** hard coded to presume a maximum n-cube rank of 5. +** While this maximum is declared as a constant, increasing +** it will require extensive coding in addition to changing ** the value of the constant. ** -** JRM -- 9/9/09 +** JRM -- 9/9/09 ** ****************************************************************/ static void @@ -2393,18 +2393,18 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, unsigned tgt_n_cube_rank, unsigned edge_size, unsigned checker_edge_size, unsigned sel_rank, hsize_t sel_start[]) { - hbool_t first_selection = TRUE; - unsigned n_cube_offset; - unsigned sel_offset; - hsize_t base_count; + hbool_t first_selection = TRUE; + unsigned n_cube_offset; + unsigned sel_offset; + hsize_t base_count; hsize_t offset_count; - hsize_t start[SS_DR_MAX_RANK]; /* Offset of hyperslab selection */ - hsize_t stride[SS_DR_MAX_RANK]; /* Stride of hyperslab selection */ - hsize_t count[SS_DR_MAX_RANK]; /* Count of hyperslab selection */ - hsize_t block[SS_DR_MAX_RANK]; /* Block size of hyperslab selection */ + hsize_t start[SS_DR_MAX_RANK]; /* Offset of hyperslab selection */ + hsize_t stride[SS_DR_MAX_RANK]; /* Stride of hyperslab selection */ + hsize_t count[SS_DR_MAX_RANK]; /* Count of hyperslab selection */ + hsize_t block[SS_DR_MAX_RANK]; /* Block size of hyperslab selection */ unsigned i, j, k, l, m; /* Local index variable */ unsigned u; /* Local index variables */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ HDassert(edge_size >= 6); HDassert(0 < checker_edge_size); @@ -2578,47 +2578,47 @@ test_select_hyper_checker_board_dr__select_checker_board(hid_t tgt_n_cube_sid, CHECK(ret, FAIL, "H5Sselect_hyperslab"); } /* test_select_hyper_checker_board_dr__select_checker_board() */ - + /**************************************************************** ** ** test_select_hyper_checker_board_dr__verify_data(): ** -** Examine the supplied buffer to see if it contains the -** expected data. Return TRUE if it does, and FALSE +** Examine the supplied buffer to see if it contains the +** expected data. Return TRUE if it does, and FALSE ** otherwise. ** -** The supplied buffer is presumed to contain the results -** of read or writing a checkerboard selection of an -** n-cube, or a checkerboard selection of an m (1 <= m < n) -** dimensional slice through an n-cube parallel to the +** The supplied buffer is presumed to contain the results +** of read or writing a checkerboard selection of an +** n-cube, or a checkerboard selection of an m (1 <= m < n) +** dimensional slice through an n-cube parallel to the ** fastest changing indices. ** -** It is further presumed that the buffer was zeroed before -** the read, and that the n-cube was initialize with the +** It is further presumed that the buffer was zeroed before +** the read, and that the n-cube was initialize with the ** natural numbers listed in order from the origin along ** the fastest changing axis. ** ** Thus for a 10x10x10 3-cube, the value stored in location -** (x, y, z) (assuming that z is the fastest changing index -** and x the slowest) is assumed to be: +** (x, y, z) (assuming that z is the fastest changing index +** and x the slowest) is assumed to be: ** -** (10 * 10 * x) + (10 * y) + z +** (10 * 10 * x) + (10 * y) + z ** -** Thus, if the buffer contains the result of reading a -** checker board selection of a 10x10x10 3-cube, location -** (x, y, z) will contain zero if it is not in a checker, -** and 100x + 10y + z if (x, y, z) is in a checker. +** Thus, if the buffer contains the result of reading a +** checker board selection of a 10x10x10 3-cube, location +** (x, y, z) will contain zero if it is not in a checker, +** and 100x + 10y + z if (x, y, z) is in a checker. ** -** If the buffer contains the result of reading a 3 -** dimensional slice (parallel to the three fastest changing -** indices) through an n cube (n > 3), then the expected -** values in the buffer will be the same, save that we will -** add a constant determined by the origin of the 3-cube -** in the n-cube. +** If the buffer contains the result of reading a 3 +** dimensional slice (parallel to the three fastest changing +** indices) through an n cube (n > 3), then the expected +** values in the buffer will be the same, save that we will +** add a constant determined by the origin of the 3-cube +** in the n-cube. ** -** Finally, the function presumes that the first element -** of the buffer resides either at the origin of either -** a selected or an unselected checker. +** Finally, the function presumes that the first element +** of the buffer resides either at the origin of either +** a selected or an unselected checker. ** ****************************************************************/ H5_ATTR_PURE static hbool_t @@ -2722,14 +2722,14 @@ test_select_hyper_checker_board_dr__verify_data(uint16_t * buf_ptr, return(good_data); } /* test_select_hyper_checker_board_dr__verify_data() */ - + /**************************************************************** ** ** test_select_hyper_checker_board_dr__run_test(): Test H5S ** (dataspace) selection code with checker board source and -** target selections having different ranks but the same -** shape. We have already tested H5Sselect_shape_same in -** isolation, so now we try to do I/O. +** target selections having different ranks but the same +** shape. We have already tested H5Sselect_shape_same in +** isolation, so now we try to do I/O. ** ****************************************************************/ static void @@ -2738,36 +2738,36 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ unsigned chunk_edge_size, unsigned small_rank, unsigned large_rank, hid_t dset_type, hid_t xfer_plist) { - hbool_t data_ok; + hbool_t data_ok; hid_t fapl; /* File access property list */ - hid_t fid; /* HDF5 File IDs */ - hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */ - hid_t mem_small_cube_sid; - hid_t file_small_cube_sid; - hid_t full_large_cube_sid; /* Dataspace for large cube w/all selection */ - hid_t mem_large_cube_sid; - hid_t file_large_cube_sid; - hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */ - hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */ - hid_t small_cube_dataset; /* Dataset ID */ - hid_t large_cube_dataset; /* Dataset ID */ - unsigned small_rank_offset; /* Rank offset of slice */ - const unsigned test_max_rank = 5; /* must update code if this changes */ + hid_t fid; /* HDF5 File IDs */ + hid_t full_small_cube_sid; /* Dataspace for small cube w/all selection */ + hid_t mem_small_cube_sid; + hid_t file_small_cube_sid; + hid_t full_large_cube_sid; /* Dataspace for large cube w/all selection */ + hid_t mem_large_cube_sid; + hid_t file_large_cube_sid; + hid_t small_cube_dcpl_id = H5P_DEFAULT; /* DCPL for small cube dataset */ + hid_t large_cube_dcpl_id = H5P_DEFAULT; /* DCPL for large cube dataset */ + hid_t small_cube_dataset; /* Dataset ID */ + hid_t large_cube_dataset; /* Dataset ID */ + unsigned small_rank_offset; /* Rank offset of slice */ + const unsigned test_max_rank = 5; /* must update code if this changes */ size_t start_index; /* Offset within buffer to begin inspecting */ size_t stop_index; /* Offset within buffer to end inspecting */ - uint16_t expected_value; - uint16_t * small_cube_buf_1; - uint16_t * large_cube_buf_1; - uint16_t * ptr_1; + uint16_t expected_value; + uint16_t * small_cube_buf_1; + uint16_t * large_cube_buf_1; + uint16_t * ptr_1; size_t small_cube_size; /* Number of elements in small cube */ size_t large_cube_size; /* Number of elements in large cube */ - hsize_t dims[SS_DR_MAX_RANK]; - hsize_t chunk_dims[SS_DR_MAX_RANK]; - hsize_t sel_start[SS_DR_MAX_RANK]; + hsize_t dims[SS_DR_MAX_RANK]; + hsize_t chunk_dims[SS_DR_MAX_RANK]; + hsize_t sel_start[SS_DR_MAX_RANK]; unsigned u, v, w, x; /* Local index variables */ size_t s; /* Local index variable */ - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ MESSAGE(7, ("\tn-cube slice through m-cube I/O test %d.\n", test_num)); MESSAGE(7, ("\tranks = %d/%d, edge_size = %d, checker_edge_size = %d, chunk_edge_size = %d.\n", small_rank, large_rank, edge_size, checker_edge_size, chunk_edge_size)); @@ -2858,7 +2858,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ */ if(chunk_edge_size > 0) { chunk_dims[0] = chunk_dims[1] = - chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size; + chunk_dims[2] = chunk_dims[3] = chunk_dims[4] = chunk_edge_size; small_cube_dcpl_id = H5Pcreate(H5P_DATASET_CREATE); CHECK(small_cube_dcpl_id, FAIL, "H5Pcreate"); @@ -3265,7 +3265,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ VERIFY(check, TRUE, "H5Sselect_shape_same"); - /* write the slice from the in memory large cube to the + /* write the slice from the in memory large cube to the * on disk small cube */ ret = H5Dwrite(small_cube_dataset, @@ -3396,7 +3396,7 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ VERIFY(check, TRUE, "H5Sselect_shape_same"); - /* write the checker board selection of the in memory + /* write the checker board selection of the in memory * small cube to a slice through the on disk large * cube. */ @@ -3523,17 +3523,17 @@ test_select_hyper_checker_board_dr__run_test(int test_num, const uint16_t *cube_ } /* test_select_hyper_checker_board_dr__run_test() */ - + /**************************************************************** ** ** test_select_hyper_checker_board_dr(): Test H5S (dataspace) -** selection code with checkerboard source and target having -** different ranks but the same shape. We have already -** tested H5Sselect_shape_same in isolation, so now we try to do -** I/O. +** selection code with checkerboard source and target having +** different ranks but the same shape. We have already +** tested H5Sselect_shape_same in isolation, so now we try to do +** I/O. ** -** This is just an initial smoke check, so we will work -** with a slice through a cube only. +** This is just an initial smoke check, so we will work +** with a slice through a cube only. ** ****************************************************************/ static void @@ -3608,7 +3608,7 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) } /* test_select_hyper_checker_board_dr() */ - + /**************************************************************** ** ** test_select_hyper_copy(): Test H5S (dataspace) selection code. @@ -3618,22 +3618,22 @@ test_select_hyper_checker_board_dr(hid_t dset_type, hid_t xfer_plist) static void test_select_hyper_copy(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t data1,data2; /* Dataset IDs */ - hid_t sid1,sid2,sid3; /* Dataspace IDs */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t data1,data2; /* Dataset IDs */ + hid_t sid1,sid2,sid3; /* Dataspace IDs */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* 1st buffer read from disk */ *rbuf2, /* 2nd buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); @@ -3774,21 +3774,21 @@ test_select_hyper_copy(void) static void test_select_point_copy(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t data1,data2; /* Dataset IDs */ - hid_t sid1,sid2,sid3; /* Dataspace IDs */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hid_t fid1; /* HDF5 File IDs */ + hid_t data1,data2; /* Dataset IDs */ + hid_t sid1,sid2,sid3; /* Dataspace IDs */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* 1st buffer read from disk */ *rbuf2, /* 2nd buffer read from disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslabs with Strides Functionality\n")); @@ -3948,24 +3948,24 @@ test_select_point_copy(void) static void test_select_hyper_offset(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ - hssize_t offset[SPACE1_RANK]; /* Offset of selection */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hssize_t offset[SPACE1_RANK]; /* Offset of selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - htri_t valid; /* Generic boolean return value */ + herr_t ret; /* Generic return value */ + htri_t valid; /* Generic boolean return value */ H5S_class_t ext_type; /* Extent type */ /* Output message about test being performed */ @@ -4110,21 +4110,21 @@ test_select_hyper_offset(void) static void test_select_hyper_offset2(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; - hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2}; - hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */ - hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */ - hssize_t offset[SPACE7_RANK]; /* Offset of selection */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; + hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2}; + hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */ + hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */ + hssize_t offset[SPACE7_RANK]; /* Offset of selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - htri_t valid; /* Generic boolean return value */ + herr_t ret; /* Generic return value */ + htri_t valid; /* Generic boolean return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing More Hyperslab Selection Functions with Offsets\n")); @@ -4231,23 +4231,23 @@ test_select_hyper_offset2(void) static void test_select_point_offset(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hssize_t offset[SPACE1_RANK]; /* Offset of selection */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hssize_t offset[SPACE1_RANK]; /* Offset of selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - htri_t valid; /* Generic boolean return value */ + herr_t ret; /* Generic return value */ + htri_t valid; /* Generic boolean return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Element Selection Functions\n")); @@ -4403,17 +4403,17 @@ test_select_point_offset(void) static void test_select_hyper_union(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t xfer; /* Dataset Transfer Property List ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hid_t xfer; /* Dataset Transfer Property List ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ size_t begin[SPACE2_DIM1]= /* Offset within irregular block */ {0,0,0,0,0,0,0,0,0,0, /* First ten rows start at offset 0 */ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5}; /* Next eighteen rows start at offset 5 */ @@ -4426,8 +4426,8 @@ test_select_hyper_union(void) *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - hssize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hssize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of hyperslabs\n")); @@ -5037,10 +5037,10 @@ test_select_hyper_union_stagger(void) /* Verify input data */ for(i=0; i<8; i++) { if(data[input_loc[i][0]][input_loc[i][1]]!=data_out[output_loc[i][0]][output_loc[i][1]]) { - printf("input data #%d is wrong!\n",i); - printf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); - printf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); - printf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); + HDprintf("input data #%d is wrong!\n",i); + HDprintf("input_loc=[%d][%d]\n",input_loc[i][0],input_loc[i][1]); + HDprintf("output_loc=[%d][%d]\n",output_loc[i][0],output_loc[i][1]); + HDprintf("data=%d\n",data[input_loc[i][0]][input_loc[i][1]]); TestErrPrintf("data_out=%d\n",data_out[output_loc[i][0]][output_loc[i][1]]); } /* end if */ } /* end for */ @@ -5070,18 +5070,18 @@ test_select_hyper_union_stagger(void) static void test_select_hyper_union_3d(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hid_t tmp_space; /* Temporary Dataspace ID */ - hid_t tmp2_space; /* Another temporary Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hid_t tmp_space; /* Temporary Dataspace ID */ + hid_t tmp2_space; /* Another temporary Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ struct row_list { size_t z; size_t y; @@ -5142,8 +5142,8 @@ test_select_hyper_union_3d(void) *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j,k; /* Counters */ - herr_t ret; /* Generic return value */ - hsize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hsize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with unions of 3-D hyperslabs\n")); @@ -5278,20 +5278,20 @@ test_select_hyper_union_3d(void) static void test_select_hyper_valid_combination(void) { - hid_t single_pt_sid; /* Dataspace ID with single point selection */ - hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */ - hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */ - hid_t non_existent_sid = -1; /* A non-existent space id */ - hid_t tmp_sid; /* Temporary dataspace ID */ - hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2}; - hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; - - hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ + hid_t single_pt_sid; /* Dataspace ID with single point selection */ + hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */ + hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */ + hid_t non_existent_sid = -1; /* A non-existent space id */ + hid_t tmp_sid; /* Temporary dataspace ID */ + hsize_t dims2D[] = {SPACE9_DIM1, SPACE9_DIM2}; + hsize_t dims3D[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; + + hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ hsize_t start[SPACE4_RANK]; /* Hyperslab start */ hsize_t stride[SPACE4_RANK]; /* Hyperslab stride */ hsize_t count[SPACE4_RANK]; /* Hyperslab block count */ hsize_t block[SPACE4_RANK]; /* Hyperslab block size */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Selection Combination Validity\n")); @@ -5333,35 +5333,35 @@ test_select_hyper_valid_combination(void) /* Test all the selections created */ - /* Test the invalid combinations between point and hyperslab */ - tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Scombine_select"); + /* Test the invalid combinations between point and hyperslab */ + tmp_sid = H5Scombine_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Smodify_select"); + tmp_sid = H5Smodify_select(single_pt_sid, H5S_SELECT_AND, single_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Smodify_select"); - /* Test the invalid combination between two hyperslab but of different dimension size */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Scombine_select"); + /* Test the invalid combination between two hyperslab but of different dimension size */ + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Smodify_select"); + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, regular_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Smodify_select"); - /* Test invalid operation inputs to the two functions */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Scombine_select"); + /* Test invalid operation inputs to the two functions */ + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); - VERIFY(tmp_sid, FAIL, "H5Smodify_select"); + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_SET, single_hyper_sid); + VERIFY(tmp_sid, FAIL, "H5Smodify_select"); - /* Test inputs in case of non-existent space ids */ - tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); - VERIFY(tmp_sid, FAIL, "H5Scombine_select"); + /* Test inputs in case of non-existent space ids */ + tmp_sid = H5Scombine_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + VERIFY(tmp_sid, FAIL, "H5Scombine_select"); - tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); - VERIFY(tmp_sid, FAIL, "H5Smodify_select"); + tmp_sid = H5Smodify_select(single_hyper_sid, H5S_SELECT_AND, non_existent_sid); + VERIFY(tmp_sid, FAIL, "H5Smodify_select"); - /* Close dataspaces */ + /* Close dataspaces */ ret = H5Sclose(single_pt_sid); CHECK(ret, FAIL, "H5Sclose"); ret = H5Sclose(single_hyper_sid); @@ -5380,22 +5380,22 @@ test_select_hyper_valid_combination(void) static void test_select_hyper_and_2d(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims2[] = {SPACE2A_DIM1}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims2[] = {SPACE2A_DIM1}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - hssize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hssize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with intersection of 2-D hyperslabs\n")); @@ -5470,12 +5470,12 @@ test_select_hyper_and_2d(void) for(j=0; j=5 && i<=9) && (j>=5 && j<=9)) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5509,22 +5509,22 @@ test_select_hyper_and_2d(void) static void test_select_hyper_xor_2d(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims2[] = {SPACE2A_DIM1}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims2[] = {SPACE2A_DIM1}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - hssize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hssize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with XOR of 2-D hyperslabs\n")); @@ -5601,12 +5601,12 @@ test_select_hyper_xor_2d(void) ((i>=5 && i<=9) && ((j>=0 && j<=4) || (j>=10 && j<=14))) || ((i>=10 && i<=14) && (j>=5 && j<=14))) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5640,22 +5640,22 @@ test_select_hyper_xor_2d(void) static void test_select_hyper_notb_2d(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims2[] = {SPACE2A_DIM1}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims2[] = {SPACE2A_DIM1}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - hssize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hssize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTB of 2-D hyperslabs\n")); @@ -5731,12 +5731,12 @@ test_select_hyper_notb_2d(void) if(((i>=0 && i<=4) && (j>=0 && j<=9)) || ((i>=5 && i<=9) && (j>=0 && j<=4))) { if(*tbuf!=*tbuf2) - printf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); + HDprintf("%d: hyperslab values don't match!, i=%d, j=%d, *tbuf=%d, *tbuf2=%d\n",__LINE__,i,j,(int)*tbuf,(int)*tbuf2); tbuf2++; } /* end if */ else { if(*tbuf!=0) - printf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); + HDprintf("%d: hyperslab element has wrong value!, i=%d, j=%d, *tbuf=%d\n",__LINE__,i,j,(int)*tbuf); } /* end else */ } /* end for */ @@ -5770,22 +5770,22 @@ test_select_hyper_notb_2d(void) static void test_select_hyper_nota_2d(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims2[] = {SPACE2A_DIM1}; - hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims2[] = {SPACE2A_DIM1}; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf, /* temporary buffer pointer */ *tbuf2; /* temporary buffer pointer */ int i,j; /* Counters */ - herr_t ret; /* Generic return value */ - hssize_t npoints; /* Number of elements in selection */ + herr_t ret; /* Generic return value */ + hssize_t npoints; /* Number of elements in selection */ /* Output message about test being performed */ MESSAGE(5, ("Testing Hyperslab Selection Functions with NOTA of 2-D hyperslabs\n")); @@ -5905,14 +5905,14 @@ test_select_hyper_iter2(void *_elem, hid_t H5_ATTR_UNUSED type_id, unsigned ndim if(*tbuf!=**tbuf2) { TestErrPrintf("Error in hyperslab iteration!\n"); - printf("location: { "); + HDprintf("location: { "); for(u=0; u n) in a call to H5Sselect_shape_same(). -** Note that this test does not require the n-cube and the -** n-dimensional slice to have the same rank (although -** H5Sselect_shape_same() should always return FALSE if -** they don't). +** of a full n-cube dataspace vs an n-dimensional slice of +** of an m-cube (m > n) in a call to H5Sselect_shape_same(). +** Note that this test does not require the n-cube and the +** n-dimensional slice to have the same rank (although +** H5Sselect_shape_same() should always return FALSE if +** they don't). ** -** Per Quincey's suggestion, only test up to 5 dimensional -** spaces. +** Per Quincey's suggestion, only test up to 5 dimensional +** spaces. ** ****************************************************************/ static void @@ -10539,22 +10539,22 @@ test_shape_same_dr__full_space_vs_slice(int test_num, hbool_t dim_selected[], hbool_t expected_result) { - char test_desc_0[128]; - char test_desc_1[256]; + char test_desc_0[128]; + char test_desc_1[256]; int i; - hid_t n_cube_0_sid; /* the fully selected hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ - hsize_t dims[SS_DR_MAX_RANK]; - hsize_t start[SS_DR_MAX_RANK]; - hsize_t * start_ptr; - hsize_t stride[SS_DR_MAX_RANK]; - hsize_t * stride_ptr; - hsize_t count[SS_DR_MAX_RANK]; - hsize_t * count_ptr; - hsize_t block[SS_DR_MAX_RANK]; - hsize_t * block_ptr; - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + hid_t n_cube_0_sid; /* the fully selected hyper cube */ + hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ + hsize_t dims[SS_DR_MAX_RANK]; + hsize_t start[SS_DR_MAX_RANK]; + hsize_t * start_ptr; + hsize_t stride[SS_DR_MAX_RANK]; + hsize_t * stride_ptr; + hsize_t count[SS_DR_MAX_RANK]; + hsize_t * count_ptr; + hsize_t block[SS_DR_MAX_RANK]; + hsize_t * block_ptr; + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); @@ -10564,13 +10564,13 @@ test_shape_same_dr__full_space_vs_slice(int test_num, HDassert( edge_size > 0 ); HDassert( edge_size <= 1000 ); - sprintf(test_desc_0, + HDsprintf(test_desc_0, "\tn-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\t\tranks: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d.\n", small_rank, large_rank, offset, (int)dim_selected[0], @@ -10652,26 +10652,26 @@ test_shape_same_dr__full_space_vs_slice(int test_num, ** ** test_shape_same_dr__run_full_space_vs_slice_tests(): ** -** Run the test_shape_same_dr__full_space_vs_slice() test -** over a variety of ranks and offsets. +** Run the test_shape_same_dr__full_space_vs_slice() test +** over a variety of ranks and offsets. ** -** At present, we test H5Sselect_shape_same() with -** fully selected 1, 2, 3, and 4 cubes as one parameter, and -** 1, 2, 3, and 4 dimensional slices through a n-cube of rank -** no more than 5 (and at least the rank of the slice). -** We stop at rank 5, as Quincey suggested that it would be -** sufficient. +** At present, we test H5Sselect_shape_same() with +** fully selected 1, 2, 3, and 4 cubes as one parameter, and +** 1, 2, 3, and 4 dimensional slices through a n-cube of rank +** no more than 5 (and at least the rank of the slice). +** We stop at rank 5, as Quincey suggested that it would be +** sufficient. ** -** All the n-cubes will have lengths of the same size, so -** H5Sselect_shape_same() should return true iff: +** All the n-cubes will have lengths of the same size, so +** H5Sselect_shape_same() should return true iff: ** -** 1) the rank for the fully selected n cube equals the +** 1) the rank for the fully selected n cube equals the ** number of dimensions selected in the slice through the ** m-cube (m >= n). ** -** 2) The dimensions selected in the slice through the m-cube -** are the dimesnions with the most quickly changing -** indices. +** 2) The dimensions selected in the slice through the m-cube +** are the dimesnions with the most quickly changing +** indices. ** ****************************************************************/ static void @@ -10799,17 +10799,17 @@ test_shape_same_dr__run_full_space_vs_slice_tests(void) /**************************************************************** ** ** test_shape_same_dr__checkerboard(): Tests selection of a -** "checker board" subset of a full n-cube dataspace vs -** a "checker board" n-dimensional slice of an m-cube (m > n). -** in a call to H5Sselect_shape_same(). +** "checker board" subset of a full n-cube dataspace vs +** a "checker board" n-dimensional slice of an m-cube (m > n). +** in a call to H5Sselect_shape_same(). ** -** Note that this test does not require the n-cube and the -** n-dimensional slice to have the same rank (although -** H5Sselect_shape_same() should always return FALSE if -** they don't). +** Note that this test does not require the n-cube and the +** n-dimensional slice to have the same rank (although +** H5Sselect_shape_same() should always return FALSE if +** they don't). ** -** Per Quincey's suggestion, only test up to 5 dimensional -** spaces. +** Per Quincey's suggestion, only test up to 5 dimensional +** spaces. ** ****************************************************************/ static void @@ -10822,31 +10822,31 @@ test_shape_same_dr__checkerboard(int test_num, hbool_t dim_selected[], hbool_t expected_result) { - char test_desc_0[128]; - char test_desc_1[256]; + char test_desc_0[128]; + char test_desc_1[256]; int i; - int dims_selected = 0; - hid_t n_cube_0_sid; /* the checker board selected + int dims_selected = 0; + hid_t n_cube_0_sid; /* the checker board selected * hyper cube */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * checkerboard slice is selected */ - hsize_t dims[SS_DR_MAX_RANK]; - hsize_t base_start[2]; - hsize_t start[SS_DR_MAX_RANK]; - hsize_t * start_ptr; - hsize_t base_stride[2]; - hsize_t stride[SS_DR_MAX_RANK]; - hsize_t * stride_ptr; - hsize_t base_count[2]; - hsize_t count[SS_DR_MAX_RANK]; - hsize_t * count_ptr; - hsize_t base_block[2]; - hsize_t block[SS_DR_MAX_RANK]; - hsize_t * block_ptr; - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + hsize_t dims[SS_DR_MAX_RANK]; + hsize_t base_start[2]; + hsize_t start[SS_DR_MAX_RANK]; + hsize_t * start_ptr; + hsize_t base_stride[2]; + hsize_t stride[SS_DR_MAX_RANK]; + hsize_t * stride_ptr; + hsize_t base_count[2]; + hsize_t count[SS_DR_MAX_RANK]; + hsize_t * count_ptr; + hsize_t base_block[2]; + hsize_t block[SS_DR_MAX_RANK]; + hsize_t * block_ptr; + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); @@ -10864,13 +10864,13 @@ test_shape_same_dr__checkerboard(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, + HDsprintf(test_desc_0, "\tcheckerboard n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\tranks: %d/%d edge/chkr size: %d/%d offset: %d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, (int)edge_size, (int)checker_size, @@ -10895,19 +10895,19 @@ test_shape_same_dr__checkerboard(int test_num, * * In the 1-D case, the "checkerboard" would look like this: * - * * * - - * * - - * * + * * * - - * * - - * * * * and in the 2-D case, it would look like this: * - * * * - - * * - - * * + * * * - - * * - - * * * * * - - * * - - * * * - - * * - - * * - - * - - * * - - * * - - - * * * - - * * - - * * + * * * - - * * - - * * * * * - - * * - - * * * - - * * - - * * - - * - - * * - - * * - - - * * * - - * * - - * * + * * * - - * * - - * * * * * - - * * - - * * * * In both cases, asterisks indicate selected elements, @@ -10923,15 +10923,15 @@ test_shape_same_dr__checkerboard(int test_num, * are not even divisors of the edge size -- thus * something like the following is also possible: * - * * * * - - - * * * - - * * * * - - - * * * - - * * * * - - - * * * - + * * * * - - - * * * - + * * * * - - - * * * - + * * * * - - - * * * - * - - - * * * - - - * * - - - * * * - - - * * - - - * * * - - - * - * * * * - - - * * * - - * * * * - - - * * * - - * * * * - - - * * * - + * * * * - - - * * * - + * * * * - - - * * * - + * * * * - - - * * * - * - - - * * * - - - * * * As the above pattern can't be selected in one @@ -10961,7 +10961,7 @@ test_shape_same_dr__checkerboard(int test_num, base_count[0] = edge_size / (checker_size * 2); if((edge_size % (checker_size * 2)) > 0) - base_count[0]++; + base_count[0]++; base_count[1] = (edge_size - checker_size) / (checker_size * 2); if(((edge_size - checker_size) % (checker_size * 2)) > 0) @@ -11142,7 +11142,7 @@ test_shape_same_dr__checkerboard(int test_num, ** ** test_shape_same_dr__run_checkerboard_tests(): ** -** In this set of tests, we test H5Sselect_shape_same() +** In this set of tests, we test H5Sselect_shape_same() ** with a "checkerboard" selection of 1, 2, 3, and 4 cubes as ** one parameter, and 1, 2, 3, and 4 dimensional checkerboard ** slices through a n-cube of rank no more than 5 (and at @@ -11412,15 +11412,15 @@ test_shape_same_dr__run_checkerboard_tests(void) ** ** test_shape_same_dr__irregular(): ** -** Tests selection of an "irregular" subset of a full +** Tests selection of an "irregular" subset of a full ** n-cube dataspace vs an identical "irregular" subset -** of an n-dimensional slice of an m-cube (m > n). -** in a call to H5Sselect_shape_same(). +** of an n-dimensional slice of an m-cube (m > n). +** in a call to H5Sselect_shape_same(). ** -** Note that this test does not require the n-cube and the -** n-dimensional slice to have the same rank (although -** H5Sselect_shape_same() should always return FALSE if -** they don't). +** Note that this test does not require the n-cube and the +** n-dimensional slice to have the same rank (although +** H5Sselect_shape_same() should always return FALSE if +** they don't). ** ****************************************************************/ static void @@ -11432,71 +11432,71 @@ test_shape_same_dr__irregular(int test_num, hbool_t dim_selected[], hbool_t expected_result) { - char test_desc_0[128]; - char test_desc_1[256]; - int edge_size = 10; + char test_desc_0[128]; + char test_desc_1[256]; + int edge_size = 10; int i; int j; int k; - int dims_selected = 0; - hid_t n_cube_0_sid; /* the hyper cube containing + int dims_selected = 0; + hid_t n_cube_0_sid; /* the hyper cube containing * an irregular selection */ - hid_t n_cube_1_sid; /* the hyper cube in which a + hid_t n_cube_1_sid; /* the hyper cube in which a * slice contains an irregular * selection. */ - hsize_t dims[SS_DR_MAX_RANK]; - hsize_t start_0[SS_DR_MAX_RANK] = { 2, 2, 2, 2, 5}; - hsize_t stride_0[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t count_0[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t dims[SS_DR_MAX_RANK]; + hsize_t start_0[SS_DR_MAX_RANK] = { 2, 2, 2, 2, 5}; + hsize_t stride_0[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t count_0[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t block_0[SS_DR_MAX_RANK] = { 2, 2, 2, 2, 3}; - hsize_t start_1[SS_DR_MAX_RANK] = { 2, 2, 2, 5, 2}; - hsize_t stride_1[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t count_1[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t start_1[SS_DR_MAX_RANK] = { 2, 2, 2, 5, 2}; + hsize_t stride_1[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t count_1[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t block_1[SS_DR_MAX_RANK] = { 2, 2, 2, 3, 2}; - hsize_t start_2[SS_DR_MAX_RANK] = { 2, 2, 5, 2, 2}; - hsize_t stride_2[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t count_2[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t start_2[SS_DR_MAX_RANK] = { 2, 2, 5, 2, 2}; + hsize_t stride_2[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t count_2[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t block_2[SS_DR_MAX_RANK] = { 2, 2, 3, 2, 2}; - hsize_t start_3[SS_DR_MAX_RANK] = { 2, 5, 2, 2, 2}; - hsize_t stride_3[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t count_3[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t start_3[SS_DR_MAX_RANK] = { 2, 5, 2, 2, 2}; + hsize_t stride_3[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t count_3[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t block_3[SS_DR_MAX_RANK] = { 2, 3, 2, 2, 2}; - hsize_t start_4[SS_DR_MAX_RANK] = { 5, 2, 2, 2, 2}; - hsize_t stride_4[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t count_4[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t start_4[SS_DR_MAX_RANK] = { 5, 2, 2, 2, 2}; + hsize_t stride_4[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t count_4[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t block_4[SS_DR_MAX_RANK] = { 3, 2, 2, 2, 2}; - hsize_t clip_start[SS_DR_MAX_RANK] = { 0, 0, 0, 0, 0}; - hsize_t clip_stride[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t clip_count[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; + hsize_t clip_start[SS_DR_MAX_RANK] = { 0, 0, 0, 0, 0}; + hsize_t clip_stride[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; + hsize_t clip_count[SS_DR_MAX_RANK] = { 1, 1, 1, 1, 1}; hsize_t clip_block[SS_DR_MAX_RANK] = {10, 10, 10, 10, 10}; - hsize_t *(starts[SS_DR_MAX_RANK]) = - {start_0, start_1, start_2, start_3, start_4}; + hsize_t *(starts[SS_DR_MAX_RANK]) = + {start_0, start_1, start_2, start_3, start_4}; hsize_t *(strides[SS_DR_MAX_RANK]) = - {stride_0, stride_1, stride_2, stride_3, stride_4}; + {stride_0, stride_1, stride_2, stride_3, stride_4}; hsize_t *(counts[SS_DR_MAX_RANK]) = - {count_0, count_1, count_2, count_3, count_4}; + {count_0, count_1, count_2, count_3, count_4}; hsize_t *(blocks[SS_DR_MAX_RANK]) = - {block_0, block_1, block_2, block_3, block_4}; - - hsize_t start[SS_DR_MAX_RANK]; - hsize_t * start_ptr; - hsize_t stride[SS_DR_MAX_RANK]; - hsize_t * stride_ptr; - hsize_t count[SS_DR_MAX_RANK]; - hsize_t * count_ptr; - hsize_t block[SS_DR_MAX_RANK]; - hsize_t * block_ptr; - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + {block_0, block_1, block_2, block_3, block_4}; + + hsize_t start[SS_DR_MAX_RANK]; + hsize_t * start_ptr; + hsize_t stride[SS_DR_MAX_RANK]; + hsize_t * stride_ptr; + hsize_t count[SS_DR_MAX_RANK]; + hsize_t * count_ptr; + hsize_t block[SS_DR_MAX_RANK]; + hsize_t * block_ptr; + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ HDassert( 0 < small_rank ); HDassert( small_rank <= large_rank ); @@ -11515,13 +11515,13 @@ test_shape_same_dr__irregular(int test_num, HDassert( dims_selected >= 0 ); HDassert( dims_selected <= large_rank ); - sprintf(test_desc_0, + HDsprintf(test_desc_0, "\tirregular sub set of n-cube slice through m-cube (n <= m) test %d.\n", test_num); MESSAGE(7, (test_desc_0)); /* This statement must be updated if SS_DR_MAX_RANK is changed */ - sprintf(test_desc_1, + HDsprintf(test_desc_1, "\tranks: %d/%d edge: %d s/p offset: %d/%d dim_selected: %d/%d/%d/%d/%d:%d.\n", small_rank, large_rank, edge_size, @@ -11553,23 +11553,23 @@ test_shape_same_dr__irregular(int test_num, * In the 1-D case, the projection of the pattern looks * like this: * - * - - * * - * * * - - + * - - * * - * * * - - * 0 1 2 3 4 5 6 7 8 9 x * * and in the 2-D case, it would look like this: * * - * y - * 9 - - - - - - - - - - - * 8 - - - - - - - - - - - * 7 - - * * - - - - - - - * 6 - - * * - - - - - - - * 5 - - * * - - - - - - - * 4 - - - - - - - - - - - * 3 - - * * - * * * - - - * 2 - - * * - * * * - - - * 1 - - - - - - - - - - - * 0 - - - - - - - - - - + * y + * 9 - - - - - - - - - - + * 8 - - - - - - - - - - + * 7 - - * * - - - - - - + * 6 - - * * - - - - - - + * 5 - - * * - - - - - - + * 4 - - - - - - - - - - + * 3 - - * * - * * * - - + * 2 - - * * - * * * - - + * 1 - - - - - - - - - - + * 0 - - - - - - - - - - * 0 1 2 3 4 5 6 7 8 9 x * * In both cases, asterisks indicate selected elements, @@ -11686,13 +11686,13 @@ test_shape_same_dr__irregular(int test_num, ** ** test_shape_same_dr__run_irregular_tests(): ** -** In this set of tests, we test H5Sselect_shape_same() +** In this set of tests, we test H5Sselect_shape_same() ** with an "irregular" subselection of 1, 2, 3, and 4 cubes as ** one parameter, and irregular subselections of 1, 2, 3, ** and 4 dimensional slices through a n-cube of rank no more ** than 5 (and at least the rank of the slice) as the other. ** Note that the "irregular" selection may be offset between -** the n-cube and the slice. +** the n-cube and the slice. ** ** All the irregular selections will be identical (modulo rank) ** so H5Sselect_shape_same() should return true iff: @@ -11900,7 +11900,7 @@ test_shape_same_dr__run_irregular_tests(void) ** ** test_shape_same_dr(): Tests selections on dataspace with ** different ranks, to verify that "shape same" routine -** is now handling this case correctly. +** is now handling this case correctly. ** ****************************************************************/ static void @@ -12644,7 +12644,7 @@ test_space_rebuild(void) CHECK(ret, FAIL, "H5Sclose"); } - + /**************************************************************** ** ** test_space_update_diminfo(): Tests selection diminfo update @@ -13429,7 +13429,7 @@ test_space_update_diminfo(void) CHECK(ret, FAIL, "H5Sclose"); } /* end test_space_update_diminfo() */ - + /**************************************************************** ** ** test_select_hyper_chunk_offset(): Tests selections on dataspace, @@ -14550,33 +14550,33 @@ test_hyper_unlim(void) static void test_internal_consistency(void) { - hid_t all_sid; /* Dataspace ID with "all" selection */ - hid_t none_sid; /* Dataspace ID with "none" selection */ - hid_t single_pt_sid; /* Dataspace ID with single point selection */ - hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */ - hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */ - hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab + hid_t all_sid; /* Dataspace ID with "all" selection */ + hid_t none_sid; /* Dataspace ID with "none" selection */ + hid_t single_pt_sid; /* Dataspace ID with single point selection */ + hid_t mult_pt_sid; /* Dataspace ID with multiple point selection */ + hid_t single_hyper_sid; /* Dataspace ID with single block hyperslab selection */ + hid_t single_hyper_all_sid; /* Dataspace ID with single block hyperslab * selection that is the entire dataspace */ - hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab + hid_t single_hyper_pt_sid; /* Dataspace ID with single block hyperslab * selection that is the same as the single * point selection */ - hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */ - hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */ - hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */ - hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */ - hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */ - hid_t tmp_sid; /* Temporary dataspace ID */ - hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2}; - hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ - hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */ + hid_t regular_hyper_sid; /* Dataspace ID with regular hyperslab selection */ + hid_t irreg_hyper_sid; /* Dataspace ID with irregular hyperslab selection */ + hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */ + hid_t scalar_all_sid; /* ID for scalar dataspace with "all" selection */ + hid_t scalar_none_sid; /* ID for scalar dataspace with "none" selection */ + hid_t tmp_sid; /* Temporary dataspace ID */ + hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2}; + hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ + hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */ hsize_t start[SPACE9_RANK]; /* Hyperslab start */ hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */ hsize_t count[SPACE9_RANK]; /* Hyperslab block count */ hsize_t block[SPACE9_RANK]; /* Hyperslab block size */ - htri_t check; /* Shape comparison return value */ - herr_t ret; /* Generic return value */ + htri_t check; /* Shape comparison return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Consistency of Internal States\n")); @@ -14721,59 +14721,59 @@ test_internal_consistency(void) /* Test all the selections created */ - /* Test the copy of itself */ - tmp_sid=H5Scopy(all_sid); - CHECK(tmp_sid, FAIL, "H5Scopy"); + /* Test the copy of itself */ + tmp_sid=H5Scopy(all_sid); + CHECK(tmp_sid, FAIL, "H5Scopy"); - check = H5S__internal_consistency_test(tmp_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + check = H5S__internal_consistency_test(tmp_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - ret = H5Sclose(tmp_sid); - CHECK(ret, FAIL, "H5Sclose"); + ret = H5Sclose(tmp_sid); + CHECK(ret, FAIL, "H5Sclose"); - /* Test "none" selection */ - check = H5S__internal_consistency_test(none_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test "none" selection */ + check = H5S__internal_consistency_test(none_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test single point selection */ - check = H5S__internal_consistency_test(single_pt_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test single point selection */ + check = H5S__internal_consistency_test(single_pt_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test multiple point selection */ - check = H5S__internal_consistency_test(mult_pt_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test multiple point selection */ + check = H5S__internal_consistency_test(mult_pt_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test "plain" single hyperslab selection */ - check = H5S__internal_consistency_test(single_hyper_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test "plain" single hyperslab selection */ + check = H5S__internal_consistency_test(single_hyper_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test "all" single hyperslab selection */ - check = H5S__internal_consistency_test(single_hyper_all_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test "all" single hyperslab selection */ + check = H5S__internal_consistency_test(single_hyper_all_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test "single point" single hyperslab selection */ - check = H5S__internal_consistency_test(single_hyper_pt_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test "single point" single hyperslab selection */ + check = H5S__internal_consistency_test(single_hyper_pt_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test regular, strided hyperslab selection */ - check = H5S__internal_consistency_test(regular_hyper_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test regular, strided hyperslab selection */ + check = H5S__internal_consistency_test(regular_hyper_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test irregular hyperslab selection */ - check = H5S__internal_consistency_test(irreg_hyper_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test irregular hyperslab selection */ + check = H5S__internal_consistency_test(irreg_hyper_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test "no" hyperslab selection */ - check = H5S__internal_consistency_test(none_hyper_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test "no" hyperslab selection */ + check = H5S__internal_consistency_test(none_hyper_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test scalar "all" hyperslab selection */ - check = H5S__internal_consistency_test(scalar_all_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test scalar "all" hyperslab selection */ + check = H5S__internal_consistency_test(scalar_all_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); - /* Test scalar "none" hyperslab selection */ - check = H5S__internal_consistency_test(scalar_none_sid); - VERIFY(check, TRUE, "H5S__internal_consistency_test"); + /* Test scalar "none" hyperslab selection */ + check = H5S__internal_consistency_test(scalar_none_sid); + VERIFY(check, TRUE, "H5S__internal_consistency_test"); /* Close dataspaces */ ret = H5Sclose(all_sid); @@ -14816,9 +14816,9 @@ test_irreg_io(void) hid_t dcpl_id; /* Dataset creation property list ID */ hid_t sid; /* File dataspace ID */ hid_t mem_sid; /* Memory dataspace ID */ - hsize_t dims[] = {6, 12}; /* Dataspace dimensions */ - hsize_t chunk_dims[] = {2, 2}; /* Chunk dimensions */ - hsize_t mem_dims[] = {32}; /* Memory dataspace dimensions */ + hsize_t dims[] = {6, 12}; /* Dataspace dimensions */ + hsize_t chunk_dims[] = {2, 2}; /* Chunk dimensions */ + hsize_t mem_dims[] = {32}; /* Memory dataspace dimensions */ hsize_t start[2]; /* Hyperslab start */ hsize_t stride[2]; /* Hyperslab stride */ hsize_t count[2]; /* Hyperslab block count */ @@ -14826,7 +14826,7 @@ test_irreg_io(void) unsigned char wbuf[72]; /* Write buffer */ unsigned char rbuf[32]; /* Read buffer */ unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Irregular Hyperslab I/O\n")); @@ -14909,8 +14909,8 @@ test_sel_iter(void) { hid_t sid; /* Dataspace ID */ hid_t iter_id; /* Dataspace selection iterator ID */ - hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ - hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ + hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ + hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ hsize_t start[2]; /* Hyperslab start */ hsize_t stride[2]; /* Hyperslab stride */ hsize_t count[2]; /* Hyperslab block count */ @@ -14922,7 +14922,7 @@ test_sel_iter(void) H5S_sel_type sel_type; /* Selection type */ unsigned sel_share; /* Whether to share selection with dataspace */ unsigned sel_iter_flags; /* Flags for selection iterator creation */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Dataspace Selection Iterators\n")); @@ -15177,26 +15177,26 @@ test_sel_iter(void) /**************************************************************** ** ** test_select_intersect_block(): Test selections on dataspace, -** verify that "intersect block" routine is working correctly. +** verify that "intersect block" routine is working correctly. ** ****************************************************************/ static void test_select_intersect_block(void) { hid_t sid; /* Dataspace ID */ - hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ + hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ hsize_t block_start[] = {1, 3}; /* Start offset for block */ hsize_t block_end[] = {2, 5}; /* End offset for block */ hsize_t block_end2[] = {0, 5}; /* Bad end offset for block */ hsize_t block_end3[] = {2, 2}; /* Another bad end offset for block */ hsize_t block_end4[] = {1, 3}; /* End offset that makes a single element block */ - hsize_t coord[10][2]; /* Coordinates for point selection */ - hsize_t start[2]; /* Starting location of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Element count of hyperslab */ - hsize_t block[2]; /* Block size of hyperslab */ + hsize_t coord[10][2]; /* Coordinates for point selection */ + hsize_t start[2]; /* Starting location of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Element count of hyperslab */ + hsize_t block[2]; /* Block size of hyperslab */ htri_t status; /* Intersection status */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(6, ("Testing Dataspace Selection Block Intersection\n")); @@ -15316,7 +15316,7 @@ test_select_intersect_block(void) CHECK(ret, FAIL, "H5Sclose"); } /* test_select_intersect_block() */ - + /**************************************************************** ** ** test_select(): Main H5S selection testing routine. @@ -15332,7 +15332,7 @@ test_select(void) size_t rdcc_nbytes; /* Raw data number of bytes */ double rdcc_w0; /* Raw data write percentage */ hssize_t offset[SPACE7_RANK] = {1, 1}; /* Offset for testing selection offsets */ - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Selections\n")); @@ -15501,15 +15501,15 @@ test_select(void) test_select_intersect_block(); } /* test_select() */ - + /*------------------------------------------------------------------------- - * Function: cleanup_select + * Function: cleanup_select * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: none * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * July 2, 1998 * *------------------------------------------------------------------------- diff --git a/test/tunicode.c b/test/tunicode.c index 255dc50..b3fa237 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -774,15 +774,15 @@ void dump_string(const char * string) size_t length; size_t x; - printf("The string was:\n %s", string); - printf("Or in hex:\n"); + HDprintf("The string was:\n %s", string); + HDprintf("Or in hex:\n"); length = HDstrlen(string); for(x=0; x * Friday, September 25, 1998 * - * Purpose: Test unlinking operations. + * Purpose: Test unlinking operations. */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ /* Define this macro to indicate that the testing APIs should be available */ #define H5G_TESTING #include "h5test.h" -#include "H5Gpkg.h" /* Groups */ +#include "H5Gpkg.h" /* Groups */ const char *FILENAME[] = { "unlink", @@ -77,18 +77,18 @@ const char *FILENAME[] = { #define FULL_GROUP_EST_NUM_ENTRIES 8 #define FULL_GROUP_EST_ENTRY_LEN 9 - + /*------------------------------------------------------------------------- - * Function: test_one + * Function: test_one * - * Purpose: Creates a group that has just one entry and then unlinks that - * entry. + * Purpose: Creates a group that has just one entry and then unlinks that + * entry. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -98,8 +98,8 @@ const char *FILENAME[] = { static int test_one(hid_t file) { - hid_t work = -1, grp = -1; - herr_t status; + hid_t work = -1, grp = -1; + herr_t status; /* Create a test group */ if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -122,10 +122,10 @@ test_one(hid_t file) TESTING("unlink without a name"); if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Ldelete(grp, ".", H5P_DEFAULT); + status = H5Ldelete(grp, ".", H5P_DEFAULT); } H5E_END_TRY; if(status>=0) - FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") + FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Cleanup */ @@ -136,23 +136,23 @@ test_one(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(grp); + H5Gclose(work); + H5Gclose(grp); } H5E_END_TRY; return 1; } /* end test_one() */ - + /*------------------------------------------------------------------------- - * Function: test_many + * Function: test_many * - * Purpose: Tests many unlinks in a single directory. + * Purpose: Tests many unlinks in a single directory. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -162,10 +162,10 @@ test_one(hid_t file) static int test_many(hid_t file) { - hid_t work=-1, grp=-1; - int i; - const int how_many=500; - char name[32]; + hid_t work=-1, grp=-1; + int i; + const int how_many=500; + char name[32]; /* Create a test group */ if((work = H5Gcreate2(file, "/test_many", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -175,54 +175,54 @@ test_many(hid_t file) /* Create a bunch of names and unlink them in order */ TESTING("forward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them in reverse order */ TESTING("backward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { - sprintf(name, "obj_%05d", i); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them from both directions */ TESTING("inward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { - if(i % 2) - sprintf(name, "obj_%05d", how_many - (1 + i / 2)); - else - sprintf(name, "obj_%05d", i / 2); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(i % 2) + HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + HDsprintf(name, "obj_%05d", i / 2); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); /* Create a bunch of names and unlink them from the midle */ TESTING("outward unlink"); for(i = 0; i < how_many; i++) { - sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + HDsprintf(name, "obj_%05d", i); + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { - if(i % 2) - sprintf(name, "obj_%05d", how_many - (1 + i / 2)); - else - sprintf(name, "obj_%05d", i / 2); - if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(i % 2) + HDsprintf(name, "obj_%05d", how_many - (1 + i / 2)); + else + HDsprintf(name, "obj_%05d", i / 2); + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -233,23 +233,23 @@ test_many(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(grp); + H5Gclose(work); + H5Gclose(grp); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- - * Function: test_symlink + * Function: test_symlink * - * Purpose: Tests removal of symbolic links. + * Purpose: Tests removal of symbolic links. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * *------------------------------------------------------------------------- @@ -257,7 +257,7 @@ test_many(hid_t file) static int test_symlink(hid_t file) { - hid_t work=-1; + hid_t work=-1; TESTING("symlink removal"); @@ -274,22 +274,22 @@ test_symlink(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); + H5Gclose(work); } H5E_END_TRY; return 1; } /* end test_symlink() */ - + /*------------------------------------------------------------------------- - * Function: test_rename + * Function: test_rename * - * Purpose: Tests H5Lmove() + * Purpose: Tests H5Lmove() * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -299,7 +299,7 @@ error: static int test_rename(hid_t file) { - hid_t work=-1, foo=-1, inner=-1; + hid_t work=-1, foo=-1, inner=-1; /* Create a test group and rename something */ TESTING("object renaming"); @@ -326,14 +326,14 @@ test_rename(hid_t file) error: H5E_BEGIN_TRY { - H5Gclose(work); - H5Gclose(foo); - H5Gclose(inner); + H5Gclose(work); + H5Gclose(foo); + H5Gclose(inner); } H5E_END_TRY; return 1; } /* end test_rename() */ - + /*------------------------------------------------------------------------- * Function: test_new_move * @@ -353,9 +353,9 @@ error: static int test_new_move(hid_t fapl) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a, file_b=(-1); + hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + char filename[1024]; TESTING("new move"); @@ -403,17 +403,17 @@ test_new_move(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } - + /*------------------------------------------------------------------------- * Function: check_new_move * @@ -433,10 +433,10 @@ test_new_move(hid_t fapl) static int check_new_move(hid_t fapl) { - hid_t file; - H5O_info_t oi_hard1, oi_hard2; - char filename[1024]; - char linkval[1024]; + hid_t file; + H5O_info_t oi_hard1, oi_hard2; + char filename[1024]; + char linkval[1024]; TESTING("check new move function"); @@ -473,7 +473,7 @@ error: return 1; } /* end check_new_move() */ - + /*------------------------------------------------------------------------- * Function: test_filespace * @@ -492,21 +492,21 @@ error: static int test_filespace(hid_t fapl) { - hid_t fapl_nocache; /* File access property list with raw data cache turned off */ - hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */ - hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */ - hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */ - hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */ - hid_t compact_dcpl; /* Dataset creation property list for compact dataset */ - hid_t file; /* File ID */ - hid_t group, group2; /* Group IDs */ - hid_t dataset, dataset2; /* Dataset IDs */ - hid_t space; /* Dataspace ID */ - hid_t type; /* Datatype ID */ - hid_t attr_space; /* Dataspace ID for attributes */ - hid_t attr; /* Attribute ID */ - char filename[1024]; /* Name of file to create */ - char objname[128]; /* Name of object to create */ + hid_t fapl_nocache; /* File access property list with raw data cache turned off */ + hid_t contig_dcpl; /* Dataset creation property list for contiguous dataset */ + hid_t early_chunk_dcpl; /* Dataset creation property list for chunked dataset & early allocation */ + hid_t late_chunk_dcpl; /* Dataset creation property list for chunked dataset & late allocation */ + hid_t comp_dcpl; /* Dataset creation property list for compressed, chunked dataset */ + hid_t compact_dcpl; /* Dataset creation property list for compact dataset */ + hid_t file; /* File ID */ + hid_t group, group2; /* Group IDs */ + hid_t dataset, dataset2; /* Dataset IDs */ + hid_t space; /* Dataspace ID */ + hid_t type; /* Datatype ID */ + hid_t attr_space; /* Dataspace ID for attributes */ + hid_t attr; /* Attribute ID */ + char filename[1024]; /* Name of file to create */ + char objname[128]; /* Name of object to create */ hsize_t dims[FILESPACE_NDIMS]= {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; /* Dataset dimensions */ hsize_t chunk_dims[FILESPACE_NDIMS]= {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2}; /* Chunk dimensions */ hsize_t attr_dims[FILESPACE_ATTR_NDIMS]= {FILESPACE_ATTR_DIM0, FILESPACE_ATTR_DIM1}; /* Attribute dimensions */ @@ -514,7 +514,7 @@ test_filespace(hid_t fapl) int *tmp_data; /* Temporary pointer to dataset buffer */ h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ - herr_t status; /* Function status return value */ + herr_t status; /* Function status return value */ unsigned u,v,w; /* Local index variables */ /* Metadata cache parameters */ @@ -806,7 +806,7 @@ test_filespace(hid_t fapl) /* Alternate adding attributes to each one */ for(u = 0; u < FILESPACE_NATTR; u++) { /* Set the name of the attribute to create */ - sprintf(objname,"%s %u",ATTRNAME,u); + HDsprintf(objname,"%s %u",ATTRNAME,u); /* Create an attribute on the first dataset */ if((attr = H5Acreate2(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -912,7 +912,7 @@ test_filespace(hid_t fapl) /* Create a many groups to remove */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(objname, "%s %u", GROUPNAME, u); + HDsprintf(objname, "%s %u", GROUPNAME, u); if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(group) < 0) FAIL_STACK_ERROR } /* end for */ @@ -920,7 +920,7 @@ test_filespace(hid_t fapl) /* Remove the all the groups */ /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for(u = UNLINK_NGROUPS; u > 0; u--) { - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -975,19 +975,19 @@ test_filespace(hid_t fapl) /* Create a complex group hierarchy to remove */ for(u = 0; u < FILESPACE_TOP_GROUPS; u++) { /* Create group */ - sprintf(objname,"%s %u",GROUPNAME,u); + HDsprintf(objname,"%s %u",GROUPNAME,u); if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create nested groups inside top groups */ for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); + HDsprintf(objname, "%s %u", GROUP2NAME, v); if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create datasets inside nested groups */ for(w = 0; w < FILESPACE_NDATASETS; w++) { /* Create & close a dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); + HDsprintf(objname, "%s %u", DATASETNAME, w); if((dataset = H5Dcreate2(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1004,19 +1004,19 @@ test_filespace(hid_t fapl) /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for(u = FILESPACE_TOP_GROUPS; u > 0; u--) { /* Open group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open nested groups inside top groups */ for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { /* Create group */ - sprintf(objname, "%s %u", GROUP2NAME, v); + HDsprintf(objname, "%s %u", GROUP2NAME, v); if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Remove datasets inside nested groups */ for(w = 0; w < FILESPACE_NDATASETS; w++) { /* Remove dataset */ - sprintf(objname, "%s %u", DATASETNAME, w); + HDsprintf(objname, "%s %u", DATASETNAME, w); if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1024,7 +1024,7 @@ test_filespace(hid_t fapl) if(H5Gclose(group2) < 0) FAIL_STACK_ERROR /* Remove nested group */ - sprintf(objname, "%s %u",GROUP2NAME, v); + HDsprintf(objname, "%s %u",GROUP2NAME, v); if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1032,7 +1032,7 @@ test_filespace(hid_t fapl) if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Remove top group */ - sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + HDsprintf(objname, "%s %u", GROUPNAME, (u - 1)); if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1232,7 +1232,7 @@ error: return 1; } /* end test_filespace() */ - + /*------------------------------------------------------------------------- * Function: test_create_unlink * @@ -1251,10 +1251,10 @@ error: static int test_create_unlink(const char *msg, hid_t fapl) { - hid_t file, group; + hid_t file, group; unsigned u; - char groupname[1024]; - char filename[1024]; + char groupname[1024]; + char filename[1024]; TESTING(msg); @@ -1265,25 +1265,25 @@ test_create_unlink(const char *msg, hid_t fapl) /* Create a many groups to remove */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(groupname, "%s %u", GROUPNAME, u); + HDsprintf(groupname, "%s %u", GROUPNAME, u); if((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf("group %s creation failed\n", groupname); + HDprintf("group %s creation failed\n", groupname); goto error; } /* end if */ if(H5Gclose (group) < 0) { H5_FAILED(); - printf("closing group %s failed\n", groupname); + HDprintf("closing group %s failed\n", groupname); goto error; } /* end if */ } /* end for */ /* Remove the all the groups */ for(u = 0; u < UNLINK_NGROUPS; u++) { - sprintf(groupname, "%s %u", GROUPNAME, u); + HDsprintf(groupname, "%s %u", GROUPNAME, u); if(H5Ldelete(file, groupname, H5P_DEFAULT) < 0) { H5_FAILED(); - printf("Unlinking group %s failed\n", groupname); + HDprintf("Unlinking group %s failed\n", groupname); goto error; } /* end if */ } /* end for */ @@ -1299,7 +1299,7 @@ error: return 1; } /* end test_create_unlink() */ - + /*------------------------------------------------------------------------- * Function: test_link_slashes * @@ -1320,7 +1320,7 @@ test_link_slashes(hid_t fapl) { hid_t fid; /* File ID */ hid_t gid, gid2; /* Group ID */ - char filename[1024]; + char filename[1024]; TESTING("creating links with multiple slashes"); @@ -1367,7 +1367,7 @@ error: return 1; } /* end test_link_slashes() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_slashes * @@ -1388,7 +1388,7 @@ test_unlink_slashes(hid_t fapl) { hid_t fid; /* File ID */ hid_t gid; /* Group ID */ - char filename[1024]; + char filename[1024]; TESTING("deleting links with multiple slashes"); @@ -1464,7 +1464,7 @@ delete_node(hid_t pid, hid_t id) return(0); } - + /*------------------------------------------------------------------------- * Function: test_unlink_rightleaf * @@ -1499,14 +1499,14 @@ test_unlink_rightleaf(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "Zone%d", n + 1); + HDsprintf(name, "Zone%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR } /* end for */ /* Unlink & re-create each group */ for (n = 0; n < ngroups; n++) { if(delete_node (rootid, gids[n]) < 0) TEST_ERROR - sprintf(name, "Zone%d", n + 1); + HDsprintf(name, "Zone%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR } /* end for */ @@ -1543,7 +1543,7 @@ error: return 1; } /* end test_unlink_rightleaf() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_rightnode * @@ -1578,7 +1578,7 @@ test_unlink_rightnode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "ZoneB%d", n + 1); + HDsprintf(name, "ZoneB%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1622,7 +1622,7 @@ error: return 1; } /* end test_unlink_rightnode() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_middlenode * @@ -1657,7 +1657,7 @@ test_unlink_middlenode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { - sprintf(name, "ZoneC%d", n + 1); + HDsprintf(name, "ZoneC%d", n + 1); if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ @@ -1844,7 +1844,7 @@ error: return 1; } /* end test_unlink_middlenode() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_dataset * @@ -1865,7 +1865,7 @@ static int test_resurrect_dataset(hid_t fapl) { hid_t f = -1, s = -1, d = -1; - char filename[1024]; + char filename[1024]; TESTING("resurrecting dataset after deletion"); @@ -1908,14 +1908,14 @@ test_resurrect_dataset(hid_t fapl) error: H5E_BEGIN_TRY { - H5Sclose(s); - H5Dclose(d); - H5Fclose(f); + H5Sclose(s); + H5Dclose(d); + H5Fclose(f); } H5E_END_TRY; return 1; } /* end test_resurrect_dataset() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_datatype * @@ -1978,13 +1978,13 @@ test_resurrect_datatype(hid_t fapl) error: H5E_BEGIN_TRY { - H5Tclose(type); - H5Fclose(file); + H5Tclose(type); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_resurrect_datatype() */ - + /*------------------------------------------------------------------------- * Function: test_resurrect_group * @@ -2046,13 +2046,13 @@ test_resurrect_group(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(group); - H5Fclose(file); + H5Gclose(group); + H5Fclose(file); } H5E_END_TRY; return 1; } /* end test_resurrect_group() */ - + /*------------------------------------------------------------------------- * Function: test_unlink_chunked_dataset * @@ -2129,15 +2129,15 @@ test_unlink_chunked_dataset(hid_t fapl) error: H5E_BEGIN_TRY { - H5Pclose(dcpl_id); - H5Sclose(space_id); - H5Dclose(dset_id); - H5Fclose(file_id); + H5Pclose(dcpl_id); + H5Sclose(space_id); + H5Dclose(dset_id); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_unlink_chunked_dataset() */ - + /*------------------------------------------------------------------------- * Function: test_full_group_compact * @@ -2156,7 +2156,7 @@ test_full_group_compact(hid_t fapl) { hid_t file_id = -1; hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2177,7 +2177,7 @@ test_full_group_compact(hid_t fapl) /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "keep %u\n", u); + HDsprintf(objname, "keep %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2205,14 +2205,14 @@ test_full_group_compact(hid_t fapl) /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); - sprintf(objname2, "keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname2, "keep %u\n", u); if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_COMPACT; u++) { - sprintf(objname, "delete %u\n", u); + HDsprintf(objname, "delete %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2227,7 +2227,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2244,7 +2244,7 @@ test_full_group_compact(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2263,14 +2263,14 @@ test_full_group_compact(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Fclose(file_id); + H5Gclose(gid2); + H5Gclose(gid); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_full_group_compact() */ - + /*------------------------------------------------------------------------- * Function: test_full_group_dense * @@ -2290,7 +2290,7 @@ test_full_group_dense(hid_t fapl) hid_t file_id = -1; hid_t gcpl = (-1); /* Group creation property list ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - H5O_info_t oi; /* Stat buffer for object */ + H5O_info_t oi; /* Stat buffer for object */ char objname[128]; /* Buffer for name of objects to create */ char objname2[128]; /* Buffer for name of objects to create */ char filename[1024]; /* Buffer for filename */ @@ -2311,7 +2311,7 @@ test_full_group_dense(hid_t fapl) /* Create several objects to link to */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "keep %u\n", u); + HDsprintf(objname, "keep %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2351,14 +2351,14 @@ test_full_group_dense(hid_t fapl) /* Create hard links to objects in group to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); - sprintf(objname2, "keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname2, "keep %u\n", u); if(H5Lcreate_hard(file_id, objname, gid, objname2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Create several objects to delete */ for(u = 0; u < FULL_GROUP_NUM_DELETE_DENSE; u++) { - sprintf(objname, "delete %u\n", u); + HDsprintf(objname, "delete %u\n", u); if((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR } /* end for */ @@ -2373,7 +2373,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 2) TEST_ERROR } /* end for */ @@ -2390,7 +2390,7 @@ test_full_group_dense(hid_t fapl) /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { - sprintf(objname, "/keep/keep %u\n", u); + HDsprintf(objname, "/keep/keep %u\n", u); if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(oi.rc != 1) TEST_ERROR } /* end for */ @@ -2409,25 +2409,25 @@ test_full_group_dense(hid_t fapl) error: H5E_BEGIN_TRY { - H5Gclose(gid2); - H5Gclose(gid); - H5Pclose(gcpl); - H5Fclose(file_id); + H5Gclose(gid2); + H5Gclose(gid); + H5Pclose(gcpl); + H5Fclose(file_id); } H5E_END_TRY; return 1; } /* end test_full_group_dense() */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test unlinking operations + * Purpose: Test unlinking operations * - * Return: Success: zero + * Return: Success: zero * - * Failure: non-zero + * Failure: non-zero * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Friday, September 25, 1998 * * Modifications: @@ -2437,10 +2437,10 @@ error: int main(void) { - hid_t fapl, fapl2, file; - int nerrors = 0; - char filename[1024]; - unsigned new_format; + hid_t fapl, fapl2, file; + int nerrors = 0; + char filename[1024]; + unsigned new_format; /* Metadata cache parameters */ int mdc_nelmts; @@ -2467,11 +2467,11 @@ main(void) /* Set the FAPL for the type of format */ if(new_format) { - puts("\nTesting with new group format:"); + HDputs("\nTesting with new group format:"); my_fapl = fapl2; } /* end if */ else { - puts("Testing with old group format:"); + HDputs("Testing with old group format:"); my_fapl = fapl; } /* end else */ @@ -2500,12 +2500,12 @@ main(void) /* Get FAPL cache settings */ if(H5Pget_cache(fapl_small_mdc, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) - printf("H5Pget_cache failed\n"); + HDprintf("H5Pget_cache failed\n"); /* Change FAPL cache settings */ mdc_nelmts=1; if(H5Pset_cache(fapl_small_mdc, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) - printf("H5Pset_cache failed\n"); + HDprintf("H5Pset_cache failed\n"); /* Test creating & unlinking lots of objects with a 1-element metadata cache FAPL */ nerrors += test_create_unlink("create and unlink large number of objects with small cache", fapl_small_mdc); @@ -2550,11 +2550,11 @@ main(void) nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); if (nerrors) { - printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); + HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); exit(EXIT_FAILURE); } - puts("All unlink tests passed."); + HDputs("All unlink tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/use_common.c b/test/use_common.c index 3ecb2e1..b600dca 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -21,7 +21,7 @@ #include "use.h" -#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ #define H5D_TESTING #include "H5Dpkg.h" @@ -57,88 +57,88 @@ parse_option(int argc, char * const argv[]) opterr = 0; while (1){ - c = getopt (argc, argv, nagg_options); - if (-1 == c) - break; - switch (c) { - case 'h': - usage(progname_g); - exit(0); - break; - case 'f': /* usecase data file name */ - UC_opts.filename = optarg; - break; - case 'i': /* iterations */ - if ((UC_opts.iterations = HDatoi(optarg)) <= 0) { - fprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'l': /* launch reader or writer only */ - switch (*optarg) { - case 'r': /* reader only */ - UC_opts.launch = UC_READER; - break; - case 'w': /* writer only */ - UC_opts.launch = UC_WRITER; - break; - default: - fprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); - usage(progname_g); - Hgoto_error(-1); - break; - } - break; - case 'n': /* number of planes to write/read */ - if ((UC_opts.nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { - fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 's': /* use swmr file open mode */ + c = getopt (argc, argv, nagg_options); + if (-1 == c) + break; + switch (c) { + case 'h': + usage(progname_g); + exit(0); + break; + case 'f': /* usecase data file name */ + UC_opts.filename = optarg; + break; + case 'i': /* iterations */ + if ((UC_opts.iterations = HDatoi(optarg)) <= 0) { + HDfprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'l': /* launch reader or writer only */ + switch (*optarg) { + case 'r': /* reader only */ + UC_opts.launch = UC_READER; + break; + case 'w': /* writer only */ + UC_opts.launch = UC_WRITER; + break; + default: + HDfprintf(stderr, "launch value(%c) should be w or r only.\n", *optarg); + usage(progname_g); + Hgoto_error(-1); + break; + } + break; + case 'n': /* number of planes to write/read */ + if ((UC_opts.nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { + HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 's': /* use swmr file open mode */ use_swmr = HDatoi(optarg); - if (use_swmr != 0 && use_swmr != 1) { + if (use_swmr != 0 && use_swmr != 1) { HDfprintf(stderr, "swmr value should be 0(no) or 1(yes)\n"); usage(progname_g); Hgoto_error(-1); - } + } UC_opts.use_swmr = (hbool_t)use_swmr; - break; - case 'y': /* Number of planes per chunk */ - if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { - fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case 'z': /* size of chunk=(z,z) */ - if ((UC_opts.chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) { - fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); - usage(progname_g); - Hgoto_error(-1); - }; - break; - case '?': - fprintf(stderr, "getopt returned '%c'.\n", c); - Hgoto_error(-1); - default: - fprintf(stderr, "getopt returned unexpected value.\n"); - fprintf(stderr, "Unexpected value is %d\n", c); - Hgoto_error(-1); - } + break; + case 'y': /* Number of planes per chunk */ + if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) { + HDfprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case 'z': /* size of chunk=(z,z) */ + if ((UC_opts.chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) { + HDfprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg); + usage(progname_g); + Hgoto_error(-1); + }; + break; + case '?': + HDfprintf(stderr, "getopt returned '%c'.\n", c); + Hgoto_error(-1); + default: + HDfprintf(stderr, "getopt returned unexpected value.\n"); + HDfprintf(stderr, "Unexpected value is %d\n", c); + Hgoto_error(-1); + } } /* set test file name if not given */ if (!UC_opts.filename){ - /* default data file name is .h5 */ - if ((UC_opts.filename=(char*)HDmalloc(HDstrlen(progname_g)+4))==NULL) { - fprintf(stderr, "malloc: failed\n"); - Hgoto_error(-1); - }; - HDstrcpy(UC_opts.filename, progname_g); - HDstrcat(UC_opts.filename, ".h5"); + /* default data file name is .h5 */ + if ((UC_opts.filename=(char*)HDmalloc(HDstrlen(progname_g)+4))==NULL) { + HDfprintf(stderr, "malloc: failed\n"); + Hgoto_error(-1); + }; + HDstrcpy(UC_opts.filename, progname_g); + HDstrcat(UC_opts.filename, ".h5"); } done: @@ -148,31 +148,31 @@ done: /* Show parameters used for this use case */ void show_parameters(void){ - printf("===Parameters used:===\n"); - printf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)UC_opts.chunkdims[0], + HDprintf("===Parameters used:===\n"); + printf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)UC_opts.chunkdims[0], (unsigned long long)UC_opts.chunkdims[1], (unsigned long long)UC_opts.chunkdims[2]); - printf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)UC_opts.max_dims[0], + printf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)UC_opts.max_dims[0], (unsigned long long)UC_opts.max_dims[1], (unsigned long long)UC_opts.max_dims[2]); - printf("number of planes to write=%llu\n", (unsigned long long)UC_opts.nplanes); - printf("using SWMR mode=%s\n", UC_opts.use_swmr ? "yes(1)" : "no(0)"); - printf("data filename=%s\n", UC_opts.filename); - printf("launch part="); - switch (UC_opts.launch){ - case UC_READWRITE: - printf("Reader/Writer\n"); - break; - case UC_WRITER: - printf("Writer\n"); - break; - case UC_READER: - printf("Reader\n"); - break; - default: - /* should not happen */ - printf("Illegal part(%d)\n", UC_opts.launch); - }; - printf("number of iterations=%d (not used yet)\n", UC_opts.iterations); - printf("===Parameters shown===\n"); + HDprintf("number of planes to write=%llu\n", (unsigned long long)UC_opts.nplanes); + HDprintf("using SWMR mode=%s\n", UC_opts.use_swmr ? "yes(1)" : "no(0)"); + HDprintf("data filename=%s\n", UC_opts.filename); + HDprintf("launch part="); + switch (UC_opts.launch){ + case UC_READWRITE: + printf("Reader/Writer\n"); + break; + case UC_WRITER: + printf("Writer\n"); + break; + case UC_READER: + printf("Reader\n"); + break; + default: + /* should not happen */ + printf("Illegal part(%d)\n", UC_opts.launch); + }; + HDprintf("number of iterations=%d (not used yet)\n", UC_opts.iterations); + HDprintf("===Parameters shown===\n"); } /* Create the skeleton use case file for testing. @@ -185,7 +185,7 @@ void show_parameters(void){ */ int create_uc_file(void) { - hsize_t dims[3]; /* Dataset starting dimensions */ + hsize_t dims[3]; /* Dataset starting dimensions */ hid_t fid; /* File ID for new HDF5 file */ hid_t dcpl; /* Dataset creation property list */ hid_t sid; /* Dataspace ID */ @@ -217,7 +217,7 @@ int create_uc_file(void) /* create dataset of progname */ if((dsid = H5Dcreate2(fid, progname_g, UC_DATATYPE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - return -1; + return -1; /* Check that the chunk index type is not version 1 B-tree. * Version 1 B-trees are not supported under SWMR. @@ -225,13 +225,13 @@ int create_uc_file(void) if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) return -1; if(idx_type == H5D_CHUNK_IDX_BTREE) { - fprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n"); + HDfprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n"); return -1; } /* Close everything */ if(H5Dclose(dsid) < 0) - return -1; + return -1; if(H5Pclose(fapl) < 0) return -1; if(H5Pclose(dcpl) < 0) @@ -254,17 +254,17 @@ int create_uc_file(void) */ int write_uc_file(hbool_t tosend, hid_t fid) { - hid_t dsid; /* dataset ID */ - hid_t dcpl; /* Dataset creation property list */ - UC_CTYPE *buffer, *bufptr; /* data buffer */ - hsize_t cz=UC_opts.chunksize; /* Chunk size */ - hid_t f_sid; /* dataset file space id */ - hid_t m_sid; /* memory space id */ - int rank; /* rank */ - hsize_t chunk_dims[3]; /* Chunk dimensions */ - hsize_t dims[3]; /* Dataspace dimensions */ - hsize_t memdims[3]; /* Memory space dimensions */ - hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ + hid_t dsid; /* dataset ID */ + hid_t dcpl; /* Dataset creation property list */ + UC_CTYPE *buffer, *bufptr; /* data buffer */ + hsize_t cz=UC_opts.chunksize; /* Chunk size */ + hid_t f_sid; /* dataset file space id */ + hid_t m_sid; /* memory space id */ + int rank; /* rank */ + hsize_t chunk_dims[3]; /* Chunk dimensions */ + hsize_t dims[3]; /* Dataspace dimensions */ + hsize_t memdims[3]; /* Memory space dimensions */ + hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ hsize_t i, j, k; if(tosend) @@ -273,30 +273,30 @@ int write_uc_file(hbool_t tosend, hid_t fid) /* Open the dataset of the program name */ if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Dopen2 failed\n"); - return -1; + HDfprintf(stderr, "H5Dopen2 failed\n"); + return -1; } /* Find chunksize used */ if ((dcpl = H5Dget_create_plist(dsid)) < 0){ - fprintf(stderr, "H5Dget_create_plist failed\n"); - return -1; + HDfprintf(stderr, "H5Dget_create_plist failed\n"); + return -1; } if (H5D_CHUNKED != H5Pget_layout(dcpl)){ - fprintf(stderr, "storage layout is not chunked\n"); - return -1; + HDfprintf(stderr, "storage layout is not chunked\n"); + return -1; } if ((rank = H5Pget_chunk(dcpl, 3, chunk_dims)) != 3){ - fprintf(stderr, "storage rank is not 3\n"); - return -1; + HDfprintf(stderr, "storage rank is not 3\n"); + return -1; } /* verify chunk_dims against set paramenters */ if (chunk_dims[0]!=UC_opts.chunkdims[0] || chunk_dims[1] != cz || chunk_dims[2] != cz){ - fprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1], + HDfprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1], (unsigned long long)chunk_dims[2]); - return -1; + return -1; } /* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */ @@ -304,8 +304,8 @@ int write_uc_file(hbool_t tosend, hid_t fid) memdims[1] = UC_opts.dims[1]; memdims[2] = UC_opts.dims[2]; if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) { - fprintf(stderr, "malloc: failed\n"); - return -1; + HDfprintf(stderr, "malloc: failed\n"); + return -1; }; /* @@ -314,28 +314,28 @@ int write_uc_file(hbool_t tosend, hid_t fid) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK){ - fprintf(stderr, "rank(%d) of dataset does not match\n", rank); - return -1; + HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){ - fprintf(stderr, "H5Sget_simple_extent_dims got error\n"); - return -1; + HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + return -1; } - printf("dataset rank %d, dimensions %llu x %llu x %llu\n", - rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), + HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", + rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), (unsigned long long)(dims[2])); /* verify that file space dims are as expected and are consistent with memory space dims */ if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]){ - fprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)dims[0], (unsigned long long)dims[1], + HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); - return -1; + return -1; } - + /* setup mem-space for buffer */ if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){ - fprintf(stderr, "H5Screate_simple for memory failed\n"); - return -1; + HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + return -1; }; /* write planes */ @@ -343,73 +343,73 @@ int write_uc_file(hbool_t tosend, hid_t fid) count[1]=dims[1]; count[2]=dims[2]; for (i=0; i=30){ - HDfprintf(stderr, "waited too long for new plane, quit.\n"); - return -1; - } - }else{ + if (nonewplane>=30){ + HDfprintf(stderr, "waited too long for new plane, quit.\n"); + return -1; + } + }else{ /* print mesg only the first time; dots still no new plane */ HDprintf("no new planes to read "); - } - nonewplane++; - /* pause for a second */ + } + nonewplane++; + /* pause for a second */ HDsleep(1); - } - for (nplane=nplane_old; nplane < dims[0]; nplane++){ - /* read planes between last old nplanes and current extent */ - /* Get the dataset's dataspace */ - if((f_sid = H5Dget_space(dsid)) < 0){ + } + for (nplane=nplane_old; nplane < dims[0]; nplane++){ + /* read planes between last old nplanes and current extent */ + /* Get the dataset's dataspace */ + if((f_sid = H5Dget_space(dsid)) < 0){ HDfprintf(stderr, "H5Dget_space failed\n"); return -1; - } + } - start[0]=nplane; - /* Choose the next plane to read */ - if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ + start[0]=nplane; + /* Choose the next plane to read */ + if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){ HDfprintf(stderr, "H5Sselect_hyperslab failed\n"); return -1; - } + } - /* Read the plane from the dataset */ - if(H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ + /* Read the plane from the dataset */ + if(H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){ HDfprintf(stderr, "H5Dread failed\n"); return -1; - } + } - /* compare read data with expected data value which is nplane */ - bufptr = buffer; - nerrs=0; - for (j=0; j.h5 */ - if ((filename_g = (char*)HDmalloc(HDstrlen(progname_g)+4))==NULL) { - fprintf(stderr, "malloc: failed\n"); - Hgoto_error(-1); - }; - HDstrcpy(filename_g, progname_g); - HDstrcat(filename_g, ".h5"); + /* default data file name is .h5 */ + if ((filename_g = (char*)HDmalloc(HDstrlen(progname_g)+4))==NULL) { + HDfprintf(stderr, "malloc: failed\n"); + Hgoto_error(-1); + }; + HDstrcpy(filename_g, progname_g); + HDstrcat(filename_g, ".h5"); } done: @@ -162,35 +162,35 @@ done: } /* parse_option() */ /* Show parameters used for this use case */ -static void +static void show_parameters(void) { - printf("===Parameters used:===\n"); - printf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)chunkdims_g[0], + HDprintf("===Parameters used:===\n"); + HDprintf("chunk dims=(%llu, %llu, %llu)\n", (unsigned long long)chunkdims_g[0], (unsigned long long)chunkdims_g[1], (unsigned long long)chunkdims_g[2]); - printf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)max_dims_g[0], + HDprintf("dataset max dims=(%llu, %llu, %llu)\n", (unsigned long long)max_dims_g[0], (unsigned long long)max_dims_g[1], (unsigned long long)max_dims_g[2]); - printf("number of planes to write=%llu\n", (unsigned long long)nplanes_g); - printf("using SWMR mode=%s\n", use_swmr_g ? "yes(1)" : "no(0)"); - printf("data filename=%s\n", filename_g); - printf("===Parameters shown===\n"); + HDprintf("number of planes to write=%llu\n", (unsigned long long)nplanes_g); + HDprintf("using SWMR mode=%s\n", use_swmr_g ? "yes(1)" : "no(0)"); + HDprintf("data filename=%s\n", filename_g); + HDprintf("===Parameters shown===\n"); } /* show_parameters() */ -/* +/* * Setup parameters for the use case. * Return: 0 succeed; -1 fail. */ -static int +static int setup_parameters(int argc, char * const argv[]) { /* use case defaults */ chunksize_g = Chunksize_DFT; - use_swmr_g = 1; /* use swmr open */ + use_swmr_g = 1; /* use swmr open */ chunkplanes_g = 1; /* parse options */ if (parse_option(argc, argv) < 0){ - return(-1); + return(-1); } /* set chunk dims */ chunkdims_g[0] = chunkplanes_g; @@ -210,7 +210,7 @@ setup_parameters(int argc, char * const argv[]) return(0); } /* setup_parameters() */ -/* +/* * Create the skeleton use case file for testing. * It has one 3d dataset using chunked storage. * The dataset is (unlimited, chunksize, chunksize). @@ -219,10 +219,10 @@ setup_parameters(int argc, char * const argv[]) * * Return: 0 succeed; -1 fail. */ -static int +static int create_file(void) { - hsize_t dims[3]; /* Dataset starting dimensions */ + hsize_t dims[3]; /* Dataset starting dimensions */ hid_t fid; /* File ID for new HDF5 file */ hid_t dcpl; /* Dataset creation property list */ hid_t sid; /* Dataspace ID */ @@ -254,7 +254,7 @@ create_file(void) /* create dataset of progname */ if((dsid = H5Dcreate2(fid, progname_g, UC_DATATYPE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - return -1; + return -1; /* Check that the chunk index type is not version 1 B-tree. * Version 1 B-trees are not supported under SWMR. @@ -262,13 +262,13 @@ create_file(void) if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) return -1; if(idx_type == H5D_CHUNK_IDX_BTREE) { - fprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n"); + HDfprintf(stderr, "ERROR: Chunk index is version 1 B-tree: aborting.\n"); return -1; } /* Close everything */ if(H5Dclose(dsid) < 0) - return -1; + return -1; if(H5Pclose(fapl) < 0) return -1; if(H5Pclose(dcpl) < 0) @@ -281,7 +281,7 @@ create_file(void) return 0; } /* create_file() */ -/* +/* * Append planes, each of (1,2*chunksize,2*chunksize) to the dataset. * In other words, 4 chunks are appended to the dataset at a time. * Fill each plane with the plane number and then write it at the nth plane. @@ -290,24 +290,24 @@ create_file(void) * * Return: 0 succeed; -1 fail. */ -static int +static int write_file(void) { - hid_t fid; /* File ID for new HDF5 file */ - hid_t dsid; /* dataset ID */ - hid_t fapl; /* File access property list */ - hid_t dcpl; /* Dataset creation property list */ - char *name; - UC_CTYPE *buffer, *bufptr; /* data buffer */ - hsize_t cz=chunksize_g; /* Chunk size */ - hid_t f_sid; /* dataset file space id */ - hid_t m_sid; /* memory space id */ - int rank; /* rank */ - hsize_t chunk_dims[3]; /* Chunk dimensions */ - hsize_t dims[3]; /* Dataspace dimensions */ - hsize_t memdims[3]; /* Memory space dimensions */ - hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ - hbool_t disabled; /* Object's disabled status */ + hid_t fid; /* File ID for new HDF5 file */ + hid_t dsid; /* dataset ID */ + hid_t fapl; /* File access property list */ + hid_t dcpl; /* Dataset creation property list */ + char *name; + UC_CTYPE *buffer, *bufptr; /* data buffer */ + hsize_t cz=chunksize_g; /* Chunk size */ + hid_t f_sid; /* dataset file space id */ + hid_t m_sid; /* memory space id */ + int rank; /* rank */ + hsize_t chunk_dims[3]; /* Chunk dimensions */ + hsize_t dims[3]; /* Dataspace dimensions */ + hsize_t memdims[3]; /* Memory space dimensions */ + hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */ + hbool_t disabled; /* Object's disabled status */ hsize_t i, j, k; name = filename_g; @@ -319,51 +319,51 @@ write_file(void) if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) return -1; if((fid = H5Fopen(name, H5F_ACC_RDWR | (use_swmr_g ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){ - fprintf(stderr, "H5Fopen failed\n"); + HDfprintf(stderr, "H5Fopen failed\n"); return -1; } /* Open the dataset of the program name */ if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){ - fprintf(stderr, "H5Dopen2 failed\n"); - return -1; + HDfprintf(stderr, "H5Dopen2 failed\n"); + return -1; } /* Disabled mdc flushed for the dataset */ if(H5Odisable_mdc_flushes(dsid) < 0) { - fprintf(stderr, "H5Odisable_mdc_flushes failed\n"); - return -1; + HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n"); + return -1; } /* Get mdc disabled status of the dataset */ if(H5Oare_mdc_flushes_disabled(dsid, &disabled) < 0) { - fprintf(stderr, "H5Oare_mdc_flushes_disabled failed\n"); - return -1; + HDfprintf(stderr, "H5Oare_mdc_flushes_disabled failed\n"); + return -1; } else if(disabled) - printf("Dataset has disabled mdc flushes.\n"); + HDprintf("Dataset has disabled mdc flushes.\n"); else - printf("Dataset should have disabled its mdc flushes.\n"); + HDprintf("Dataset should have disabled its mdc flushes.\n"); /* Find chunksize used */ if ((dcpl = H5Dget_create_plist(dsid)) < 0){ - fprintf(stderr, "H5Dget_create_plist failed\n"); - return -1; + HDfprintf(stderr, "H5Dget_create_plist failed\n"); + return -1; } if (H5D_CHUNKED != H5Pget_layout(dcpl)){ - fprintf(stderr, "storage layout is not chunked\n"); - return -1; + HDfprintf(stderr, "storage layout is not chunked\n"); + return -1; } if ((rank = H5Pget_chunk(dcpl, 3, chunk_dims)) != 3){ - fprintf(stderr, "storage rank is not 3\n"); - return -1; + HDfprintf(stderr, "storage rank is not 3\n"); + return -1; } /* verify chunk_dims against set paramenters */ if (chunk_dims[0]!= chunkdims_g[0] || chunk_dims[1] != cz || chunk_dims[2] != cz){ - fprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1], + HDfprintf(stderr, "chunk size is not as expected. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)chunk_dims[0], (unsigned long long)chunk_dims[1], (unsigned long long)chunk_dims[2]); - return -1; + return -1; } /* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */ @@ -371,8 +371,8 @@ write_file(void) memdims[1] = dims_g[1]; memdims[2] = dims_g[2]; if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) { - fprintf(stderr, "malloc: failed\n"); - return -1; + HDfprintf(stderr, "malloc: failed\n"); + return -1; }; /* @@ -381,28 +381,28 @@ write_file(void) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK){ - fprintf(stderr, "rank(%d) of dataset does not match\n", rank); - return -1; + HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){ - fprintf(stderr, "H5Sget_simple_extent_dims got error\n"); - return -1; + HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + return -1; } - printf("dataset rank %d, dimensions %llu x %llu x %llu\n", - rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), + HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", + rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]), (unsigned long long)(dims[2])); /* verify that file space dims are as expected and are consistent with memory space dims */ if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]){ - fprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", - (unsigned long long)dims[0], (unsigned long long)dims[1], + HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", + (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); - return -1; + return -1; } - + /* setup mem-space for buffer */ if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){ - fprintf(stderr, "H5Screate_simple for memory failed\n"); - return -1; + HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + return -1; }; /* write planes */ @@ -410,82 +410,82 @@ write_file(void) count[1]=dims[1]; count[2]=dims[2]; for (i=0; i 255 || HDstrlen(obj2_fullpath) > 255) { - printf("The parallel diff only supports object names up to 255 characters\n"); + HDprintf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } /* end if */ @@ -1247,7 +1247,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD); } /* end else-if */ else { - printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); + HDprintf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); MPI_Finalize(); } /* end else */ @@ -1324,10 +1324,10 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - printf("%s", data); + HDprintf("%s", data); } /* end else-if */ else { - printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); + HDprintf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); } /* end else */ } /* end while */ diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index db61d51..cfe7422 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -20,7 +20,7 @@ */ static void print_filter_warning(const char *dname, const char *fname) { - fprintf(stderr, + HDfprintf(stderr, "Warning: dataset <%s> cannot be read, %s filter is not available\n", dname, fname); } diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 78240db..eb7b56d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -823,14 +823,14 @@ trav_attr(hid_t const char *buf = op_data->path; if((strlen(buf)==1) && (*buf=='/')) - printf(" %-10s %s%s", "attribute", buf, attr_name); + HDprintf(" %-10s %s%s", "attribute", buf, attr_name); else - printf(" %-10s %s/%s", "attribute", buf, attr_name); + HDprintf(" %-10s %s/%s", "attribute", buf, attr_name); #ifdef H5TRAV_PRINT_SPACE if(trav_verbosity < 2) { #endif - printf("\n"); + HDprintf("\n"); #ifdef H5TRAV_PRINT_SPACE } else { @@ -850,26 +850,26 @@ trav_attr(hid_t switch(space_type) { case H5S_SCALAR: /* scalar dataspace */ - printf(" scalar\n"); + HDprintf(" scalar\n"); break; case H5S_SIMPLE: /* simple dataspace */ - printf(" {"); + HDprintf(" {"); for (i = 0; i < ndims; i++) { - printf("%s" HSIZE_T_FORMAT, i?", ":"", size[i]); + HDprintf("%s" HSIZE_T_FORMAT, i?", ":"", size[i]); } - printf("}\n"); + HDprintf("}\n"); break; case H5S_NULL: /* null dataspace */ - printf(" null\n"); + HDprintf(" null\n"); break; default: /* Unknown dataspace type */ - printf(" unknown\n"); + HDprintf(" unknown\n"); break; } /* end switch */ @@ -903,22 +903,22 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, */ switch(oinfo->type) { case H5O_TYPE_GROUP: - printf(" %-10s %s", "group", path); + HDprintf(" %-10s %s", "group", path); break; case H5O_TYPE_DATASET: - printf(" %-10s %s", "dataset", path); + HDprintf(" %-10s %s", "dataset", path); break; case H5O_TYPE_NAMED_DATATYPE: - printf(" %-10s %s", "datatype", path); + HDprintf(" %-10s %s", "datatype", path); break; case H5O_TYPE_MAP: case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: default: - printf(" %-10s %s", "unknown object type", path); + HDprintf(" %-10s %s", "unknown object type", path); break; } /* end switch */ @@ -928,14 +928,14 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, op_data.path = path; /* Finish printing line about object */ - printf("\n"); + HDprintf("\n"); if(trav_verbosity > 0) H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, &op_data, H5P_DEFAULT); } else /* Print the link's original name */ - printf(" -> %s\n", already_visited); + HDprintf(" -> %s\n", already_visited); return(0); } /* end trav_print_visit_obj() */ @@ -963,12 +963,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) if(targbuf) { if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0) targbuf[0] = 0; - printf(" %-10s %s -> %s\n", "link", path, targbuf); + HDprintf(" %-10s %s -> %s\n", "link", path, targbuf); HDfree(targbuf); } } /* end if */ else - printf(" %-10s %s ->\n", "link", path); + HDprintf(" %-10s %s ->\n", "link", path); break; case H5L_TYPE_EXTERNAL: @@ -982,12 +982,12 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) if(H5Lget_val(print_udata->fid, path, targbuf, linfo->u.val_size + 1, H5P_DEFAULT) < 0) targbuf[0] = 0; if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &objname) >= 0) - printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); + HDprintf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname); HDfree(targbuf); } } /* end if */ else - printf(" %-10s %s ->\n", "ext link", path); + HDprintf(" %-10s %s ->\n", "ext link", path); break; case H5L_TYPE_HARD: @@ -997,7 +997,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata) case H5L_TYPE_ERROR: case H5L_TYPE_MAX: default: - printf(" %-10s %s -> ???\n", "unknown type of UD link", path); + HDprintf(" %-10s %s -> ???\n", "unknown type of UD link", path); break; } /* end switch() */ diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index ac8e4c0..8d489e4 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -25,27 +25,27 @@ #ifndef _H5TEST_ -#define AT() fprintf(stdout, " at %s:%d in %s()...\n", \ +#define UTIL_AT() HDfprintf(stdout, " at %s:%d in %s()...\n", \ __FILE__, __LINE__, FUNC); -#define FAILED(msg) { \ - fprintf(stdout, "*FAILED*"); AT() \ +#define UTIL_FAILED(msg) { \ + HDfprintf(stdout, "*FAILED*"); AT() \ if (msg == NULL) { \ - fprintf(stdout,"(NULL)\n"); \ + HDfprintf(stdout,"(NULL)\n"); \ } else { \ - fprintf(stdout, "%s\n", msg); \ + HDfprintf(stdout, "%s\n", msg); \ } \ - fflush(stdout); \ + HDfflush(stdout); \ } -#define TESTING(msg) { \ - fprintf(stdout, "TESTING %-62s", (msg)); \ - fflush(stdout); \ +#define UTIL_TESTING(msg) { \ + HDfprintf(stdout, "TESTING %-62s", (msg)); \ + HDfflush(stdout); \ } -#define PASSED() { \ - fprintf(stdout, " PASSED\n"); \ - fflush(stdout); \ +#define UTIL_PASSED() { \ + HDfprintf(stdout, " PASSED\n"); \ + HDfflush(stdout); \ } #endif /* ifndef _H5TEST_ */ @@ -60,7 +60,7 @@ * * Purpose: * - * 1. Upon test failure, goto-jump to single-location teardown in test + * 1. Upon test failure, goto-jump to single-location teardown in test * function. E.g., `error:` (consistency with HDF corpus) or * `failed:` (reflects purpose). * >>> using "error", in part because `H5E_BEGIN_TRY` expects it. @@ -69,22 +69,22 @@ * requires reading of entire line to know whether this if/call is * part of the test setup, test operation, or a test unto itself. * 3. Provide testing macros with optional user-supplied failure message; - * if not supplied (NULL), generate comparison output in the spirit of + * if not supplied (NULL), generate comparison output in the spirit of * test-driven development. E.g., "expected 5 but was -3" * User messages clarify test's purpose in code, encouraging description * without relying on comments. * 4. Configurable expected-actual order in generated comparison strings. - * Some prefer `VERIFY(expected, actual)`, others + * Some prefer `VERIFY(expected, actual)`, others * `VERIFY(actual, expected)`. Provide preprocessor ifdef switch * to satifsy both parties, assuming one paradigm per test file. * (One could #undef and redefine the flag through the file as desired, * but _why_.) * - * Provided as courtesy, per consideration for inclusion in the library + * Provided as courtesy, per consideration for inclusion in the library * proper. * * Macros: - * + * * JSVERIFY_EXP_ACT - ifdef flag, configures comparison order * FAIL_IF() - check condition * FAIL_UNLESS() - check _not_ condition @@ -97,19 +97,19 @@ * *****************************************************************************/ - + /*---------------------------------------------------------------------------- * * ifdef flag: JSVERIFY_EXP_ACT - * - * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) + * + * JSVERIFY macros accept arguments as (EXPECTED, ACTUAL[, reason]) * default, if this is undefined, is (ACTUAL, EXPECTED[, reason]) * *---------------------------------------------------------------------------- */ #define JSVERIFY_EXP_ACT 1L - + /*---------------------------------------------------------------------------- * * Macro: JSFAILED_AT() @@ -130,15 +130,15 @@ HDprintf("*FAILED* at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC); \ } - + /*---------------------------------------------------------------------------- * * Macro: FAIL_IF() * - * Purpose: + * Purpose: * * Make tests more accessible and less cluttered than - * `if (thing == otherthing()) TEST_ERROR` + * `if (thing == otherthing()) TEST_ERROR` * paradigm. * * The following lines are roughly equivalent: @@ -160,7 +160,7 @@ if (condition) { \ goto error; \ } - + /*---------------------------------------------------------------------------- * * Macro: FAIL_UNLESS() @@ -169,7 +169,7 @@ if (condition) { \ * * TEST_ERROR wrapper to reduce cognitive overhead from "negative tests", * e.g., "a != b". - * + * * Opposite of FAIL_IF; fails if the given condition is _not_ true. * * `FAIL_IF( 5 != my_op() )` @@ -189,7 +189,7 @@ if (!(condition)) { \ goto error; \ } - + /*---------------------------------------------------------------------------- * * Macro: JSERR_LONG() @@ -225,7 +225,7 @@ if (!(condition)) { \ } \ } - + /*---------------------------------------------------------------------------- * * Macro: JSERR_STR() @@ -266,15 +266,15 @@ if (!(condition)) { \ #ifdef JSVERIFY_EXP_ACT - + /*---------------------------------------------------------------------------- * * Macro: JSVERIFY() * - * Purpose: + * Purpose: * * Verify that two long integers are equal. - * If unequal, print failure message + * If unequal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -289,15 +289,15 @@ if ((long)(actual) != (long)(expected)) { \ goto error; \ } /* JSVERIFY */ - + /*---------------------------------------------------------------------------- * * Macro: JSVERIFY_NOT() * - * Purpose: + * Purpose: * * Verify that two long integers are _not_ equal. - * If equal, print failure message + * If equal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -312,15 +312,15 @@ if ((long)(actual) == (long)(expected)) { \ goto error; \ } /* JSVERIFY_NOT */ - + /*---------------------------------------------------------------------------- * * Macro: JSVERIFY_STR() * - * Purpose: + * Purpose: * * Verify that two strings are equal. - * If unequal, print failure message + * If unequal, print failure message * (with `reason`, if not NULL; expected/actual if NULL) * and jump to `error` at end of function * @@ -335,11 +335,11 @@ if (HDstrcmp((actual), (expected)) != 0) { \ goto error; \ } /* JSVERIFY_STR */ - + #else /* JSVERIFY_EXP_ACT not defined */ /* Repeats macros above, but with actual/expected parameters reversed. */ - + /*---------------------------------------------------------------------------- * Macro: JSVERIFY() * See: JSVERIFY documentation above. @@ -353,7 +353,7 @@ if ((long)(actual) != (long)(expected)) { \ goto error; \ } /* JSVERIFY */ - + /*---------------------------------------------------------------------------- * Macro: JSVERIFY_NOT() * See: JSVERIFY_NOT documentation above. @@ -367,7 +367,7 @@ if ((long)(actual) == (long)(expected)) { \ goto error; \ } /* JSVERIFY_NOT */ - + /*---------------------------------------------------------------------------- * Macro: JSVERIFY_STR() * See: JSVERIFY_STR documentation above. @@ -392,12 +392,12 @@ if (HDstrcmp((actual), (expected)) != 0) { \ /* TEST FUNCTIONS */ /******************/ - + /*---------------------------------------------------------------------------- * * Function: test_parse_tuple() * - * Purpose: + * Purpose: * * Provide unit tests and specification for the `parse_tuple()` function. * @@ -548,7 +548,7 @@ test_parse_tuple(void) - TESTING("arbitrary-count tuple parsing"); + UTIL_TESTING("arbitrary-count tuple parsing"); #if H5TOOLS_UTILS_TEST_DEBUG > 0 show_progress = TRUE; @@ -566,13 +566,12 @@ test_parse_tuple(void) HDassert(cpy == NULL); tc = cases[i]; if (show_progress == TRUE) { - printf("testing %d: %s...\n", i, tc.test_msg); + HDprintf("testing %d: %s...\n", i, tc.test_msg); } /* VERIFY */ - success = parse_tuple(tc.in_str, tc.sep, - &cpy, &count, &parsed); + success = parse_tuple(tc.in_str, tc.sep, &cpy, &count, &parsed); JSVERIFY( tc.exp_ret, success, "function returned incorrect value" ) JSVERIFY( tc.exp_nelems, count, NULL ) @@ -584,9 +583,9 @@ test_parse_tuple(void) /* TEARDOWN */ HDassert(parsed != NULL); HDassert(cpy != NULL); - free(parsed); + HDfree(parsed); parsed = NULL; - free(cpy); + HDfree(cpy); cpy = NULL; } else { FAIL_IF( parsed != NULL ) @@ -602,14 +601,14 @@ error: * CLEANUP * ***********/ - if (parsed != NULL) free(parsed); - if (cpy != NULL) free(cpy); + if (parsed != NULL) HDfree(parsed); + if (cpy != NULL) HDfree(cpy); return 1; } /* test_parse_tuple */ - + /*---------------------------------------------------------------------------- * * Function: test_populate_ros3_fa() @@ -642,12 +641,12 @@ test_populate_ros3_fa(void) int bad_version = 0xf87a; /* arbitrarily wrong version number */ #endif /* H5_HAVE_ROS3_VFD */ - TESTING("programmatic ros3 fapl population"); + UTIL_TESTING("programmatic ros3 fapl population"); #ifndef H5_HAVE_ROS3_VFD - puts(" -SKIP-"); - puts(" Read-Only S3 VFD not enabled"); - fflush(stdout); + HDputs(" -SKIP-"); + HDputs(" Read-Only S3 VFD not enabled"); + HDfflush(stdout); return 0; #else #if H5TOOLS_UTILS_TEST_DEBUG > 0 @@ -687,7 +686,7 @@ test_populate_ros3_fa(void) JSVERIFY_STR( "", fa.secret_key, NULL ) } - /* all-empty values + /* all-empty values * yields default fapl */ { @@ -705,7 +704,7 @@ test_populate_ros3_fa(void) JSVERIFY_STR( "", fa.secret_key, NULL ) } - /* successfully set fapl with values + /* successfully set fapl with values * excess value is ignored */ { @@ -985,7 +984,7 @@ error : } /* test_populate_ros3_fa */ - + /*---------------------------------------------------------------------------- * * Function: test_set_configured_fapl() @@ -1173,7 +1172,7 @@ test_set_configured_fapl(void) n_cases += 5; #endif /* H5_HAVE_LIBHDFS */ - TESTING("programmatic fapl set"); + UTIL_TESTING("programmatic fapl set"); for (unsigned i = 0; i < n_cases; i++) { int result; @@ -1247,7 +1246,7 @@ error : #undef UTIL_TEST_CREATE } /* test_set_configured_fapl */ - + /*---------------------------------------------------------------------------- * * Function: main() diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 1800810..9490cd9 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -381,10 +381,10 @@ main (int argc, const char *argv[]) *-------------------------------------------------------------------------*/ if (verbose) { - printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", + HDprintf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", fname_src, oname_src, fname_dst, oname_dst); if (flag) { - printf("Using %s flag\n", str_flag); + HDprintf("Using %s flag\n", str_flag); } } @@ -419,7 +419,7 @@ main (int argc, const char *argv[]) /* Display some output if requested */ if(verbose) - printf("%s: Creating parent groups\n", h5tools_getprogname()); + HDprintf("%s: Creating parent groups\n", h5tools_getprogname()); } /* end if */ else { /* error, if parent groups doesn't already exist in destination file */ @@ -490,7 +490,7 @@ main (int argc, const char *argv[]) leave(EXIT_SUCCESS); done: - printf("Error in copy...Exiting\n"); + HDprintf("Error in copy...Exiting\n"); /* free link info path */ if (linkinfo.trg_path) diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 0c1521e..362e3f2 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -62,9 +62,9 @@ static void check_options(diff_opt_t* opts) * These options are mutually exclusive. */ if ((opts->d + opts->p + opts->use_system_epsilon) > 1) { - printf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME); - printf("use no more than one.\n"); - printf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME); + HDprintf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME); + HDprintf("use no more than one.\n"); + HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME); h5diff_exit(EXIT_FAILURE); } } @@ -186,7 +186,7 @@ void parse_command_line(int argc, /* create linked list of excluding objects */ if( (exclude_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) { - printf("Error: lack of memory!\n"); + HDprintf("Error: lack of memory!\n"); h5diff_exit(EXIT_FAILURE); } @@ -212,7 +212,7 @@ void parse_command_line(int argc, opts->d=1; if (check_d_input(opt_arg) == - 1) { - printf("<-d %s> is not a valid option\n", opt_arg); + HDprintf("<-d %s> is not a valid option\n", opt_arg); usage(); h5diff_exit(EXIT_FAILURE); } @@ -226,7 +226,7 @@ void parse_command_line(int argc, case 'p': opts->p=1; if (check_p_input(opt_arg) == -1) { - printf("<-p %s> is not a valid option\n", opt_arg); + HDprintf("<-p %s> is not a valid option\n", opt_arg); usage(); h5diff_exit(EXIT_FAILURE); } @@ -240,7 +240,7 @@ void parse_command_line(int argc, case 'n': opts->n=1; if ( check_n_input(opt_arg) == -1) { - printf("<-n %s> is not a valid option\n", opt_arg); + HDprintf("<-n %s> is not a valid option\n", opt_arg); usage(); h5diff_exit(EXIT_FAILURE); } @@ -309,20 +309,20 @@ void parse_command_line(int argc, return; if (opts->cmn_objs == 0) { - printf("No common objects found. Files are not comparable.\n"); + HDprintf("No common objects found. Files are not comparable.\n"); if (!opts->m_verbose) - printf("Use -v for a list of objects.\n"); + HDprintf("Use -v for a list of objects.\n"); } if (opts->not_cmp == 1) { if (opts->m_list_not_cmp == 0) { - printf("--------------------------------\n"); - printf("Some objects are not comparable\n"); - printf("--------------------------------\n"); + HDprintf("--------------------------------\n"); + HDprintf("Some objects are not comparable\n"); + HDprintf("--------------------------------\n"); if (opts->m_verbose) - printf("Use -c for a list of objects without details of differences.\n"); + HDprintf("Use -c for a list of objects without details of differences.\n"); else - printf("Use -c for a list of objects.\n"); + HDprintf("Use -c for a list of objects.\n"); } } } diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c index 83240cb..380ab3b 100644 --- a/tools/src/h5diff/ph5diff_main.c +++ b/tools/src/h5diff/ph5diff_main.c @@ -68,7 +68,7 @@ int main(int argc, const char *argv[]) if(g_nTasks == 1) { - printf("Only 1 task available...doing serial diff\n"); + HDprintf("Only 1 task available...doing serial diff\n"); g_Parallel = 0; @@ -148,12 +148,12 @@ ph5diff_worker(int nID) /* Open the files */ if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); + HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); MPI_Abort(MPI_COMM_WORLD, 0); } if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); + HDprintf("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); MPI_Abort(MPI_COMM_WORLD, 0); } /* enable error reporting */ @@ -170,7 +170,7 @@ ph5diff_worker(int nID) /* Make certain we've received the filenames and opened the files already */ if(file1_id < 0 || file2_id < 0) { - printf("ph5diff_worker: ERROR: work received before/without filenames\n"); + HDprintf("ph5diff_worker: ERROR: work received before/without filenames\n"); break; } @@ -199,7 +199,7 @@ ph5diff_worker(int nID) char out_data[PRINT_DATA_MAX_SIZE]; int tmp; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); + HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE); i=0; rewind(overflow_file); @@ -210,7 +210,7 @@ ph5diff_worker(int nID) { MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); i=0; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); + HDmemset(out_data, 0, PRINT_DATA_MAX_SIZE); } } @@ -221,8 +221,8 @@ ph5diff_worker(int nID) overflow_file = NULL; } - fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); + HDfflush(stdout); + HDmemset(outBuff, 0, OUTBUFF_SIZE); outBuffOffset = 0; MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD); @@ -238,7 +238,7 @@ ph5diff_worker(int nID) } else { - printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); + HDprintf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); break; } @@ -266,14 +266,14 @@ void print_manager_output(void) /* If there was something we buffered, let's print it now */ if( (outBuffOffset>0) && g_Parallel) { - printf("%s", outBuff); + HDprintf("%s", outBuff); if(overflow_file) { int tmp; rewind(overflow_file); - while((tmp = getc(overflow_file)) >= 0) - putchar(tmp); + while((tmp = HDgetc(overflow_file)) >= 0) + HDputchar(tmp); fclose(overflow_file); overflow_file = NULL; } @@ -321,6 +321,6 @@ void h5diff_exit(int status) /* Always exit(0), since MPI implementations do weird stuff when they * receive a non-zero exit value. - QAK */ - exit(0); + HDexit(0); } diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index 821d2c7..e66a1c5 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -865,7 +865,7 @@ dump_group(hid_t gid, const char *name) if(!type_table->objs[u].recorded) { dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2024,7 +2024,7 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe if(!type_table->objs[idx].recorded) { /* unamed datatype */ - sprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); + HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno); if(!HDstrcmp(name, real_name)) break; diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c index fc56433..c4fd948 100644 --- a/tools/src/h5dump/h5dump_xml.c +++ b/tools/src/h5dump/h5dump_xml.c @@ -588,7 +588,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) if (objno == HADDR_UNDEF) { if (gen) { objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); return 0; } else { @@ -599,7 +599,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) else { if (gen) { objno = ref_path_table_gen_fake(str); - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); return 0; } else { @@ -608,7 +608,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } - sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); + HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno); return(0); } @@ -2686,7 +2686,7 @@ xml_dump_group(hid_t gid, const char *name) if(!type_table->objs[u].recorded) { dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); @@ -2768,7 +2768,7 @@ xml_dump_group(hid_t gid, const char *name) if(!type_table->objs[u].recorded) { dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT); type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); dump_function_table->dump_named_datatype_function(type, type_name); H5Tclose(type); H5Dclose(dset); diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index e96dea5..c18df6c 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -483,7 +483,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, } /*H5T_REFERENCE*/ if (options->verbose) - printf(FORMAT_OBJ_ATTR, "attr", name); + HDprintf(FORMAT_OBJ_ATTR, "attr", name); /*------------------------------------------------------------------------- * close @@ -545,7 +545,7 @@ static int check_options(pack_opt_t *options) { */ if (options->verbose && have_request(options) /* only print if requested */) { if (options->all_layout == 1) { - printf("All objects to modify layout are...\n"); + HDprintf("All objects to modify layout are...\n"); switch (options->layout_g) { case H5D_COMPACT: strcpy(slayout, "compact"); @@ -566,17 +566,17 @@ static int check_options(pack_opt_t *options) { strcpy(slayout, "invalid layout\n"); HGOTO_DONE(FAIL); } - printf(" Apply %s layout to all", slayout); + HDprintf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { - printf("with dimension [ "); + HDprintf("with dimension [ "); for (j = 0; j < options->chunk_g.rank; j++) - printf("%d ", (int) options->chunk_g.chunk_lengths[j]); - printf("]"); + HDprintf("%d ", (int) options->chunk_g.chunk_lengths[j]); + HDprintf("]"); } - printf("\n"); + HDprintf("\n"); } else - printf("No all objects to modify layout\n"); + HDprintf("No all objects to modify layout\n"); }/* verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -584,16 +584,16 @@ static int check_options(pack_opt_t *options) { if (options->op_tbl->objs[i].chunk.rank > 0) { if (options->verbose) { - printf(" <%s> with chunk size ", name); + HDprintf(" <%s> with chunk size ", name); for (k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) - printf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); - printf("\n"); + HDprintf("%d ", (int) options->op_tbl->objs[i].chunk.chunk_lengths[k]); + HDprintf("\n"); } has_ck = 1; } else if (options->op_tbl->objs[i].chunk.rank == -2) { if (options->verbose) - printf(" <%s> %s\n", name, "NONE (contiguous)"); + HDprintf(" <%s> %s\n", name, "NONE (contiguous)"); has_ck = 1; } } @@ -608,33 +608,33 @@ static int check_options(pack_opt_t *options) { if (options->verbose && have_request(options) /* only print if requested */) { if (options->all_filter == 1) { - printf("All objects to apply filter are...\n"); + HDprintf("All objects to apply filter are...\n"); for (k = 0; k < options->n_filter_g; k++) { H5Z_filter_t filtn = options->filter_g[k].filtn; if (filtn < 0) { - printf(" Unknown\n"); + HDprintf(" Unknown\n"); continue; } switch (filtn) { case H5Z_FILTER_NONE: - printf(" Uncompress all\n"); + HDprintf(" Uncompress all\n"); break; case H5Z_FILTER_SHUFFLE: case H5Z_FILTER_FLETCHER32: - printf(" All with %s\n", get_sfilter(filtn)); + HDprintf(" All with %s\n", get_sfilter(filtn)); break; case H5Z_FILTER_SZIP: case H5Z_FILTER_DEFLATE: - printf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]); + HDprintf(" All with %s, parameter %d\n", get_sfilter(filtn), options->filter_g[k].cd_values[0]); break; default: - printf(" User Defined %d\n", filtn); + HDprintf(" User Defined %d\n", filtn); break; } /* k */ }; } else - printf("No all objects to apply filter\n"); + HDprintf("No all objects to apply filter\n"); } /* verbose */ for (i = 0; i < options->op_tbl->nelems; i++) { @@ -645,9 +645,9 @@ static int check_options(pack_opt_t *options) { if (options->verbose) { if(pack.filter[j].filtn >= 0) { if(pack.filter[j].filtn > H5Z_FILTER_SCALEOFFSET) - printf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); + HDprintf(" <%s> with %s filter %d\n", name, get_sfilter(pack.filter[j].filtn), pack.filter[j].filtn); else - printf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); + HDprintf(" <%s> with %s filter\n", name, get_sfilter(pack.filter[j].filtn)); } } has_cp = 1; @@ -678,7 +678,7 @@ static int check_options(pack_opt_t *options) { */ if (options->ublock_filename != NULL && options->ublock_size == 0) { if (options->verbose) { - printf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); + HDprintf("Warning: user block size missing for file %s. Assigning a default size of 1024...\n", options->ublock_filename); options->ublock_size = 1024; } } @@ -747,19 +747,19 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); + HDprintf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; if (options->verbose) - printf(" <%s>", name); + HDprintf(" <%s>", name); /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) - printf("...Found\n"); + HDprintf("...Found\n"); for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) { if (options->op_tbl->objs[i].filter[ifil].filtn < 0) @@ -799,7 +799,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { } if (csize < ppb) { - printf(" \n"); + HDprintf(" \n"); HGOTO_DONE(0); } } diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 8122d6d..13adb7c 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -296,7 +296,7 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ if (options->verbose) - printf("Making new file ...\n"); + HDprintf("Making new file ...\n"); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); @@ -624,9 +624,9 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (options->verbose) { - printf("-----------------------------------------\n"); - printf(" Type Filter (Compression) Name\n"); - printf("-----------------------------------------\n"); + HDprintf("-----------------------------------------\n"); + HDprintf(" Type Filter (Compression) Name\n"); + HDprintf("-----------------------------------------\n"); } if (travt->objs) { @@ -645,7 +645,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ case H5TRAV_TYPE_GROUP: if (options->verbose) - printf(FORMAT_OBJ, "group", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "group", travt->objs[i].name); /* open input group */ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) @@ -880,7 +880,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (dset_out == FAIL) { H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); if (options->verbose) - printf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); + HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); @@ -1043,10 +1043,10 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, (in case there was a filter) */ if (has_filter && apply_s == 0) - printf(" \n", travt->objs[i].name, (int) options->min_comp); + HDprintf(" \n", travt->objs[i].name, (int) options->min_comp); if (has_filter && apply_f == 0) - printf(" \n", travt->objs[i].name); + HDprintf(" \n", travt->objs[i].name); } /* verbose */ /*------------------------------------------------------------------------- @@ -1127,7 +1127,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); if (options->verbose) - printf(FORMAT_OBJ, "dset", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); } /* end do we have request for filter/chunking */ break; @@ -1138,7 +1138,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ case H5TRAV_TYPE_NAMED_DATATYPE: if (options->verbose) - printf(FORMAT_OBJ, "type", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "type", travt->objs[i].name); if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); @@ -1177,13 +1177,13 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, case H5TRAV_TYPE_LINK: case H5TRAV_TYPE_UDLINK: if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); if (options->verbose) - printf(FORMAT_OBJ, "link", travt->objs[i].name); + HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); break; default: @@ -1278,7 +1278,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) { unsigned level = cd_values[0]; - sprintf(temp,"(%d)", level); + HDsprintf(temp,"(%d)", level); HDstrcat(strfilter, temp); } #endif @@ -1292,7 +1292,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/ unsigned ppb = cd_values[1]; - sprintf(temp,"(%d,", ppb); + HDsprintf(temp,"(%d,", ppb); HDstrcat(strfilter, temp); if (options_mask & H5_SZIP_EC_OPTION_MASK) HDstrcpy(temp, "EC) "); @@ -1326,15 +1326,15 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) }/*i*/ if (!pr) - printf(FORMAT_OBJ, "dset", objname); + HDprintf(FORMAT_OBJ, "dset", objname); else { char str[512], temp[512]; HDstrcpy(str, "dset "); HDstrcat(str, strfilter); - sprintf(temp, " (%.3f:1)", ratio); + HDsprintf(temp, " (%.3f:1)", ratio); HDstrcat(str, temp); - printf(FORMAT_OBJ, str, objname); + HDprintf(FORMAT_OBJ, str, objname); } } @@ -1461,10 +1461,10 @@ print_user_block(const char *filename, hid_t fid) for (i = 0; i < nread; i++) { - printf("%c ", rbuf[i]); + HDprintf("%c ", rbuf[i]); } - printf("\n"); + HDprintf("\n"); if (nread < 0) { HGOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index f5846ba..7e8951f 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -158,7 +158,7 @@ int do_copy_refobjs(hid_t fidin, if(nelmts) { buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { - printf("cannot read into memory\n" ); + HDprintf("cannot read into memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -166,7 +166,7 @@ int do_copy_refobjs(hid_t fidin, refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL){ - printf("cannot allocate memory\n" ); + HDprintf("cannot allocate memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { @@ -183,8 +183,8 @@ int do_copy_refobjs(hid_t fidin, if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); if(options->verbose) { - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - printf("object <%s> object reference created to <%s>\n", + HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); + HDprintf("object <%s> object reference created to <%s>\n", travt->objs[i].name, refname); } @@ -234,7 +234,7 @@ int do_copy_refobjs(hid_t fidin, if(nelmts) { buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { - printf("cannot read into memory\n"); + HDprintf("cannot read into memory\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -246,7 +246,7 @@ int do_copy_refobjs(hid_t fidin, */ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { - printf("cannot allocate memory\n"); + HDprintf("cannot allocate memory\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ @@ -271,8 +271,8 @@ int do_copy_refobjs(hid_t fidin, if(H5Sclose(region_id) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); if(options->verbose) { - printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - printf("object <%s> region reference created to <%s>\n", + HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); + HDprintf("object <%s> region reference created to <%s>\n", travt->objs[i].name, refname); } @@ -590,7 +590,7 @@ static int copy_refs_attr(hid_t loc_in, if((is_ref || is_ref_array) && (H5R_OBJ_REF_BUF_SIZE==msize)) { buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { - printf("cannot read into memory\n"); + HDprintf("cannot read into memory\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) @@ -598,7 +598,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL) { - printf("cannot allocate memory\n"); + HDprintf("cannot allocate memory\n"); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ @@ -611,7 +611,7 @@ static int copy_refs_attr(hid_t loc_in, buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) @@ -623,7 +623,7 @@ static int copy_refs_attr(hid_t loc_in, */ refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { - printf( "cannot allocate memory\n" ); + HDprintf( "cannot allocate memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); } /* end if */ @@ -638,7 +638,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = buf; /* reuse the read buffer for write */ if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ @@ -679,7 +679,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = buf; /* reuse the read buffer for write */ if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); } /* end if */ diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 75d325a..9528d2c 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -396,12 +396,12 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) /* Add attribute count to proper bin */ bin = ceil_log10((unsigned long)oi->num_attrs); if((bin + 1) > iter->attr_nbins) { - iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); + iter->attr_bins = (unsigned long *)HDrealloc(iter->attr_bins, (bin + 1) * sizeof(unsigned long)); HDassert(iter->attr_bins); /* Initialize counts for intermediate bins */ while(iter->attr_nbins < bin) - iter->attr_bins[iter->attr_nbins++] = 0; + iter->attr_bins[iter->attr_nbins++] = 0; iter->attr_nbins++; /* Initialize count for new bin */ @@ -549,7 +549,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get storage info */ /* Failure 0 indistinguishable from no-data-stored 0 */ - storage = H5Dget_storage_size(did); + storage = H5Dget_storage_size(did); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) @@ -574,7 +574,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if(num_ext) { iter->nexternal += (unsigned long)num_ext; iter->dset_external_storage_size += (unsigned long)storage; - } else + } + else iter->dset_storage_size += storage; /* Gather dataspace statistics */ @@ -971,7 +972,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) error_msg("Invalid threshold for small groups\n"); goto error; } - } else + } + else error_msg("Missing threshold for small groups\n"); break; @@ -993,7 +995,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) error_msg("Invalid threshold for small datasets\n"); goto error; } - } else + } + else error_msg("Missing threshold for small datasets\n"); break; @@ -1015,7 +1018,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) error_msg("Invalid threshold for small # of attributes\n"); goto error; } - } else + } + else error_msg("Missing threshold for small # of attributes\n"); break; @@ -1066,8 +1070,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) char **cred = NULL; char const *ccred[3]; - if (FAIL == parse_tuple((const char *)opt_arg, ',', - &cred_str, &nelems, &cred)) { + if (FAIL == parse_tuple((const char *)opt_arg, ',', &cred_str, &nelems, &cred)) { error_msg("Unable to parse s3 credential\n"); goto error; } @@ -1078,9 +1081,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) ccred[0] = (const char *)cred[0]; ccred[1] = (const char *)cred[1]; ccred[2] = (const char *)cred[2]; - if (0 == - h5tools_populate_ros3_fapl(&ros3_fa, ccred)) - { + if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) { error_msg("Unable to set ros3 fapl config\n"); goto error; } @@ -1101,13 +1102,8 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) char *props_src = NULL; char **props = NULL; unsigned long k = 0; - if (FAIL == parse_tuple( - (const char *)opt_arg, - ',', - &props_src, - &nelems, - &props)) - { + if (FAIL == parse_tuple((const char *)opt_arg, + ',', &props_src, &nelems, &props)) { error_msg("unable to parse hdfs properties tuple\n"); goto error; } @@ -1115,7 +1111,7 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) */ if (nelems != 5) { char str[64] = ""; - sprintf(str, + HDsprintf(str, "expected 5 elements in hdfs properties tuple " "but found %u\n", nelems); @@ -1130,12 +1126,10 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) * input strings... Silent overflow is possible, * albeit unlikely. */ - if (strncmp(props[0], "", 1)) { - HDstrncpy(hdfs_fa.namenode_name, - (const char *)props[0], - HDstrlen(props[0])); + if (HDstrncmp(props[0], "", 1)) { + HDstrncpy(hdfs_fa.namenode_name,(const char *)props[0], HDstrlen(props[0])); } - if (strncmp(props[1], "", 1)) { + if (HDstrncmp(props[1], "", 1)) { k = strtoul((const char *)props[1], NULL, 0); if (errno == ERANGE) { error_msg("supposed port number wasn't.\n"); @@ -1143,18 +1137,14 @@ parse_command_line(int argc, const char *argv[], struct handler_t **hand_ret) } hdfs_fa.namenode_port = (int32_t)k; } - if (strncmp(props[2], "", 1)) { - HDstrncpy(hdfs_fa.kerberos_ticket_cache, - (const char *)props[2], - HDstrlen(props[2])); + if (HDstrncmp(props[2], "", 1)) { + HDstrncpy(hdfs_fa.kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2])); } - if (strncmp(props[3], "", 1)) { - HDstrncpy(hdfs_fa.user_name, - (const char *)props[3], - HDstrlen(props[3])); + if (HDstrncmp(props[3], "", 1)) { + HDstrncpy(hdfs_fa.user_name, (const char *)props[3], HDstrlen(props[3])); } if (strncmp(props[4], "", 1)) { - k = strtoul((const char *)props[4], NULL, 0); + k = HDstrtoul((const char *)props[4], NULL, 0); if (errno == ERANGE) { error_msg("supposed buffersize number wasn't.\n"); goto error; @@ -1279,13 +1269,13 @@ iter_free(iter_t *iter) static herr_t print_file_info(const iter_t *iter) { - printf("File information\n"); - printf("\t# of unique groups: %lu\n", iter->uniq_groups); - printf("\t# of unique datasets: %lu\n", iter->uniq_dsets); - printf("\t# of unique named datatypes: %lu\n", iter->uniq_dtypes); - printf("\t# of unique links: %lu\n", iter->uniq_links); - printf("\t# of unique other: %lu\n", iter->uniq_others); - printf("\tMax. # of links to object: %lu\n", iter->max_links); + HDprintf("File information\n"); + HDprintf("\t# of unique groups: %lu\n", iter->uniq_groups); + HDprintf("\t# of unique datasets: %lu\n", iter->uniq_dsets); + HDprintf("\t# of unique named datatypes: %lu\n", iter->uniq_dtypes); + HDprintf("\t# of unique links: %lu\n", iter->uniq_links); + HDprintf("\t# of unique other: %lu\n", iter->uniq_others); + HDprintf("\tMax. # of links to object: %lu\n", iter->max_links); HDfprintf(stdout, "\tMax. # of objects in group: %Hu\n", iter->max_fanout); return 0; @@ -1315,15 +1305,12 @@ print_file_metadata(const iter_t *iter) HDfprintf(stdout, "\tUser block: %Hu\n", iter->ublk_size); HDfprintf(stdout, "\tObject headers: (total/unused)\n"); - HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", - iter->group_ohdr_info.total_size, - iter->group_ohdr_info.free_size); + HDfprintf(stdout, "\t\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, + iter->group_ohdr_info.free_size); HDfprintf(stdout, "\t\tDatasets(exclude compact data): %Hu/%Hu\n", - iter->dset_ohdr_info.total_size, - iter->dset_ohdr_info.free_size); - HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", - iter->dtype_ohdr_info.total_size, - iter->dtype_ohdr_info.free_size); + iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); + HDfprintf(stdout, "\t\tDatatypes: %Hu/%Hu\n", iter->dtype_ohdr_info.total_size, + iter->dtype_ohdr_info.free_size); HDfprintf(stdout, "\tGroups:\n"); HDfprintf(stdout, "\t\tB-tree/List: %Hu\n", iter->groups_btree_storage_size); @@ -1378,32 +1365,32 @@ print_group_info(const iter_t *iter) unsigned long total; /* Total count for various statistics */ unsigned u; /* Local index variable */ - printf("Small groups (with 0 to %u links):\n", sgroups_threshold-1); + HDprintf("Small groups (with 0 to %u links):\n", sgroups_threshold-1); total = 0; for(u = 0; u < (unsigned)sgroups_threshold; u++) { if(iter->num_small_groups[u] > 0) { - printf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]); + HDprintf("\t# of groups with %u link(s): %lu\n", u, iter->num_small_groups[u]); total += iter->num_small_groups[u]; } /* end if */ } /* end for */ - printf("\tTotal # of small groups: %lu\n", total); + HDprintf("\tTotal # of small groups: %lu\n", total); - printf("Group bins:\n"); + HDprintf("Group bins:\n"); total = 0; if((iter->group_nbins > 0) && (iter->group_bins[0] > 0)) { - printf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]); + HDprintf("\t# of groups with 0 link: %lu\n", iter->group_bins[0]); total = iter->group_bins[0]; } /* end if */ power = 1; for(u = 1; u < iter->group_nbins; u++) { if(iter->group_bins[u] > 0) { - printf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1, + HDprintf("\t# of groups with %lu - %lu links: %lu\n", power, (power * 10) - 1, iter->group_bins[u]); total += iter->group_bins[u]; } /* end if */ power *= 10; } /* end for */ - printf("\tTotal # of groups: %lu\n", total); + HDprintf("\tTotal # of groups: %lu\n", total); return 0; } /* print_group_info() */ @@ -1424,7 +1411,7 @@ print_group_info(const iter_t *iter) static herr_t print_group_metadata(const iter_t *iter) { - printf("File space information for groups' metadata (in bytes):\n"); + HDprintf("File space information for groups' metadata (in bytes):\n"); HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); @@ -1457,66 +1444,66 @@ print_dataset_info(const iter_t *iter) unsigned u; /* Local index variable */ if(iter->uniq_dsets > 0) { - printf("Dataset dimension information:\n"); - printf("\tMax. rank of datasets: %u\n", iter->max_dset_rank); - printf("\tDataset ranks:\n"); + HDprintf("Dataset dimension information:\n"); + HDprintf("\tMax. rank of datasets: %u\n", iter->max_dset_rank); + HDprintf("\tDataset ranks:\n"); for(u = 0; u < H5S_MAX_RANK; u++) if(iter->dset_rank_count[u] > 0) - printf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]); + HDprintf("\t\t# of dataset with rank %u: %lu\n", u, iter->dset_rank_count[u]); - printf("1-D Dataset information:\n"); + HDprintf("1-D Dataset information:\n"); HDfprintf(stdout, "\tMax. dimension size of 1-D datasets: %Hu\n", iter->max_dset_dims); - printf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1); + HDprintf("\tSmall 1-D datasets (with dimension sizes 0 to %u):\n", sdsets_threshold - 1); total = 0; for(u = 0; u < (unsigned)sdsets_threshold; u++) { if(iter->small_dset_dims[u] > 0) { - printf("\t\t# of datasets with dimension sizes %u: %lu\n", u, + HDprintf("\t\t# of datasets with dimension sizes %u: %lu\n", u, iter->small_dset_dims[u]); total += iter->small_dset_dims[u]; } /* end if */ } /* end for */ - printf("\t\tTotal # of small datasets: %lu\n", total); + HDprintf("\t\tTotal # of small datasets: %lu\n", total); /* Protect against no datasets in file */ if(iter->dset_dim_nbins > 0) { - printf("\t1-D Dataset dimension bins:\n"); + HDprintf("\t1-D Dataset dimension bins:\n"); total = 0; if(iter->dset_dim_bins[0] > 0) { - printf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]); + HDprintf("\t\t# of datasets with dimension size 0: %lu\n", iter->dset_dim_bins[0]); total = iter->dset_dim_bins[0]; } /* end if */ power = 1; for(u = 1; u < iter->dset_dim_nbins; u++) { if(iter->dset_dim_bins[u] > 0) { - printf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1, + HDprintf("\t\t# of datasets with dimension size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->dset_dim_bins[u]); total += iter->dset_dim_bins[u]; } /* end if */ power *= 10; } /* end for */ - printf("\t\tTotal # of datasets: %lu\n", total); + HDprintf("\t\tTotal # of datasets: %lu\n", total); } /* end if */ - printf("Dataset storage information:\n"); + HDprintf("Dataset storage information:\n"); HDfprintf(stdout, "\tTotal raw data size: %Hu\n", iter->dset_storage_size); HDfprintf(stdout, "\tTotal external raw data size: %Hu\n", iter->dset_external_storage_size); - printf("Dataset layout information:\n"); + HDprintf("Dataset layout information:\n"); for(u = 0; u < H5D_NLAYOUTS; u++) - printf("\tDataset layout counts[%s]: %lu\n", (u == H5D_COMPACT ? "COMPACT" : + HDprintf("\tDataset layout counts[%s]: %lu\n", (u == H5D_COMPACT ? "COMPACT" : (u == H5D_CONTIGUOUS ? "CONTIG" : (u == H5D_CHUNKED ? "CHUNKED" : "VIRTUAL"))), iter->dset_layouts[u]); - printf("\tNumber of external files : %lu\n", iter->nexternal); - - printf("Dataset filters information:\n"); - printf("\tNumber of datasets with:\n"); - printf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]); - printf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]); - printf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]); - printf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]); - printf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]); - printf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]); - printf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]); - printf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]); + HDprintf("\tNumber of external files : %lu\n", iter->nexternal); + + HDprintf("Dataset filters information:\n"); + HDprintf("\tNumber of datasets with:\n"); + HDprintf("\t\tNO filter: %lu\n", iter->dset_comptype[H5Z_FILTER_ERROR+1]); + HDprintf("\t\tGZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_DEFLATE]); + HDprintf("\t\tSHUFFLE filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SHUFFLE]); + HDprintf("\t\tFLETCHER32 filter: %lu\n", iter->dset_comptype[H5Z_FILTER_FLETCHER32]); + HDprintf("\t\tSZIP filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SZIP]); + HDprintf("\t\tNBIT filter: %lu\n", iter->dset_comptype[H5Z_FILTER_NBIT]); + HDprintf("\t\tSCALEOFFSET filter: %lu\n", iter->dset_comptype[H5Z_FILTER_SCALEOFFSET]); + HDprintf("\t\tUSER-DEFINED filter: %lu\n", iter->dset_comptype[H5_NFILTERS_IMPL-1]); } /* end if */ return 0; @@ -1539,7 +1526,7 @@ print_dataset_info(const iter_t *iter) static herr_t print_dset_metadata(const iter_t *iter) { - printf("File space information for datasets' metadata (in bytes):\n"); + HDprintf("File space information for datasets' metadata (in bytes):\n"); HDfprintf(stdout, "\tObject headers (total/unused): %Hu/%Hu\n", iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); @@ -1573,20 +1560,20 @@ print_dset_dtype_meta(const iter_t *iter) unsigned u; /* Local index variable */ if(iter->dset_ntypes) { - printf("Dataset datatype information:\n"); - printf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); + HDprintf("Dataset datatype information:\n"); + HDprintf("\t# of unique datatypes used by datasets: %lu\n", iter->dset_ntypes); total = 0; for(u = 0; u < iter->dset_ntypes; u++) { H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); - printf("\tDataset datatype #%u:\n", u); - printf("\t\tCount (total/named) = (%lu/%lu)\n", + HDprintf("\tDataset datatype #%u:\n", u); + HDprintf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); - printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, + HDprintf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); H5Tclose(iter->dset_type_info[u].tid); total += iter->dset_type_info[u].count; } /* end for */ - printf("\tTotal dataset datatype count: %lu\n", total); + HDprintf("\tTotal dataset datatype count: %lu\n", total); } /* end if */ return 0; @@ -1614,29 +1601,29 @@ print_attr_info(const iter_t *iter) unsigned long total; /* Total count for various statistics */ unsigned u; /* Local index variable */ - printf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold); + HDprintf("Small # of attributes (objects with 1 to %u attributes):\n", sattrs_threshold); total = 0; for(u = 1; u <= (unsigned)sattrs_threshold; u++) { if(iter->num_small_attrs[u] > 0) { - printf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]); + HDprintf("\t# of objects with %u attributes: %lu\n", u, iter->num_small_attrs[u]); total += iter->num_small_attrs[u]; } /* end if */ } /* end for */ - printf("\tTotal # of objects with small # of attributes: %lu\n", total); + HDprintf("\tTotal # of objects with small # of attributes: %lu\n", total); - printf("Attribute bins:\n"); + HDprintf("Attribute bins:\n"); total = 0; power = 1; for(u = 1; u < iter->attr_nbins; u++) { if(iter->attr_bins[u] > 0) { - printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, + HDprintf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, iter->attr_bins[u]); total += iter->attr_bins[u]; } /* end if */ power *= 10; } /* end for */ - printf("\tTotal # of objects with attributes: %lu\n", total); - printf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs); + HDprintf("\tTotal # of objects with attributes: %lu\n", total); + HDprintf("\tMax. # of attributes to objects: %lu\n", (unsigned long)iter->max_attrs); return 0; } /* print_attr_info() */ @@ -1664,29 +1651,29 @@ print_freespace_info(const iter_t *iter) HDfprintf(stdout, "Free-space persist: %s\n", iter->fs_persist ? "TRUE" : "FALSE"); HDfprintf(stdout, "Free-space section threshold: %Hu bytes\n", iter->fs_threshold); - printf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); + HDprintf("Small size free-space sections (< %u bytes):\n", (unsigned)SIZE_SMALL_SECTS); total = 0; for(u = 0; u < SIZE_SMALL_SECTS; u++) { if(iter->num_small_sects[u] > 0) { - printf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]); + HDprintf("\t# of sections of size %u: %lu\n", u, iter->num_small_sects[u]); total += iter->num_small_sects[u]; } /* end if */ } /* end for */ - printf("\tTotal # of small size sections: %lu\n", total); + HDprintf("\tTotal # of small size sections: %lu\n", total); - printf("Free-space section bins:\n"); + HDprintf("Free-space section bins:\n"); total = 0; power = 1; for(u = 1; u < iter->sect_nbins; u++) { if(iter->sect_bins[u] > 0) { - printf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1, + HDprintf("\t# of sections of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->sect_bins[u]); total += iter->sect_bins[u]; } /* end if */ power *= 10; } /* end for */ - printf("\tTotal # of sections: %lu\n", total); + HDprintf("\tTotal # of sections: %lu\n", total); return 0; } /* print_freespace_info() */ @@ -1714,7 +1701,7 @@ print_storage_summary(const iter_t *iter) HDfprintf(stdout, "File space management strategy: %s\n", FS_STRATEGY_NAME[iter->fs_strategy]); HDfprintf(stdout, "File space page size: %Hu bytes\n", iter->fsp_size); - printf("Summary of file space information:\n"); + HDprintf("Summary of file space information:\n"); total_meta = iter->super_size + iter->super_ext_size + iter->ublk_size + iter->group_ohdr_info.total_size + @@ -1822,7 +1809,7 @@ print_file_statistics(const iter_t *iter) static void print_object_statistics(const char *name) { - printf("Object name %s\n", name); + HDprintf("Object name %s\n", name); } /* print_object_statistics() */ @@ -1905,7 +1892,8 @@ main(int argc, const char *argv[]) conf_fa = (void *)&ros3_fa; #endif /* H5_HAVE_ROS3_VFD */ - } else if (!HDstrcmp(drivername, "hdfs")) { + } + else if (!HDstrcmp(drivername, "hdfs")) { #ifndef H5_HAVE_LIBHDFS error_msg("HDFS VFD not enabled.\n\n"); goto done; @@ -1921,11 +1909,7 @@ main(int argc, const char *argv[]) error_msg("Unable to create fapl entry\n"); goto done; } - if (1 > h5tools_set_configured_fapl( - fapl_id, - drivername, - conf_fa)) - { + if (1 > h5tools_set_configured_fapl(fapl_id, drivername, conf_fa)) { error_msg("Unable to set fapl\n"); goto done; } @@ -1944,7 +1928,7 @@ main(int argc, const char *argv[]) hid_t fcpl; H5F_info2_t finfo; - printf("Filename: %s\n", fname); + HDprintf("Filename: %s\n", fname); fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); if(fid < 0) { @@ -1979,7 +1963,7 @@ main(int argc, const char *argv[]) if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) { error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n"); - h5tools_setstatus(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); goto done; } @@ -2008,7 +1992,8 @@ main(int argc, const char *argv[]) if(h5trav_visit(fid, hand->obj[u], TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) { error_msg("unable to traverse object \"%s\"\n", hand->obj[u]); h5tools_setstatus(EXIT_FAILURE); - } else + } + else print_statistics(hand->obj[u], &iter); } /* end for */ } /* end if */ @@ -2016,7 +2001,8 @@ main(int argc, const char *argv[]) if(h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter, H5O_INFO_ALL) < 0) { error_msg("unable to traverse objects/links in file \"%s\"\n", fname); h5tools_setstatus(EXIT_FAILURE); - } else + } + else print_statistics("/", &iter); } /* end else */ } /* end if */ diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 088e6e9..96d6b9f 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -21,19 +21,19 @@ * *------------------------------------------------------------------------- */ -#define H5A_FRIEND /*suppress error about including H5Apkg */ -#define H5B2_FRIEND /*suppress error about including H5B2pkg */ -#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ -#define H5EA_FRIEND /*suppress error about including H5EApkg */ -#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ -#define H5FA_FRIEND /*suppress error about including H5FApkg */ -#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5HF_FRIEND /*suppress error about including H5HFpkg */ -#define H5O_FRIEND /*suppress error about including H5Opkg */ -#define H5SM_FRIEND /*suppress error about including H5SMpkg */ +#define H5A_FRIEND /*suppress error about including H5Apkg */ +#define H5B2_FRIEND /*suppress error about including H5B2pkg */ +#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5EA_FRIEND /*suppress error about including H5EApkg */ +#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/ +#define H5FA_FRIEND /*suppress error about including H5FApkg */ +#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5G_FRIEND /*suppress error about including H5Gpkg */ +#define H5HF_FRIEND /*suppress error about including H5HFpkg */ +#define H5O_FRIEND /*suppress error about including H5Opkg */ +#define H5SM_FRIEND /*suppress error about including H5SMpkg */ #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ @@ -57,7 +57,7 @@ #define VCOL 50 - + /*------------------------------------------------------------------------- * Function: get_H5B2_class * @@ -80,68 +80,68 @@ get_H5B2_class(const uint8_t *sig) const H5B2_class_t *cls; switch(subtype) { - case H5B2_TEST_ID: - cls = H5B2_TEST; - break; + case H5B2_TEST_ID: + cls = H5B2_TEST; + break; - case H5B2_FHEAP_HUGE_INDIR_ID: - cls = H5HF_HUGE_BT2_INDIR; - break; + case H5B2_FHEAP_HUGE_INDIR_ID: + cls = H5HF_HUGE_BT2_INDIR; + break; - case H5B2_FHEAP_HUGE_FILT_INDIR_ID: - cls = H5HF_HUGE_BT2_FILT_INDIR; - break; + case H5B2_FHEAP_HUGE_FILT_INDIR_ID: + cls = H5HF_HUGE_BT2_FILT_INDIR; + break; - case H5B2_FHEAP_HUGE_DIR_ID: - cls = H5HF_HUGE_BT2_DIR; - break; + case H5B2_FHEAP_HUGE_DIR_ID: + cls = H5HF_HUGE_BT2_DIR; + break; - case H5B2_FHEAP_HUGE_FILT_DIR_ID: - cls = H5HF_HUGE_BT2_FILT_DIR; - break; + case H5B2_FHEAP_HUGE_FILT_DIR_ID: + cls = H5HF_HUGE_BT2_FILT_DIR; + break; - case H5B2_GRP_DENSE_NAME_ID: - cls = H5G_BT2_NAME; - break; + case H5B2_GRP_DENSE_NAME_ID: + cls = H5G_BT2_NAME; + break; - case H5B2_GRP_DENSE_CORDER_ID: - cls = H5G_BT2_CORDER; - break; + case H5B2_GRP_DENSE_CORDER_ID: + cls = H5G_BT2_CORDER; + break; - case H5B2_SOHM_INDEX_ID: - cls = H5SM_INDEX; - break; + case H5B2_SOHM_INDEX_ID: + cls = H5SM_INDEX; + break; - case H5B2_ATTR_DENSE_NAME_ID: - cls = H5A_BT2_NAME; - break; + case H5B2_ATTR_DENSE_NAME_ID: + cls = H5A_BT2_NAME; + break; - case H5B2_ATTR_DENSE_CORDER_ID: - cls = H5A_BT2_CORDER; - break; + case H5B2_ATTR_DENSE_CORDER_ID: + cls = H5A_BT2_CORDER; + break; - case H5B2_CDSET_ID: - cls = H5D_BT2; - break; + case H5B2_CDSET_ID: + cls = H5D_BT2; + break; - case H5B2_CDSET_FILT_ID: - cls = H5D_BT2_FILT; - break; + case H5B2_CDSET_FILT_ID: + cls = H5D_BT2_FILT; + break; - case H5B2_TEST2_ID: - cls = H5B2_TEST2; - break; + case H5B2_TEST2_ID: + cls = H5B2_TEST2; + break; - case H5B2_NUM_BTREE_ID: - default: - HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); + case H5B2_NUM_BTREE_ID: + default: + HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); + HDexit(4); } /* end switch */ return(cls); } /* end get_H5B2_class() */ - + /*------------------------------------------------------------------------- * Function: get_H5EA_class * @@ -164,28 +164,28 @@ get_H5EA_class(const uint8_t *sig) const H5EA_class_t *cls; switch(clsid) { - case H5EA_CLS_TEST_ID: - cls = H5EA_CLS_TEST; - break; + case H5EA_CLS_TEST_ID: + cls = H5EA_CLS_TEST; + break; - case H5EA_CLS_CHUNK_ID: - cls = H5EA_CLS_CHUNK; - break; + case H5EA_CLS_CHUNK_ID: + cls = H5EA_CLS_CHUNK; + break; - case H5EA_CLS_FILT_CHUNK_ID: - cls = H5EA_CLS_FILT_CHUNK; - break; + case H5EA_CLS_FILT_CHUNK_ID: + cls = H5EA_CLS_FILT_CHUNK; + break; - case H5EA_NUM_CLS_ID: - default: - HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); - HDexit(4); + case H5EA_NUM_CLS_ID: + default: + HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); + HDexit(4); } /* end switch */ return(cls); } /* end get_H5EA_class() */ - + /*------------------------------------------------------------------------- * Function: get_H5FA_class * @@ -208,28 +208,28 @@ get_H5FA_class(const uint8_t *sig) const H5FA_class_t *cls; switch(clsid) { - case H5FA_CLS_TEST_ID: - cls = H5FA_CLS_TEST; - break; + case H5FA_CLS_TEST_ID: + cls = H5FA_CLS_TEST; + break; - case H5FA_CLS_CHUNK_ID: - cls = H5FA_CLS_CHUNK; - break; + case H5FA_CLS_CHUNK_ID: + cls = H5FA_CLS_CHUNK; + break; - case H5FA_CLS_FILT_CHUNK_ID: - cls = H5FA_CLS_FILT_CHUNK; - break; + case H5FA_CLS_FILT_CHUNK_ID: + cls = H5FA_CLS_FILT_CHUNK; + break; - case H5FA_NUM_CLS_ID: - default: - HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); - HDexit(4); + case H5FA_NUM_CLS_ID: + default: + HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); + HDexit(4); } /* end switch */ return(cls); } /* end get_H5FA_class() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -254,13 +254,13 @@ main(int argc, char *argv[]) uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; H5E_auto2_t func; - void *edata; + void *edata; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; if(argc == 1) { - HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); + HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); + HDexit(1); } /* end if */ /* Initialize the library */ @@ -274,15 +274,15 @@ main(int argc, char *argv[]) H5Eset_auto2(H5E_DEFAULT, NULL, NULL); /* - * Open the file and get the file descriptor. - */ + * Open the file and get the file descriptor. + */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { HDfprintf(stderr, "cannot create file access property list\n"); HDexit(1); } /* end if */ if(HDstrchr(argv[1], '%')) if(H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT) < 0) { - fprintf(stderr, "cannot set file access property list\n"); + HDfprintf(stderr, "cannot set file access property list\n"); HDexit(1); } if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) { @@ -309,8 +309,8 @@ main(int argc, char *argv[]) } /* - * Parse command arguments. - */ + * Parse command arguments. + */ if(argc > 2) addr = (haddr_t)HDstrtoll(argv[2], NULL, 0); if(argc > 3) @@ -323,8 +323,8 @@ main(int argc, char *argv[]) extra4 = (haddr_t)HDstrtoll(argv[6], NULL, 0); /* - * Read the signature at the specified file position. - */ + * Read the signature at the specified file position. + */ HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) { HDfprintf(stderr, "cannot read signature\n"); @@ -332,26 +332,28 @@ main(int argc, char *argv[]) } if(!HDmemcmp(sig, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) { /* - * Debug the file's super block. - */ + * Debug the file's super block. + */ status = H5F_debug(f, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a local heap. - */ + * Debug a local heap. + */ status = H5HL_debug(f, addr, stdout, 0, VCOL); - } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* - * Debug a global heap collection. - */ - status = H5HG_debug(f, addr, stdout, 0, VCOL); + } + else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + /* + * Debug a global heap collection. + */ + status = H5HG_debug(f, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a symbol table node. - */ + * Debug a symbol table node. + */ /* Check for extra parameters */ if(extra == 0) { @@ -362,107 +364,109 @@ main(int argc, char *argv[]) status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); - } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a B-tree. B-trees are debugged through the B-tree - * subclass. The subclass identifier is the byte immediately - * after the B-tree signature. - */ + * Debug a B-tree. B-trees are debugged through the B-tree + * subclass. The subclass identifier is the byte immediately + * after the B-tree signature. + */ H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC]; unsigned ndims; uint32_t dim[H5O_LAYOUT_NDIMS]; switch(subtype) { - case H5B_SNODE_ID: - /* Check for extra parameters */ - if(extra == 0) { - HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); - HDfprintf(stderr, "B-tree symbol table node usage:\n"); - HDfprintf(stderr, "\th5debug
\n\n"); - HDexit(4); - } /* end if */ + case H5B_SNODE_ID: + /* Check for extra parameters */ + if(extra == 0) { + HDfprintf(stderr, "\nWarning: Providing the group's local heap address will give more information\n"); + HDfprintf(stderr, "B-tree symbol table node usage:\n"); + HDfprintf(stderr, "\th5debug
\n\n"); + HDexit(4); + } /* end if */ - status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); - break; + status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); + break; - case H5B_CHUNK_ID: - /* Check for extra parameters */ - if(extra == 0) { - HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); + case H5B_CHUNK_ID: + /* Check for extra parameters */ + if(extra == 0) { + HDfprintf(stderr, "ERROR: Need number of dimensions of chunk in order to dump chunk B-tree node\n"); + HDfprintf(stderr, "B-tree chunked storage node usage:\n"); + HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); + HDexit(4); + } /* end if */ + + /* Build array of chunk dimensions */ + ndims = (unsigned)extra; + dim[0] = (uint32_t)extra2; + if(ndims > 1) + dim[1] = (uint32_t)extra3; + if(ndims > 2) + dim[2] = (uint32_t)extra4; + + /* Check for dimension error */ + if(ndims > 3) { + HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n"); + HDfprintf(stderr, "B-tree chunked storage node usage:\n"); + HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); + HDexit(4); + } /* end for */ + for(u = 0; u < ndims; u++) + if(0 == dim[u]) { + HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n"); HDfprintf(stderr, "B-tree chunked storage node usage:\n"); HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); HDexit(4); } /* end if */ - /* Build array of chunk dimensions */ - ndims = (unsigned)extra; - dim[0] = (uint32_t)extra2; - if(ndims > 1) - dim[1] = (uint32_t)extra3; - if(ndims > 2) - dim[2] = (uint32_t)extra4; - - /* Check for dimension error */ - if(ndims > 3) { - HDfprintf(stderr, "ERROR: Only 3 dimensions support currently (fix h5debug)\n"); - HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); - HDexit(4); - } /* end for */ - for(u = 0; u < ndims; u++) - if(0 == dim[u]) { - HDfprintf(stderr, "ERROR: Chunk dimensions should be >0\n"); - HDfprintf(stderr, "B-tree chunked storage node usage:\n"); - HDfprintf(stderr, "\th5debug <# of dimensions> ...\n"); - HDexit(4); - } /* end if */ - - /* Set the last dimension (the element size) to zero */ - dim[ndims] = 0; - - status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim); - break; - - case H5B_NUM_BTREE_ID: - default: - HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype)); - HDexit(4); + /* Set the last dimension (the element size) to zero */ + dim[ndims] = 0; + + status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim); + break; + + case H5B_NUM_BTREE_ID: + default: + HDfprintf(stderr, "Unknown v1 B-tree subtype %u\n", (unsigned)(subtype)); + HDexit(4); } - } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree header. - */ + * Debug a v2 B-tree header. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) { + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n"); HDfprintf(stderr, "v2 B-tree hdr usage:\n"); HDfprintf(stderr, "\th5debug \n"); HDexit(4); - } /* end if */ + } /* end if */ status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra); - } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree internal node. - */ + * Debug a v2 B-tree internal node. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); /* Check for enough valid parameters */ - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && - (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) { - - fprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n"); - fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); - fprintf(stderr, "v2 B-tree internal node usage:\n"); - fprintf(stderr, "\th5debug \n"); + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) { + HDfprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n"); + HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); + HDfprintf(stderr, "v2 B-tree internal node usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); - } else if(extra == 0 || extra2 == 0 || extra3 == 0) { + } + else if(extra == 0 || extra2 == 0 || extra3 == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n"); HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); HDfprintf(stderr, "v2 B-tree internal node usage:\n"); @@ -472,23 +476,24 @@ main(int argc, char *argv[]) status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); - } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a v2 B-tree leaf node. - */ + * Debug a v2 B-tree leaf node. + */ const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); /* Check for enough valid parameters */ - if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && - (extra == 0 || extra2 == 0 || extra3 == 0 )) { + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && (extra == 0 || extra2 == 0 || extra3 == 0 )) { - fprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n"); - fprintf(stderr, "v2 B-tree leaf node usage:\n"); - fprintf(stderr, "\th5debug \n"); + HDfprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n"); + HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); + HDfprintf(stderr, "\th5debug \n"); HDexit(4); - } else if(extra == 0 || extra2 == 0) { + } + else if(extra == 0 || extra2 == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); HDfprintf(stderr, "\th5debug \n"); @@ -497,16 +502,18 @@ main(int argc, char *argv[]) status = H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); - } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap header. - */ + * Debug a fractal heap header. + */ status = H5HF_hdr_debug(f, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap direct block. - */ + * Debug a fractal heap direct block. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -518,10 +525,11 @@ main(int argc, char *argv[]) status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra, (size_t)extra2); - } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fractal heap indirect block. - */ + * Debug a fractal heap indirect block. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -533,17 +541,19 @@ main(int argc, char *argv[]) status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra, (unsigned)extra2); - } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a free space header. - */ + * Debug a free space header. + */ status = H5FS_debug(f, addr, stdout, 0, VCOL); - } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug free space serialized sections. - */ + * Debug free space serialized sections. + */ /* Check for enough valid parameters */ if(extra == 0 || extra2 == 0) { @@ -555,17 +565,19 @@ main(int argc, char *argv[]) status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra, extra2); - } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug shared message master table. - */ + * Debug shared message master table. + */ status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); - } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug shared message list index. - */ + * Debug shared message list index. + */ /* Check for enough valid parameters */ if(extra == 0) { @@ -577,10 +589,11 @@ main(int argc, char *argv[]) status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra); - } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray header. - */ + * Debug an extensible aray header. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -594,10 +607,11 @@ main(int argc, char *argv[]) status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); - } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray index block. - */ + * Debug an extensible aray index block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -611,10 +625,11 @@ main(int argc, char *argv[]) status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); - } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray super block. - */ + * Debug an extensible aray super block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -628,10 +643,11 @@ main(int argc, char *argv[]) status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); - } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug an extensible aray data block. - */ + * Debug an extensible aray data block. + */ const H5EA_class_t *cls = get_H5EA_class(sig); HDassert(cls); @@ -645,10 +661,11 @@ main(int argc, char *argv[]) status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); - } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fixed array header. - */ + * Debug a fixed array header. + */ const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); @@ -662,10 +679,11 @@ main(int argc, char *argv[]) status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); - } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug a fixed array data block. - */ + * Debug a fixed array data block. + */ const H5FA_class_t *cls = get_H5FA_class(sig); HDassert(cls); @@ -679,33 +697,37 @@ main(int argc, char *argv[]) status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); - } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + } + else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* - * Debug v2 object header (which have signatures). - */ + * Debug v2 object header (which have signatures). + */ status = H5O_debug(f, addr, stdout, 0, VCOL); - } else if(sig[0] == H5O_VERSION_1) { + } + else if(sig[0] == H5O_VERSION_1) { /* - * This could be a v1 object header. Since they don't have a signature - * it's a somewhat "ify" detection. - */ + * This could be a v1 object header. Since they don't have a signature + * it's a somewhat "ify" detection. + */ status = H5O_debug(f, addr, stdout, 0, VCOL); - } else { + } + else { /* - * Got some other unrecognized signature. - */ - printf("%-*s ", VCOL, "Signature:"); + * Got some other unrecognized signature. + */ + HDprintf("%-*s ", VCOL, "Signature:"); for (u = 0; u < sizeof(sig); u++) { if (sig[u] > ' ' && sig[u] <= '~' && '\\' != sig[u]) HDputchar(sig[u]); else if ('\\' == sig[u]) { HDputchar('\\'); HDputchar('\\'); - } else - printf("\\%03o", sig[u]); + } + else + HDprintf("\\%03o", sig[u]); } HDputchar('\n'); diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index b7ff73c..feb60d4 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -251,7 +251,7 @@ main(int argc, const char *argv[]) /* Display some output if requested */ if(params.verbose) - printf("%s: Creating groups with latest version of the format\n", h5tools_getprogname()); + HDprintf("%s: Creating groups with latest version of the format\n", h5tools_getprogname()); } /* end if */ /* Attempt to open an existing HDF5 file first */ @@ -284,7 +284,7 @@ main(int argc, const char *argv[]) /* Display some output if requested */ if(params.verbose) - printf("%s: Creating parent groups\n", h5tools_getprogname()); + HDprintf("%s: Creating parent groups\n", h5tools_getprogname()); } /* end if */ /* Loop over creating requested groups */ @@ -305,7 +305,7 @@ main(int argc, const char *argv[]) /* Display some output if requested */ if(params.verbose) - printf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]); + HDprintf("%s: created group '%s'\n", h5tools_getprogname(), params.groups[curr_group]); } /* end for */ /* Close link creation property list */ diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c index 2f4d93e..d516fa0 100644 --- a/tools/src/misc/h5repart.c +++ b/tools/src/misc/h5repart.c @@ -15,19 +15,19 @@ * Programmer: Robb Matzke * Wednesday, May 13, 1998 * - * Purpose: Repartitions a file family. This program can be used to - * split a single file into a family of files, join a family of - * files into a single file, or copy one family to another while - * changing the size of the family members. It can also be used - * to copy a single file to a single file with holes. + * Purpose: Repartitions a file family. This program can be used to + * split a single file into a family of files, join a family of + * files into a single file, or copy one family to another while + * changing the size of the family members. It can also be used + * to copy a single file to a single file with holes. */ /* See H5private.h for how to include system headers */ #include "hdf5.h" #include "H5private.h" -#define NAMELEN 4096 -#define GB *1024*1024*1024 +#define NAMELEN 4096 +#define GB *1024*1024*1024 /* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. * The first one updates the member file size in the superblock. The second one @@ -36,15 +36,15 @@ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" #define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" - + /*------------------------------------------------------------------------- - * Function: usage + * Function: usage * - * Purpose: Prints a usage message. + * Purpose: Prints a usage message. * - * Return: void + * Return: void * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, May 13, 1998 * * Modifications: @@ -54,98 +54,99 @@ static void usage (const char *progname) { - fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n", - progname); - fprintf(stderr, " -v Produce verbose output\n"); - fprintf(stderr, " -V Print a version number and exit\n"); - fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n"); - fprintf(stderr, " -m N The destination member size or 1GB\n"); - fprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n"); - fprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n"); - fprintf(stderr, " SRC The name of the source file\n"); - fprintf(stderr, " DST The name of the destination files\n"); - fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " - "`k' for kB.\n"); - fprintf(stderr, "File family names include an integer printf " - "format such as `%%d'\n"); - exit (EXIT_FAILURE); + HDfprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n", + progname); + HDfprintf(stderr, " -v Produce verbose output\n"); + HDfprintf(stderr, " -V Print a version number and exit\n"); + HDfprintf(stderr, " -b N The I/O block size, defaults to 1kB\n"); + HDfprintf(stderr, " -m N The destination member size or 1GB\n"); + HDfprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n"); + HDfprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n"); + HDfprintf(stderr, " SRC The name of the source file\n"); + HDfprintf(stderr, " DST The name of the destination files\n"); + HDfprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or " + "`k' for kB.\n"); + HDfprintf(stderr, "File family names include an integer printf " + "format such as `%%d'\n"); + HDexit (EXIT_FAILURE); } - + /*------------------------------------------------------------------------- - * Function: get_size + * Function: get_size * - * Purpose: Reads a size option of the form `-XNS' where `X' is any - * letter, `N' is a multi-character positive decimal number, and - * `S' is an optional suffix letter in the set [GgMmk]. The - * option may also be split among two arguments as: `-X NS'. - * The input value of ARGNO is the argument number for the - * switch in the ARGV vector and ARGC is the number of entries - * in that vector. + * Purpose: Reads a size option of the form `-XNS' where `X' is any + * letter, `N' is a multi-character positive decimal number, and + * `S' is an optional suffix letter in the set [GgMmk]. The + * option may also be split among two arguments as: `-X NS'. + * The input value of ARGNO is the argument number for the + * switch in the ARGV vector and ARGC is the number of entries + * in that vector. * - * Return: Success: The value N multiplied according to the - * suffix S. On return ARGNO will be the number - * of the next argument to process. + * Return: Success: The value N multiplied according to the + * suffix S. On return ARGNO will be the number + * of the next argument to process. * - * Failure: Calls usage() which exits with a non-zero - * status. + * Failure: Calls usage() which exits with a non-zero + * status. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, May 13, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static off_t get_size (const char *progname, int *argno, int argc, char *argv[]) { - off_t retval=-1; - char *suffix; + off_t retval=-1; + char *suffix; if (isdigit ((int)(argv[*argno][2]))) { - retval = strtol (argv[*argno]+2, &suffix, 10); - (*argno)++; - } else if (argv[*argno][2] || *argno+1>=argc) { - usage (progname); - } else { - retval = strtol (argv[*argno+1], &suffix, 0); - if (suffix==argv[*argno+1]) usage (progname); - *argno += 2; + retval = HDstrtol(argv[*argno]+2, &suffix, 10); + (*argno)++; + } + else if (argv[*argno][2] || *argno+1>=argc) { + usage (progname); + } + else { + retval = HDstrtol(argv[*argno+1], &suffix, 0); + if (suffix == argv[*argno+1]) + usage (progname); + *argno += 2; } if (suffix && suffix[0] && !suffix[1]) { - switch (*suffix) { - case 'G': - case 'g': - retval *= 1024 * 1024 * 1024; - break; - case 'M': - case 'm': - retval *= 1024 * 1024; - break; - case 'k': - retval *= 1024; - break; - default: - usage (progname); - } - } else if (suffix && suffix[0]) { - usage (progname); + switch (*suffix) { + case 'G': + case 'g': + retval *= 1024 * 1024 * 1024; + break; + case 'M': + case 'm': + retval *= 1024 * 1024; + break; + case 'k': + retval *= 1024; + break; + default: + usage(progname); + } + } + else if (suffix && suffix[0]) { + usage (progname); } return retval; } - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Split an hdf5 file + * Purpose: Split an hdf5 file * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, May 13, 1998 * * Modifications: @@ -155,36 +156,36 @@ get_size (const char *progname, int *argno, int argc, char *argv[]) int main (int argc, char *argv[]) { - const char *prog_name; /*program name */ - size_t blk_size=1024; /*size of each I/O block */ - char *buf=NULL; /*I/O block buffer */ - size_t n, i; /*counters */ - ssize_t nio; /*I/O return value */ - int argno=1; /*program argument number */ - int src, dst=-1; /*source & destination files */ - int need_seek=FALSE; /*destination needs to seek? */ - int need_write; /*data needs to be written? */ - h5_stat_t sb; /*temporary file stat buffer */ - - int verbose=FALSE; /*display file names? */ - - const char *src_gen_name; /*general source name */ - char *src_name=NULL; /*source member name */ - - int src_is_family; /*is source name a family name? */ - int src_membno=0; /*source member number */ - - const char *dst_gen_name; /*general destination name */ - char *dst_name=NULL; /*destination member name */ - int dst_is_family; /*is dst name a family name? */ - int dst_membno=0; /*destination member number */ - - off_t left_overs=0; /*amount of zeros left over */ - off_t src_offset=0; /*offset in source member */ - off_t dst_offset=0; /*offset in destination member */ - off_t src_size; /*source logical member size */ - off_t src_act_size; /*source actual member size */ - off_t dst_size=1 GB; /*destination logical memb size */ + const char *prog_name; /*program name */ + size_t blk_size=1024; /*size of each I/O block */ + char *buf=NULL; /*I/O block buffer */ + size_t n, i; /*counters */ + ssize_t nio; /*I/O return value */ + int argno=1; /*program argument number */ + int src, dst=-1; /*source & destination files */ + int need_seek=FALSE; /*destination needs to seek? */ + int need_write; /*data needs to be written? */ + h5_stat_t sb; /*temporary file stat buffer */ + + int verbose=FALSE; /*display file names? */ + + const char *src_gen_name; /*general source name */ + char *src_name=NULL; /*source member name */ + + int src_is_family; /*is source name a family name? */ + int src_membno=0; /*source member number */ + + const char *dst_gen_name; /*general destination name */ + char *dst_name=NULL; /*destination member name */ + int dst_is_family; /*is dst name a family name? */ + int dst_membno=0; /*destination member number */ + + off_t left_overs=0; /*amount of zeros left over */ + off_t src_offset=0; /*offset in source member */ + off_t dst_offset=0; /*offset in destination member */ + off_t src_size; /*source logical member size */ + off_t src_act_size; /*source actual member size */ + off_t dst_size=1 GB; /*destination logical memb size */ hid_t fapl; /*file access property list */ hid_t file; hsize_t hdsize; /*destination logical memb size */ @@ -193,48 +194,50 @@ main (int argc, char *argv[]) /* * Get the program name from argv[0]. Use only the last component. */ - if ((prog_name=strrchr (argv[0], '/'))) prog_name++; - else prog_name = argv[0]; + if ((prog_name = HDstrrchr (argv[0], '/'))) + prog_name++; + else + prog_name = argv[0]; /* * Parse switches. */ - while (argno=argc) usage (prog_name); + if (argno >= argc) + usage(prog_name); src_gen_name = argv[argno++]; - sprintf (src_name, src_gen_name, src_membno); + HDsprintf(src_name, src_gen_name, src_membno); src_is_family = strcmp (src_name, src_gen_name); if ((src = HDopen(src_name, O_RDONLY)) < 0) { @@ -242,157 +245,170 @@ main (int argc, char *argv[]) HDexit(EXIT_FAILURE); } - if (HDfstat(src, &sb)<0) { - perror ("fstat"); - exit (EXIT_FAILURE); + if (HDfstat(src, &sb) < 0) { + HDperror("fstat"); + HDexit(EXIT_FAILURE); } src_size = src_act_size = sb.st_size; - if (verbose) fprintf (stderr, "< %s\n", src_name); + if (verbose) + HDfprintf(stderr, "< %s\n", src_name); /* * Get the name for the destination file and open the first member. */ - if (argno>=argc) usage (prog_name); + if (argno>=argc) + usage (prog_name); dst_gen_name = argv[argno++]; - sprintf (dst_name, dst_gen_name, dst_membno); - dst_is_family = strcmp (dst_name, dst_gen_name); + HDsprintf(dst_name, dst_gen_name, dst_membno); + dst_is_family = HDstrcmp(dst_name, dst_gen_name); if ((dst = HDopen(dst_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { HDperror(dst_name); HDexit(EXIT_FAILURE); } - if (verbose) fprintf (stderr, "> %s\n", dst_name); + if (verbose) + HDfprintf(stderr, "> %s\n", dst_name); /* No more arguments */ - if (argnosrc_size) { - fprintf (stderr, "%s: member truncated to %lu bytes\n", - src_name, (unsigned long)src_size); - } - src_offset = 0; - if (verbose) fprintf (stderr, "< %s\n", src_name); - } - - /* - * Update the destination offset, opening a new member if one will be - * needed. The first member is extended to the logical member size - * but other members might be smaller if they end with a hole. - */ - dst_offset = dst_offset + (off_t)n; - if (dst_is_family && dst_offset==dst_size) { - if (0==dst_membno) { - if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { - perror ("HDHDlseek"); - exit (EXIT_FAILURE); - } - if (HDread (dst, buf, 1)<0) { - perror ("read"); - exit (EXIT_FAILURE); - } - if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDwrite (dst, buf, 1)<0) { - perror ("write"); - exit (EXIT_FAILURE); - } - } - HDclose (dst); - sprintf (dst_name, dst_gen_name, ++dst_membno); - if ((dst = HDopen(dst_name, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { - HDperror(dst_name); - HDexit(EXIT_FAILURE); - } - dst_offset = 0; - need_seek = FALSE; - if (verbose) fprintf (stderr, "> %s\n", dst_name); - } + /* Read a block. The amount to read is the minimum of: + * 1. The I/O block size + * 2. What's left to write in the destination member + * 3. Left over zeros or what's left in the source member. + */ + n = blk_size; + if (dst_is_family) + n = (size_t)MIN((off_t)n, dst_size-dst_offset); + if (left_overs) { + n = (size_t)MIN((off_t)n, left_overs); + left_overs = left_overs - (off_t) n; + need_write = FALSE; + } + else if (src_offset < src_act_size) { + n = (size_t)MIN((off_t)n, src_act_size-src_offset); + if ((nio = HDread(src, buf, n)) < 0) { + HDperror("read"); + HDexit(EXIT_FAILURE); + } + else if ((size_t) nio != n) { + HDfprintf(stderr, "%s: short read\n", src_name); + HDexit(EXIT_FAILURE); + } + for (i = 0; i < n; i++) { + if (buf[i]) + break; + } + need_write = (i < n); + } + else { + n = 0; + left_overs = src_size - src_act_size; + need_write = FALSE; + } + + /* + * If the block contains non-zero data then write it to the + * destination, otherwise just remember that we'll have to do a seek + * later in the destination when we finally get non-zero data. + */ + if (need_write) { + if (need_seek && HDlseek (dst, dst_offset, SEEK_SET) < 0) { + HDperror("HDlseek"); + HDexit(EXIT_FAILURE); + } + if ((nio = HDwrite(dst, buf, n)) < 0) { + HDperror("write"); + HDexit(EXIT_FAILURE); + } + else if ((size_t) nio != n) { + HDfprintf(stderr, "%s: short write\n", dst_name); + HDexit(EXIT_FAILURE); + } + need_seek = FALSE; + } + else { + need_seek = TRUE; + } + + /* + * Update the source offset and open the next source family member if + * necessary. The source stream ends at the first member which + * cannot be opened because it doesn't exist. At the end of the + * source stream, update the destination offset and break out of the + * loop. The destination offset must be updated so we can fix + * trailing holes. + */ + src_offset = src_offset + (off_t) n; + if (src_offset == src_act_size) { + HDclose(src); + if (!src_is_family) { + dst_offset = dst_offset + (off_t) n; + break; + } + HDsprintf(src_name, src_gen_name, ++src_membno); + if ((src = HDopen(src_name, O_RDONLY)) < 0 && ENOENT == errno) { + dst_offset = dst_offset + (off_t) n; + break; + } + else if (src < 0) { + HDperror(src_name); + HDexit(EXIT_FAILURE); + } + if (HDfstat (src, &sb) < 0) { + HDperror("fstat"); + HDexit(EXIT_FAILURE); + } + src_act_size = sb.st_size; + if (src_act_size > src_size) { + HDfprintf(stderr, "%s: member truncated to %lu bytes\n", src_name, (unsigned long) src_size); + } + src_offset = 0; + if (verbose) + HDfprintf(stderr, "< %s\n", src_name); + } + + /* + * Update the destination offset, opening a new member if one will be + * needed. The first member is extended to the logical member size + * but other members might be smaller if they end with a hole. + */ + dst_offset = dst_offset + (off_t) n; + if (dst_is_family && dst_offset == dst_size) { + if (0 == dst_membno) { + if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) { + HDperror("HDHDlseek"); + HDexit(EXIT_FAILURE); + } + if (HDread (dst, buf, 1) < 0) { + HDperror("read"); + HDexit(EXIT_FAILURE); + } + if (HDlseek (dst, dst_size-1, SEEK_SET) < 0) { + HDperror("HDlseek"); + HDexit(EXIT_FAILURE); + } + if (HDwrite (dst, buf, 1) < 0) { + HDperror("write"); + HDexit(EXIT_FAILURE); + } + } + HDclose(dst); + HDsprintf(dst_name, dst_gen_name, ++dst_membno); + if ((dst = HDopen(dst_name, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) { + HDperror(dst_name); + HDexit(EXIT_FAILURE); + } + dst_offset = 0; + need_seek = FALSE; + if (verbose) + HDfprintf(stderr, "> %s\n", dst_name); + } } /* @@ -401,30 +417,30 @@ main (int argc, char *argv[]) * family has been truncated. */ if (need_seek) { - if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDread (dst, buf, 1)<0) { - perror ("read"); - exit (EXIT_FAILURE); - } - if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { - perror ("HDlseek"); - exit (EXIT_FAILURE); - } - if (HDwrite (dst, buf, 1)<0) { - perror ("write"); - exit (EXIT_FAILURE); - } + if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { + HDperror ("HDlseek"); + HDexit (EXIT_FAILURE); + } + if (HDread (dst, buf, 1)<0) { + HDperror ("read"); + HDexit (EXIT_FAILURE); + } + if (HDlseek (dst, dst_offset-1, SEEK_SET)<0) { + HDperror ("HDlseek"); + HDexit (EXIT_FAILURE); + } + if (HDwrite (dst, buf, 1)<0) { + HDperror ("write"); + HDexit (EXIT_FAILURE); + } } HDclose (dst); /* Modify family driver information saved in superblock through private property. * These private properties are for this tool only. */ - if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) { - perror ("H5Pcreate"); - exit (EXIT_FAILURE); + if ((fapl=H5Pcreate(H5P_FILE_ACCESS)) < 0) { + HDperror ("H5Pcreate"); + HDexit (EXIT_FAILURE); } if(family_to_single) { @@ -433,23 +449,24 @@ main (int argc, char *argv[]) * the library to ignore the family driver information saved in the superblock. */ if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) { - perror ("H5Pset"); - exit (EXIT_FAILURE); + HDperror ("H5Pset"); + HDexit (EXIT_FAILURE); } - } else { + } + else { /* Modify family size saved in superblock through private property. It signals * library to save the new member size(specified in command line) in superblock. * This private property is for this tool only. */ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { - perror ("H5Pset_fapl_family"); - exit (EXIT_FAILURE); + HDperror ("H5Pset_fapl_family"); + HDexit (EXIT_FAILURE); } /* Set the property of the new member size as hsize_t */ hdsize = (hsize_t)dst_size; if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { - perror ("H5Pset"); - exit (EXIT_FAILURE); + HDperror ("H5Pset"); + HDexit (EXIT_FAILURE); } } @@ -465,16 +482,16 @@ main (int argc, char *argv[]) file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; - if(file>=0) { - if(H5Fclose(file)<0) { - perror ("H5Fclose"); - exit (EXIT_FAILURE); + if(file >= 0) { + if(H5Fclose(file) < 0) { + HDperror("H5Fclose"); + HDexit(EXIT_FAILURE); } /* end if */ } /* end if */ - if(H5Pclose(fapl)<0) { - perror ("H5Pclose"); - exit (EXIT_FAILURE); + if(H5Pclose(fapl) < 0) { + HDperror("H5Pclose"); + HDexit(EXIT_FAILURE); } /* end if */ /* Free resources and return */ diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c index 9f5d916..f6aa72f 100644 --- a/tools/test/h5copy/h5copygentest.c +++ b/tools/test/h5copy/h5copygentest.c @@ -326,7 +326,7 @@ static void gent_nested_vl(hid_t loc_id) * Function: gent_att_compound_vlstr * * Purpose: Generate a dataset and a group. - * Both has an attribute with a compound datatype consisting + * Both has an attribute with a compound datatype consisting * of a variable length string * *------------------------------------------------------------------------- @@ -337,15 +337,15 @@ static void gent_att_compound_vlstr(hid_t loc_id) int i; const char *v; } s1; - hsize_t dim[1] = {1}; /* Dimension size */ - hid_t sid = -1; /* Dataspace ID */ - hid_t tid = -1; /* Datatype ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t did = -1; /* Dataset ID */ - hid_t gid = -1; /* Group ID */ - hid_t vl_str_tid = -1; /* Variable length datatype ID */ - hid_t cmpd_tid = -1; /* Compound datatype ID */ - hid_t null_sid = -1; /* Null dataspace ID */ + hsize_t dim[1] = {1}; /* Dimension size */ + hid_t sid = -1; /* Dataspace ID */ + hid_t tid = -1; /* Datatype ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t did = -1; /* Dataset ID */ + hid_t gid = -1; /* Group ID */ + hid_t vl_str_tid = -1; /* Variable length datatype ID */ + hid_t cmpd_tid = -1; /* Compound datatype ID */ + hid_t null_sid = -1; /* Null dataspace ID */ s1 buf; /* Buffer */ buf.i = 9; @@ -509,7 +509,7 @@ static herr_t gen_obj_ref(hid_t loc_id) sid = H5Screate_simple(1, dims1, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -517,7 +517,7 @@ static herr_t gen_obj_ref(hid_t loc_id) oid = H5Dcreate2 (loc_id, OBJ_REF_DS, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -525,7 +525,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Dwrite(oid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -538,7 +538,7 @@ static herr_t gen_obj_ref(hid_t loc_id) oid = H5Gcreate2 (loc_id, OBJ_REF_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (oid < 0) { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -547,14 +547,14 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Rcreate (&or_data[0], loc_id, OBJ_REF_DS, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } status = H5Rcreate (&or_data[1], loc_id, OBJ_REF_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -562,7 +562,7 @@ static herr_t gen_obj_ref(hid_t loc_id) sid = H5Screate_simple (1, dims2, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -570,7 +570,7 @@ static herr_t gen_obj_ref(hid_t loc_id) oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (oid < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -578,7 +578,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, or_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -618,7 +618,7 @@ static herr_t gen_region_ref(hid_t loc_id) sid = H5Screate_simple (2, dims2, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -627,7 +627,7 @@ static herr_t gen_region_ref(hid_t loc_id) oid2 = H5Dcreate2 (loc_id, REG_REF_DS2, H5T_STD_I8LE, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (oid2 < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -636,7 +636,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Dwrite (oid2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -645,7 +645,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Sselect_elements (sid, H5S_SELECT_SET, 4, coords[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -654,7 +654,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Rcreate (&rr_data[0], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -663,7 +663,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Sselect_hyperslab (sid, H5S_SELECT_SET, start, stride, count, block); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -672,7 +672,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Rcreate (&rr_data[1], loc_id, REG_REF_DS2, H5R_DATASET_REGION, sid); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -683,7 +683,7 @@ static herr_t gen_region_ref(hid_t loc_id) sid = H5Screate_simple (1, dims1, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -692,7 +692,7 @@ static herr_t gen_region_ref(hid_t loc_id) oid1 = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (oid1 < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -701,7 +701,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Dwrite (oid1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -725,30 +725,30 @@ out: *------------------------------------------------------------------------*/ static void Test_Obj_Copy(void) { - hid_t fid = -1; /* File id */ - hid_t fapl_new = (-1); /* File access property id */ - unsigned new_format; /* New format or old format */ + hid_t fid = -1; /* File id */ + hid_t fapl_new = (-1); /* File access property id */ + unsigned new_format; /* New format or old format */ if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - fprintf(stderr, "Error: H5Pcreate failed.\n"); + HDfprintf(stderr, "Error: H5Pcreate failed.\n"); goto out; } if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n"); + HDfprintf(stderr, "Error: H5Pset_libver_bounds failed.\n"); goto out; } /* Test with old & new format groups */ for(new_format = FALSE; new_format <= TRUE; new_format++) { - + /* Set the FAPL for the type of format */ /* Create source file */ if(new_format) - fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new); - else - fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new); + else + fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(fid < 0) { - fprintf(stderr, "Error: H5Fcreate failed.\n"); + HDfprintf(stderr, "Error: H5Fcreate failed.\n"); goto out; } @@ -756,7 +756,7 @@ static void Test_Obj_Copy(void) gent_empty_group(fid); gent_nested_datasets(fid); gent_nested_group(fid); - gent_att_compound_vlstr(fid); + gent_att_compound_vlstr(fid); H5Fclose(fid); fid = (-1); @@ -786,19 +786,19 @@ static void Test_Ref_Copy(void) fid = H5Fcreate (HDF_FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE2); goto out; } /* add object reference */ status = gen_obj_ref(fid); if (status < 0) - fprintf(stderr, "Failed to generate object reference.\n"); + HDfprintf(stderr, "Failed to generate object reference.\n"); /* add region reference */ status = gen_region_ref(fid); if (status < 0) - fprintf(stderr, "Failed to generate region reference.\n"); + HDfprintf(stderr, "Failed to generate region reference.\n"); out: /*----------------------------------------------------------------------- @@ -829,7 +829,7 @@ static herr_t gen_extlink_trg(hid_t loc_id) gid = H5Gcreate2(loc_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -845,7 +845,7 @@ static herr_t gen_extlink_trg(hid_t loc_id) status = H5Tcommit2(loc_id, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -878,7 +878,7 @@ static herr_t gen_extlink_src(hid_t loc_id) gid = H5Gcreate2(loc_id, "/group_ext", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -890,7 +890,7 @@ static herr_t gen_extlink_src(hid_t loc_id) status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/simple", gid, "extlink_dset", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -899,7 +899,7 @@ static herr_t gen_extlink_src(hid_t loc_id) status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/group", gid, "extlink_grp", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -908,7 +908,7 @@ static herr_t gen_extlink_src(hid_t loc_id) status = H5Lcreate_external(HDF_EXT_TRG_FILE, "/datatype", gid, "extlink_datatype", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -917,7 +917,7 @@ static herr_t gen_extlink_src(hid_t loc_id) status = H5Lcreate_external(HDF_EXT_TRG_FILE, "notyet", gid, "extlink_notyet1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -926,7 +926,7 @@ static herr_t gen_extlink_src(hid_t loc_id) status = H5Lcreate_external("notyet_file.h5", "notyet", gid, "extlink_notyet2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Lcreate_external failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -953,26 +953,26 @@ static void Test_Extlink_Copy(void) fid1 = H5Fcreate (HDF_EXT_SRC_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_SRC_FILE); goto out; } fid2 = H5Fcreate (HDF_EXT_TRG_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_EXT_TRG_FILE); goto out; } /* add links to source external link file */ status = gen_extlink_src(fid1); if (status < 0) - fprintf(stderr, "Error: %s> gen_extlink_src failed.\n", HDF_EXT_SRC_FILE); + HDfprintf(stderr, "Error: %s> gen_extlink_src failed.\n", HDF_EXT_SRC_FILE); /* add objs to target external link file */ status = gen_extlink_trg(fid2); if (status < 0) - fprintf(stderr, "Error: %s> gen_extlink_trg failed.\n", HDF_EXT_TRG_FILE); + HDfprintf(stderr, "Error: %s> gen_extlink_trg failed.\n", HDF_EXT_TRG_FILE); out: /*----------------------------------------------------------------------- diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c index 4f92cae..d60e393 100644 --- a/tools/test/h5diff/h5diffgentest.c +++ b/tools/test/h5diff/h5diffgentest.c @@ -310,11 +310,11 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) /* create the empty file */ if ((fid1 = H5Fcreate(fname3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - fprintf(stderr, "empty file (%s) creation failed.\n", fname3); + HDfprintf(stderr, "empty file (%s) creation failed.\n", fname3); goto out; } if (H5Fclose(fid1) < 0) { - fprintf(stderr, "empty file (%s) close failed.\n", fname3); + HDfprintf(stderr, "empty file (%s) close failed.\n", fname3); goto out; } @@ -1065,7 +1065,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) * Create file1 *-----------------------------------------------------------------------*/ if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1075,28 +1075,28 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) */ f1_gid = H5Gcreate2(fid1, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_gid < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid2 = H5Gcreate2(fid1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid3 = H5Gcreate2(fid1, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_gid3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } f1_gid4 = H5Gcreate2(fid1, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_gid4 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -1107,13 +1107,13 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) f1_sid = H5Screate_simple(1, dset_dims, NULL); f1_did = H5Dcreate2(fid1, "dset", H5T_NATIVE_INT, f1_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f1_did == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = H5Dwrite(f1_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -1124,7 +1124,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) f1_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid1, "ntype", f1_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1); status = FAIL; goto out; } @@ -1133,7 +1133,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) * Create file2 *-----------------------------------------------------------------------*/ if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -1143,28 +1143,28 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) */ f2_gid = H5Gcreate2(fid2, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_gid < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid2 = H5Gcreate2(fid2, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid3 = H5Gcreate2(fid2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_gid3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } f2_gid4 = H5Gcreate2(fid2, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_gid4 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -1175,13 +1175,13 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) f2_sid = H5Screate_simple(1, dset_dims, NULL); f2_did = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, f2_sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (f2_did == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = H5Dwrite(f2_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname2); status = FAIL; goto out; } @@ -1192,7 +1192,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2) f2_tid = H5Tcopy(H5T_NATIVE_INT); status = H5Tcommit2(fid2, "ntype", f2_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2); status = FAIL; goto out; } @@ -1423,7 +1423,7 @@ static int test_link_name(const char *fname1) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1433,7 +1433,7 @@ static int test_link_name(const char *fname1) *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -1441,7 +1441,7 @@ static int test_link_name(const char *fname1) H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -1451,14 +1451,14 @@ static int test_link_name(const char *fname1) *------------------------------------------------------------------------*/ status = H5Lcreate_soft("group", fid1, "link_g1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("group_longname", fid1, "link_g2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } @@ -1498,7 +1498,7 @@ static int test_soft_links(const char *fname1) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1508,7 +1508,7 @@ static int test_soft_links(const char *fname1) *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -1519,21 +1519,21 @@ static int test_soft_links(const char *fname1) /* file1 */ status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -1544,42 +1544,42 @@ static int test_soft_links(const char *fname1) /* file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset1", fid1, "softlink_dset1_2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_group", fid1, "softlink_group2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/no_obj", fid1, "softlink_noexist", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } @@ -1619,7 +1619,7 @@ static int test_linked_softlinks(const char *fname1) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1629,21 +1629,21 @@ static int test_linked_softlinks(const char *fname1) *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid1, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2 = H5Gcreate2(fid1, "target_group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3 = H5Gcreate2(fid1, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -1654,20 +1654,20 @@ static int test_linked_softlinks(const char *fname1) /* file1 */ status = write_dset(fid1, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "target_dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -1679,84 +1679,84 @@ static int test_linked_softlinks(const char *fname1) * file 1 */ status = H5Lcreate_soft("/target_dset1", fid1, "softlink1_to_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_dset1", fid1, "softlink1_to_slink1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink1_to_slink1", fid1, "softlink1_to_slink2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/target_dset2", fid1, "softlink2_to_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_dset2", fid1, "softlink2_to_slink1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink2_to_slink1", fid1, "softlink2_to_slink2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group1", fid1, "softlink3_to_group1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_group1", fid1, "softlink3_to_slink1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink3_to_slink1", fid1, "softlink3_to_slink2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("target_group2", fid1, "softlink4_to_group2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_group2", fid1, "softlink4_to_slink1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("softlink4_to_slink1", fid1, "softlink4_to_slink2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } @@ -1801,7 +1801,7 @@ static int test_external_links(const char *fname1, const char *fname2) /* source file */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1809,7 +1809,7 @@ static int test_external_links(const char *fname1, const char *fname2) /* target file */ fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -1821,14 +1821,14 @@ static int test_external_links(const char *fname1, const char *fname2) * target file */ gid1 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2 = H5Gcreate2(fid2, "target_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -1839,21 +1839,21 @@ static int test_external_links(const char *fname1, const char *fname2) * target file */ status = write_dset(fid2, 2, dims2, "target_dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "x_dset", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2, 2, dims2, "x_dset", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -1865,42 +1865,42 @@ static int test_external_links(const char *fname1, const char *fname2) /* source file */ status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2/x_dset", fid1, "ext_link_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group", fid1, "/ext_link_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/target_group2", fid1, "/ext_link_grp2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link_noexist1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link_noexist2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } @@ -1945,7 +1945,7 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) /* source file */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -1953,7 +1953,7 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) /* target file */ fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -1964,7 +1964,7 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) /* target file */ gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -1976,14 +1976,14 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * target file */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -1995,14 +1995,14 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * target file */ status = H5Lcreate_soft("/dset1", fid2, "softlink_to_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "softlink_to_dset2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } @@ -2014,21 +2014,21 @@ static int test_ext2soft_links(const char *fname1, const char *fname2) * source file */ status = H5Lcreate_external(fname2, "/target_group", fid1, "ext_link", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset1", fid1, "ext_link_to_slink1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/softlink_to_dset2", fid1, "ext_link_to_slink2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } @@ -2158,14 +2158,14 @@ static int test_dangle_links(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -2176,14 +2176,14 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -2191,14 +2191,14 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file2 */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -2209,28 +2209,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file 1 */ status = H5Lcreate_soft("no_obj", fid1, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/dset1", fid1, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid1, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj1", fid1, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } @@ -2238,28 +2238,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj", fid2, "soft_link2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/dset2", fid2, "soft_link3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("no_obj2", fid2, "soft_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } @@ -2270,28 +2270,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file1 */ status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/dset1", fid1, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "no_obj", fid1, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } @@ -2299,28 +2299,28 @@ static int test_dangle_links(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "no_obj", fid2, "ext_link2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/dset2", fid2, "ext_link3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } @@ -2361,14 +2361,14 @@ static int test_group_recurse(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -2379,28 +2379,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file1 */ gid1_f1 = H5Gcreate2(fid1, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1_f1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid2_f1 = H5Gcreate2(fid1, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2_f1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid3_f1 = H5Gcreate2(fid1, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid3_f1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } gid10_f1 = H5Gcreate2(fid1, "/grp10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid10_f1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -2408,28 +2408,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ gid1_f2 = H5Gcreate2(fid2, "/grp1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1_f2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid2_f2 = H5Gcreate2(fid2, "/grp1/grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2_f2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid3_f2 = H5Gcreate2(fid2, "/grp1/grp2/grp3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid3_f2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } gid11_f2 = H5Gcreate2(fid2, "/grp11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid11_f2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -2440,21 +2440,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -2462,21 +2462,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(fid2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(fid2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -2487,54 +2487,54 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file1 */ status = write_dset(gid1_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid2_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid2_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid3_f1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid3_f1, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid3_f1, 2, dims2, "dset3", H5T_NATIVE_INT, data3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid10_f1, 2, dims2, "dset4", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid10_f1, 2, dims2, "dset5", H5T_NATIVE_INT, data3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -2542,54 +2542,54 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ status = write_dset(gid1_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid3_f2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid3_f2, 2, dims2, "dset2", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid3_f2, 2, dims2, "dset3", H5T_NATIVE_INT, data3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid11_f2, 2, dims2, "dset4", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid11_f2, 2, dims2, "dset5", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -2600,28 +2600,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file 1 */ status = H5Lcreate_soft("/grp1", fid1, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid1, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid1, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_soft("/grp10", fid1, "slink_grp10", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1); status = FAIL; goto out; } @@ -2629,28 +2629,28 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file 2 */ status = H5Lcreate_soft("/grp1", fid2, "slink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2", fid2, "slink_grp2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp1/grp2/grp3", fid2, "slink_grp3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_soft("/grp11", fid2, "slink_grp11", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2); status = FAIL; goto out; } @@ -2661,21 +2661,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file1 */ status = H5Lcreate_external(fname2, "/grp1", fid1, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2", fid1, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } status = H5Lcreate_external(fname2, "/grp1/grp2/grp3", fid1, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } @@ -2683,21 +2683,21 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file2 */ status = H5Lcreate_external(fname1, "/grp1", fid2, "elink_grp1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2", fid2, "elink_grp2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } status = H5Lcreate_external(fname1, "/grp1/grp2/grp3", fid2, "elink_grp3", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } @@ -2709,14 +2709,14 @@ static int test_group_recurse(const char *fname1, const char *fname2) /* file1 */ status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1); status = FAIL; goto out; } /* file2 */ status = H5Lcreate_external(fname1, "/grp10", gid11_f2, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2); status = FAIL; goto out; } @@ -2790,28 +2790,28 @@ static int test_group_recurse2(void) *------------------------------------------------------------------------*/ grp1 = H5Gcreate2(fileid1, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp2 = H5Gcreate2(grp1, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } grp4 = H5Gcreate2(grp3, "g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp4 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } @@ -2886,7 +2886,7 @@ static int test_group_recurse2(void) /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid1, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } @@ -2910,7 +2910,7 @@ static int test_group_recurse2(void) */ grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp4 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT3); status = FAIL; goto out; } @@ -2944,14 +2944,14 @@ static int test_group_recurse2(void) */ grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } grp3 = H5Gcreate2(grp2, "g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } @@ -2975,7 +2975,7 @@ static int test_group_recurse2(void) */ status = H5Lcreate_external(GRP_RECURSE2_EXT3, "/g4", fileid3, "/g2/g3/g4", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT2); status = FAIL; goto out; } @@ -2996,7 +2996,7 @@ static int test_group_recurse2(void) */ grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (grp1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", GRP_RECURSE1_EXT); status = FAIL; goto out; } @@ -3020,7 +3020,7 @@ static int test_group_recurse2(void) /* link to dset1 */ status = H5Lcreate_soft(GRP_R_DSETNAME1, fileid2, "soft_dset1", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE2_EXT1); + HDfprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; } @@ -3030,7 +3030,7 @@ static int test_group_recurse2(void) */ status = H5Lcreate_external(GRP_RECURSE2_EXT2, "/g2", fileid2, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1); + HDfprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", GRP_RECURSE2_EXT1); status = FAIL; goto out; } @@ -3083,14 +3083,14 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -3101,7 +3101,7 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -3110,7 +3110,7 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) gid2 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -3121,21 +3121,21 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset3", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -3143,21 +3143,21 @@ static int test_exclude_obj1(const char *fname1, const char *fname2) /* file2 */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2, 2, dims2, "dset3", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -3204,14 +3204,14 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -3222,7 +3222,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file1 */ gid1 = H5Gcreate2(fid1, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -3230,7 +3230,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file2 */ gid2 = H5Gcreate2(fid2, "group10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -3239,7 +3239,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) gid3 = H5Gcreate2(fid2, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid3 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2); status = FAIL; goto out; } @@ -3250,21 +3250,21 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file1 */ status = write_dset(fid1, 2, dims2, "dset10", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset2", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -3272,21 +3272,21 @@ static int test_exclude_obj2(const char *fname1, const char *fname2) /* file2 */ status = write_dset(fid2, 2, dims2, "dset10", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid2, 2, dims2, "dset2", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } status = write_dset(gid3, 2, dims2, "dset3", H5T_NATIVE_INT, data2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -3332,14 +3332,14 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) *------------------------------------------------------------------------*/ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); status = FAIL; goto out; } @@ -3350,7 +3350,7 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) /* file1 */ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -3361,14 +3361,14 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) /* file1 */ status = write_dset(fid1, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } status = write_dset(gid1, 2, dims2, "dset", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname1); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname1); status = FAIL; goto out; } @@ -3376,7 +3376,7 @@ static int test_exclude_obj3(const char *fname1, const char *fname2) /* file2 */ status = write_dset(fid2, 2, dims2, "dset1", H5T_NATIVE_INT, data1); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname2); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname2); status = FAIL; goto out; } @@ -3698,7 +3698,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int if (is_file_new == 1) { fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); status = FAIL; goto out; } @@ -3706,7 +3706,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int else { fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); status = FAIL; goto out; } @@ -3717,7 +3717,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -3727,7 +3727,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); if (sid_vlen_str < 0) { - fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } @@ -3735,7 +3735,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } @@ -3745,7 +3745,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); if (sid_fixlen_str < 0) { - fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } @@ -3753,7 +3753,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } @@ -3763,7 +3763,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); if (sid_vlen_str_array < 0) { - fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } @@ -3771,7 +3771,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } @@ -3779,7 +3779,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int /* Create the array data type for the string array */ tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array); if (tid_vlen_str_array < 0) { - fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; } @@ -3789,7 +3789,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); if (sid_fixlen_str_array < 0) { - fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } @@ -3797,14 +3797,14 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); status = FAIL; goto out; } /* Create the array data type for the string array */ tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array); if (tid_fixlen_str_array < 0) { - fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; goto out; } @@ -3814,7 +3814,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int *------------------------------------------------------------------------*/ sid_comp = H5Screate_simple(COMP_RANK, dims_comp, NULL); if (sid_comp < 0) { - fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } @@ -3928,7 +3928,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3938,7 +3938,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3948,7 +3948,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3958,7 +3958,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3968,7 +3968,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3978,7 +3978,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3988,7 +3988,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -3998,7 +3998,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int did_comp = H5Dcreate2(gid, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -4014,7 +4014,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); if (status < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } @@ -4136,14 +4136,14 @@ static int test_enums(const char *fname) enum_val = 0; status = H5Tenum_insert(tid, "YIN", &enum_val); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); + HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } enum_val = 1; status = H5Tenum_insert(tid, "YANG", &enum_val); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); + HDfprintf(stderr, "Error: %s> H5Tenum_insert failed.\n", fname); status = FAIL; goto out; } @@ -4154,13 +4154,13 @@ static int test_enums(const char *fname) status = write_dset(fid, 1, &dims, "dset1", tid, data1); if (status < 0) { - fprintf(stderr, "Error: %s> write_dset failed.\n", fname); + HDfprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; } status = write_dset(fid, 1, &dims, "dset2", tid, data2); if (status < 0) { - fprintf(stderr, "Error: %s> write_dset failed.\n", fname); + HDfprintf(stderr, "Error: %s> write_dset failed.\n", fname); status = FAIL; goto out; } @@ -4794,7 +4794,7 @@ static void test_data_nocomparables(const char * fname, int make_diffs) *------------------------------------------------------------------------*/ fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname); status = FAIL; goto out; } @@ -4804,14 +4804,14 @@ static void test_data_nocomparables(const char * fname, int make_diffs) *------------------------------------------------------------------------*/ gid1 = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid1 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; } gid2 = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid2 < 0) { - fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); + HDfprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname); status = FAIL; goto out; } @@ -4824,13 +4824,13 @@ static void test_data_nocomparables(const char * fname, int make_diffs) /* dset1 */ if ((did1 = H5Dcreate2(gid1, "dset1", tid_dset1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } if (H5Dwrite(did1, tid_dset1, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr1) < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } @@ -4839,7 +4839,7 @@ static void test_data_nocomparables(const char * fname, int make_diffs) /* dset2 */ status = write_dset(gid1, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr2); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } @@ -4849,13 +4849,13 @@ static void test_data_nocomparables(const char * fname, int make_diffs) /* --------- * dset1 */ if ((did2 = H5Dcreate2(gid2, "dset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - fprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); + HDfprintf(stderr, "Error: %s> H5Dcreate2 failed.\n", "dset1"); status = FAIL; goto out; } if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data_ptr3) < 0) { - fprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); + HDfprintf(stderr, "Error: %s> H5Dwrite failed.\n", "dset1"); status = FAIL; goto out; } @@ -4875,7 +4875,7 @@ static void test_data_nocomparables(const char * fname, int make_diffs) * dset2 */ status = write_dset(gid2, 1, dims1_1, "dset2", H5T_NATIVE_INT, dset_data_ptr3); if (status == FAIL) { - fprintf(stderr, "Error: %s> write_dset failed\n", fname); + HDfprintf(stderr, "Error: %s> write_dset failed\n", fname); goto out; } @@ -5085,14 +5085,14 @@ static void test_objs_strings(const char *fname1, const char *fname2) /* file1 */ fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid1 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); goto out; } /* file2 */ fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid2 < 0) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); + HDfprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2); goto out; } diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 699a226..35c3e3c 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -563,7 +563,7 @@ gent_attribute(void) dims[0] = 24; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(root, "/attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "attribute of root group"); + HDsprintf(buf, "attribute of root group"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1373,7 +1373,7 @@ static void gent_all(void) dims[0] = 10; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "abcdefghi"); + HDsprintf(buf, "abcdefghi"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1404,7 +1404,7 @@ static void gent_all(void) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "1st attribute of dset1.1.1"); + HDsprintf(buf, "1st attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1412,7 +1412,7 @@ static void gent_all(void) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "2nd attribute of dset1.1.1"); + HDsprintf(buf, "2nd attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -1608,7 +1608,7 @@ gent_many(void) dims[0] = 10; space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space2, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "abcdefghi"); + HDsprintf(buf, "abcdefghi"); H5Awrite(attr, H5T_NATIVE_CHAR, buf); H5Sclose(space2); H5Aclose(attr); @@ -1927,9 +1927,9 @@ static void gent_str2(void) dims[0] = 3; space2 = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", fxdlenstr2, space2, H5P_DEFAULT, H5P_DEFAULT); - sprintf(&(buf2[0*LENSTR2]), "0123456789"); - sprintf(&(buf2[1*LENSTR2]), "abcdefghij"); - sprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ"); + HDsprintf(&(buf2[0*LENSTR2]), "0123456789"); + HDsprintf(&(buf2[1*LENSTR2]), "abcdefghij"); + HDsprintf(&(buf2[2*LENSTR2]), "ABCDEFGHIJ"); H5Awrite(attr, fxdlenstr2, buf2); H5Sclose(space2); H5Tclose(fxdlenstr2); @@ -1941,7 +1941,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1954,7 +1954,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1974,7 +1974,7 @@ static void gent_str2(void) for(i = 0;(hsize_t) i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1988,7 +1988,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2007,7 +2007,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2021,7 +2021,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); + HDsprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2704,14 +2704,14 @@ gent_vldatatypes2(void) for(i = 0; i < SPACE1_DIM1; i++) { wdata[i].p = (hvl_t *)HDmalloc((i + 1) * sizeof(hvl_t)); if(wdata[i].p == NULL) { - printf("Cannot allocate memory for VL data! i=%u\n", i); + HDprintf("Cannot allocate memory for VL data! i=%u\n", i); return; } /* end if */ wdata[i].len = i + 1; for(t1 = (hvl_t *)wdata[i].p, j = 0; j < (i + 1); j++, t1++) { t1->p = (unsigned *)HDmalloc((j + 1) * sizeof(unsigned)); if(t1->p == NULL) { - printf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); + HDprintf("Cannot allocate memory for VL data! i=%u, j=%u\n",i,j); return; } /* end if */ t1->len=j+1; @@ -3763,9 +3763,9 @@ void gent_multi(void) for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { memb_fapl[mt] = H5P_DEFAULT; memb_map[mt] = mt; - sprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); memb_name[mt] = sv[mt]; - /*printf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ + /*HDprintf("memb_name[%d]=%s, memb_map[%d]=%d; ", mt, memb_name[mt], mt, memb_map[mt]);*/ memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); } memb_map[H5FD_MEM_DEFAULT] = H5FD_MEM_SUPER; @@ -3804,7 +3804,7 @@ static void gent_large_objname(void) group = H5Gcreate2(fid, "this_is_a_large_group_name", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(i = 0; i < 50; ++i) { - sprintf(grp_name, "this_is_a_large_group_name%d", i); + HDsprintf(grp_name, "this_is_a_large_group_name%d", i); group2 = H5Gcreate2(group, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(group2); } @@ -6275,7 +6275,7 @@ static int gent_ldouble(void) return 0; error: - printf("error !\n"); + HDprintf("error !\n"); return -1; } @@ -6438,7 +6438,7 @@ gent_bigdims(void) return; out: - printf("Error.....\n"); + HDprintf("Error.....\n"); H5E_BEGIN_TRY { H5Pclose(dcpl); H5Sclose(f_sid); @@ -6630,7 +6630,7 @@ gent_group_creation_order(void) return; out: - printf("Error.....\n"); + HDprintf("Error.....\n"); H5E_BEGIN_TRY { H5Gclose(gid); H5Pclose(gcpl_id); @@ -6899,7 +6899,7 @@ gent_attr_creation_order(void) return; out: - printf("Error.....\n"); + HDprintf("Error.....\n"); H5E_BEGIN_TRY { H5Gclose(gid); H5Dclose(did); diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c index bbb67b6..560f1b3 100644 --- a/tools/test/h5import/h5importtest.c +++ b/tools/test/h5import/h5importtest.c @@ -183,8 +183,8 @@ main(void) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10u", b8i3[k][i][j]); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "%10u", b8i3[k][i][j]); + (void) HDfprintf(sp, "\n"); } } (void) HDfclose(sp); @@ -200,8 +200,8 @@ main(void) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10u", b16i3[k][i][j]); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "%10u", b16i3[k][i][j]); + (void) HDfprintf(sp, "\n"); } } (void) HDfclose(sp); @@ -217,8 +217,8 @@ main(void) for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) - (void) fprintf(sp, "%10d", b32i3[k][i][j]); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "%10d", b32i3[k][i][j]); + (void) HDfprintf(sp, "\n"); } } (void) HDfclose(sp); @@ -243,16 +243,16 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binin32.conf", "w"); - (void) fprintf(sp, "PATH /int/bin/32-bit\n"); - (void) fprintf(sp, "INPUT-CLASS IN\n"); - (void) fprintf(sp, "INPUT-SIZE 32\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER BE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 5 3 4\n"); - (void) fprintf(sp, "CHUNKED-DIMENSION-SIZES 1 2 1\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /int/bin/32-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS IN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 32\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n"); + (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 1 2 1\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); /*------------------------------------------------------------------------- @@ -274,15 +274,15 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binuin32.conf", "w"); - (void) fprintf(sp, "PATH /int/buin/32-bit\n"); - (void) fprintf(sp, "INPUT-CLASS UIN\n"); - (void) fprintf(sp, "INPUT-SIZE 32\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 5 3 4\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /int/buin/32-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS UIN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 32\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); /*------------------------------------------------------------------------- @@ -304,17 +304,17 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binin16.conf", "w"); - (void) fprintf(sp, "PATH /int/bin/16-bit\n"); - (void) fprintf(sp, "INPUT-CLASS IN\n"); - (void) fprintf(sp, "INPUT-SIZE 16\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 2 3 4\n"); - (void) fprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); - (void) fprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /int/bin/16-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS IN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 16\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n"); + (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); + (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); /*------------------------------------------------------------------------- @@ -335,17 +335,17 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binuin16.conf", "w"); - (void) fprintf(sp, "PATH /int/buin/16-bit\n"); - (void) fprintf(sp, "INPUT-CLASS UIN\n"); - (void) fprintf(sp, "INPUT-SIZE 16\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER BE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 2 3 4\n"); - (void) fprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); - (void) fprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /int/buin/16-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS UIN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 16\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER BE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 2 3 4\n"); + (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); + (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 8\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); /*------------------------------------------------------------------------- @@ -367,20 +367,20 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binin8.conf", "w"); - (void) fprintf(sp, "PATH /int/bin/8-bit\n"); - (void) fprintf(sp, "INPUT-CLASS IN\n"); - (void) fprintf(sp, "INPUT-SIZE 8\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-CLASS IN\n"); - (void) fprintf(sp, "OUTPUT-SIZE 16\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 5 3 4\n"); - (void) fprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); - (void) fprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 -1\n"); - (void) fprintf(sp, "COMPRESSION-PARAM 3\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /int/bin/8-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS IN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 8\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-CLASS IN\n"); + (void) HDfprintf(sp, "OUTPUT-SIZE 16\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n"); + (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); + (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 -1 -1\n"); + (void) HDfprintf(sp, "COMPRESSION-PARAM 3\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); #endif /* UNICOS */ @@ -408,18 +408,18 @@ main(void) (void) HDfclose(sp); sp = HDfopen("binfp64.conf", "w"); - (void) fprintf(sp, "PATH /fp/bin/64-bit\n"); - (void) fprintf(sp, "INPUT-CLASS FP\n"); - (void) fprintf(sp, "INPUT-SIZE 64\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 3\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE IEEE\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 5 3 4\n"); - (void) fprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); - (void) fprintf(sp, "MAXIMUM-DIMENSIONS -1 6 7\n"); - (void) fprintf(sp, "COMPRESSION-PARAM 8\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "PATH /fp/bin/64-bit\n"); + (void) HDfprintf(sp, "INPUT-CLASS FP\n"); + (void) HDfprintf(sp, "INPUT-SIZE 64\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 3\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE IEEE\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 5 3 4\n"); + (void) HDfprintf(sp, "CHUNKED-DIMENSION-SIZES 2 2 2\n"); + (void) HDfprintf(sp, "MAXIMUM-DIMENSIONS -1 6 7\n"); + (void) HDfprintf(sp, "COMPRESSION-PARAM 8\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); /*------------------------------------------------------------------------- @@ -436,21 +436,21 @@ main(void) { char c = bin8w[i]; if ( HDfwrite( &c, sizeof(char), 1, sp) != 1 ) - printf("error writing file\n"); + HDprintf("error writing file\n"); } HDfclose(sp); sp = HDfopen("binin8w.conf", "w"); - (void) fprintf(sp, "INPUT-CLASS IN\n"); - (void) fprintf(sp, "INPUT-SIZE 8\n"); - (void) fprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); - (void) fprintf(sp, "RANK 1\n"); - (void) fprintf(sp, "OUTPUT-CLASS IN\n"); - (void) fprintf(sp, "OUTPUT-SIZE 8\n"); - (void) fprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); - (void) fprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); - (void) fprintf(sp, "DIMENSION-SIZES 4\n"); - (void) fprintf(sp, "\n"); + (void) HDfprintf(sp, "INPUT-CLASS IN\n"); + (void) HDfprintf(sp, "INPUT-SIZE 8\n"); + (void) HDfprintf(sp, "INPUT-BYTE-ORDER %s\n", machine_order); + (void) HDfprintf(sp, "RANK 1\n"); + (void) HDfprintf(sp, "OUTPUT-CLASS IN\n"); + (void) HDfprintf(sp, "OUTPUT-SIZE 8\n"); + (void) HDfprintf(sp, "OUTPUT-ARCHITECTURE STD\n"); + (void) HDfprintf(sp, "OUTPUT-BYTE-ORDER LE\n"); + (void) HDfprintf(sp, "DIMENSION-SIZES 4\n"); + (void) HDfprintf(sp, "\n"); (void) HDfclose(sp); } diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index 1644440..56b4ead 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -172,7 +172,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dims[0] = 10; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(group, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "abcdefghi"); + HDsprintf(buf, "abcdefghi"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -203,7 +203,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr1", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "1st attribute of dset1.1.1"); + HDsprintf(buf, "1st attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); @@ -211,7 +211,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) dims[0] = 27; space = H5Screate_simple(1, dims, NULL); attr = H5Acreate2(dataset, "attr2", H5T_STD_I8BE, space, H5P_DEFAULT, H5P_DEFAULT); - sprintf(buf, "2nd attribute of dset1.1.1"); + HDsprintf(buf, "2nd attribute of dset1.1.1"); H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index a89bf10..057cbbd 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -3108,7 +3108,7 @@ int make_early(void) goto out; if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; - sprintf(name, "%d", i); + HDsprintf(name, "%d", i); if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5Tclose(tid) < 0) @@ -3133,7 +3133,7 @@ int make_early(void) { if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) goto out; - sprintf(name, "%d", i); + HDsprintf(name, "%d", i); if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if (H5Tclose(tid) < 0) @@ -3195,7 +3195,7 @@ int make_layout(hid_t loc_id) */ for (i=0; i<4; i++) { - sprintf(name,"dset%d",i+1); + HDsprintf(name,"dset%d",i+1); if (write_dset(loc_id,RANK,dims,name,H5T_NATIVE_INT,buf) < 0) return -1; } @@ -6182,7 +6182,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) status = H5Rcreate(&data_attr_objref[0],file_id,NAME_OBJ_DS1,H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6191,7 +6191,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) status = H5Rcreate(&data_attr_objref[1],file_id,NAME_OBJ_GRP,H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6200,7 +6200,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) status = H5Rcreate(&data_attr_objref[2],file_id,NAME_OBJ_NDTYPE,H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6209,7 +6209,7 @@ static herr_t add_attr_with_objref(hid_t file_id, hid_t obj_id) status = make_attr(obj_id,1,dim_attr_objref,"Attr_OBJREF",H5T_STD_REF_OBJ,data_attr_objref); if (status < 0) { - fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6251,7 +6251,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) sid_regrefed_dset = H5Screate_simple (2, dim_regrefed_dset, NULL); if (sid_regrefed_dset < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6260,7 +6260,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) status = H5Sselect_elements (sid_regrefed_dset, H5S_SELECT_SET, (size_t)3, coords_regrefed_dset[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6269,7 +6269,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) status = H5Rcreate (&data_attr_regref[0], file_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_regrefed_dset); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6278,7 +6278,7 @@ static herr_t add_attr_with_regref(hid_t file_id, hid_t obj_id) status = make_attr(obj_id,1,dim_attr_regref,"Attr_REGREF",H5T_STD_REF_DSETREG,data_attr_regref); if (status < 0) { - fprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> make_attr failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6324,7 +6324,7 @@ static herr_t gen_refered_objs(hid_t loc_id) sid = H5Screate_simple(1, dims1, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6332,7 +6332,7 @@ static herr_t gen_refered_objs(hid_t loc_id) did1 = H5Dcreate2 (loc_id, NAME_OBJ_DS1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (did1 < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6340,7 +6340,7 @@ static herr_t gen_refered_objs(hid_t loc_id) status = H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6352,7 +6352,7 @@ static herr_t gen_refered_objs(hid_t loc_id) gid = H5Gcreate2 (loc_id, NAME_OBJ_GRP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (gid < 0) { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6365,7 +6365,7 @@ static herr_t gen_refered_objs(hid_t loc_id) status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6378,7 +6378,7 @@ static herr_t gen_refered_objs(hid_t loc_id) sid2 = H5Screate_simple (2, dims2, NULL); if (sid2 < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6387,7 +6387,7 @@ static herr_t gen_refered_objs(hid_t loc_id) did2 = H5Dcreate2 (loc_id, NAME_OBJ_DS2, H5T_STD_I8LE, sid2, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (did2 < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6396,7 +6396,7 @@ static herr_t gen_refered_objs(hid_t loc_id) status = H5Dwrite (did2, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6453,7 +6453,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Rcreate (&objref_buf[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6462,7 +6462,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Rcreate (&objref_buf[1], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6471,7 +6471,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Rcreate (&objref_buf[2], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6482,7 +6482,7 @@ static herr_t gen_obj_ref(hid_t loc_id) sid = H5Screate_simple (1, dims_dset_objref, NULL); if (sid < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6490,7 +6490,7 @@ static herr_t gen_obj_ref(hid_t loc_id) oid = H5Dcreate2 (loc_id, "Dset_OBJREF", H5T_STD_REF_OBJ, sid, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (oid < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6498,7 +6498,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = H5Dwrite(oid, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, objref_buf); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6511,7 +6511,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = add_attr_with_objref(loc_id, oid); if (status < 0) { - fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6520,7 +6520,7 @@ static herr_t gen_obj_ref(hid_t loc_id) status = add_attr_with_regref(loc_id, oid); if (status < 0) { - fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6573,7 +6573,7 @@ static herr_t gen_region_ref(hid_t loc_id) sid_trg = H5Screate_simple (2, dims_trg, NULL); if (sid_trg < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6582,7 +6582,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Sselect_elements (sid_trg, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6591,7 +6591,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Rcreate (&rr_data[0], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6600,7 +6600,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Sselect_hyperslab (sid_trg, H5S_SELECT_SET, start, stride, count, block); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_hyperslab failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6609,7 +6609,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Rcreate (&rr_data[1], loc_id, NAME_OBJ_DS2, H5R_DATASET_REGION, sid_trg); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6618,7 +6618,7 @@ static herr_t gen_region_ref(hid_t loc_id) sid_ref = H5Screate_simple (1, dims1, NULL); if (sid_ref < 0) { - fprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Screate_simple failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6627,7 +6627,7 @@ static herr_t gen_region_ref(hid_t loc_id) oid_ref = H5Dcreate2 (loc_id, REG_REF_DS1, H5T_STD_REF_DSETREG, sid_ref, H5P_DEFAULT,H5P_DEFAULT,H5P_DEFAULT); if (oid_ref < 0) { - fprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6636,7 +6636,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = H5Dwrite (oid_ref, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rr_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6649,7 +6649,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = add_attr_with_objref(loc_id, oid_ref); if (status < 0) { - fprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_objref failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6658,7 +6658,7 @@ static herr_t gen_region_ref(hid_t loc_id) status = add_attr_with_regref(loc_id, oid_ref); if (status < 0) { - fprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> add_attr_with_regref failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6691,7 +6691,7 @@ static herr_t make_references(hid_t loc_id) status = gen_refered_objs(loc_id); if (status == FAIL) { - fprintf(stderr, "Failed to generate referenced object.\n"); + HDfprintf(stderr, "Failed to generate referenced object.\n"); ret = FAIL; } @@ -6699,7 +6699,7 @@ static herr_t make_references(hid_t loc_id) status = gen_obj_ref(loc_id); if (status == FAIL) { - fprintf(stderr, "Failed to generate object reference.\n"); + HDfprintf(stderr, "Failed to generate object reference.\n"); ret = FAIL; } @@ -6707,7 +6707,7 @@ static herr_t make_references(hid_t loc_id) status = gen_region_ref(loc_id); if (status == FAIL) { - fprintf(stderr, "Failed to generate region reference.\n"); + HDfprintf(stderr, "Failed to generate region reference.\n"); ret = FAIL; } @@ -6831,7 +6831,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Dwrite(objdid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6841,7 +6841,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Tcommit2(loc_id, NAME_OBJ_NDTYPE, objtid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Tcommit2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6854,7 +6854,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) main_gid = H5Gcreate2(loc_id, "group_main", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (main_gid < 0) { - fprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Gcreate2 failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6869,7 +6869,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Dwrite(main_did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obj_data[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dwrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6893,7 +6893,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&(comp_objref_data[0].val_objref), loc_id, NAME_OBJ_DS1, H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6903,7 +6903,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&(comp_objref_data[1].val_objref), loc_id, NAME_OBJ_GRP, H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6913,7 +6913,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&(comp_objref_data[2].val_objref), loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT,(hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6927,7 +6927,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Awrite (comp_objref_aid, comp_objref_tid, comp_objref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6949,14 +6949,14 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Sselect_elements (objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } status = H5Rcreate (&(comp_regref_data[0].val_regref), loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6970,7 +6970,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Awrite (comp_regref_aid, comp_regref_tid, comp_regref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -6996,7 +6996,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7004,7 +7004,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[1].p)[0], loc_id, NAME_OBJ_GRP, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7012,7 +7012,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Rcreate (&((hobj_ref_t*)vlen_objref_data[2].p)[0], loc_id, NAME_OBJ_NDTYPE, H5R_OBJECT, (hid_t)-1); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7030,7 +7030,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Awrite (vlen_objref_attr_id, vlen_objref_attr_tid, vlen_objref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7039,7 +7039,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Dvlen_reclaim (vlen_objref_attr_tid, vlen_objref_attr_sid, H5P_DEFAULT, vlen_objref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7060,14 +7060,14 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Sselect_elements(objsid, H5S_SELECT_SET, (size_t)4, coords[0]); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Sselect_elements failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } status = H5Rcreate (&((hdset_reg_ref_t*)vlen_regref_data[0].p)[0], loc_id, NAME_OBJ_DS1, H5R_DATASET_REGION, objsid); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Rcreate failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7085,7 +7085,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Awrite(vlen_regref_attr_id, vlen_regref_attr_tid, vlen_regref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Awrite failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } @@ -7094,7 +7094,7 @@ static herr_t make_complex_attr_references(hid_t loc_id) status = H5Dvlen_reclaim (vlen_regref_attr_tid, vlen_regref_attr_sid, H5P_DEFAULT, vlen_regref_data); if (status < 0) { - fprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); + HDfprintf(stderr, "Error: %s %d> H5Dvlen_reclaim failed.\n", FUNC, __LINE__); ret = FAIL; goto out; } diff --git a/tools/test/h5repack/testh5repack_detect_szip.c b/tools/test/h5repack/testh5repack_detect_szip.c index 6e7a24e..6b86dd5 100644 --- a/tools/test/h5repack/testh5repack_detect_szip.c +++ b/tools/test/h5repack/testh5repack_detect_szip.c @@ -50,10 +50,10 @@ int main(void) #ifdef H5_HAVE_FILTER_SZIP if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - printf("yes\n"); + HDprintf("yes\n"); return(1); } #endif /* H5_HAVE_FILTER_SZIP */ - printf("no\n"); + HDprintf("no\n"); return(0); } diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c index ae11032..2edfcf6 100644 --- a/tools/test/h5stat/h5stat_gentest.c +++ b/tools/test/h5stat/h5stat_gentest.c @@ -88,7 +88,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_GRPS groups in the root group */ for(i = 1; i <= NUM_GRPS; i++) { - sprintf(name, "%s%d", GROUP_NAME,i); + HDsprintf(name, "%s%d", GROUP_NAME,i); if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Gclose(gid) < 0) @@ -109,7 +109,7 @@ gen_newgrat_file(const char *fname) /* Create NUM_ATTRS for the dataset */ for(i = 1; i <= NUM_ATTRS; i++) { - sprintf(attrname, "%s%d", ATTR_NAME,i); + HDsprintf(attrname, "%s%d", ATTR_NAME,i); if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -190,7 +190,7 @@ gen_threshold_file(const char *fname) /* Create 11 attributes for the dataset */ for(i = 1; i <= (THRES_NUM+1); i++) { - sprintf(name, "%s%d", THRES_ATTR_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -217,7 +217,7 @@ gen_threshold_file(const char *fname) /* Create 10 attributes for the 2-D dataset */ for(i = 1; i <= THRES_NUM; i++) { - sprintf(name, "%s%d", THRES_ATTR_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_NAME,i); if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Aclose(attr_id) < 0) @@ -241,7 +241,7 @@ gen_threshold_file(const char *fname) /* Create 10 1-D datasets with non-zero dimension size for the group */ for(i = 1; i <= THRES_NUM; i++) { /* set up dataset name */ - sprintf(name, "%s%d", THRES_DSET_NAME,i); + HDsprintf(name, "%s%d", THRES_DSET_NAME,i); /* Create the dataset */ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -264,7 +264,7 @@ gen_threshold_file(const char *fname) /* Create 25 attributes for the group */ for(i = 1; i <= THRES_NUM_25; i++) { /* Set up attribute name */ - sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); + HDsprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i); /* Create the attribute */ if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -286,7 +286,7 @@ gen_threshold_file(const char *fname) /* Create 9 1-D datasets with non-zero dimension size for the group */ for(i = 1; i < THRES_NUM; i++) { /* set up dataset name */ - sprintf(name, "%s%d", THRES_DSET_NAME,i); + HDsprintf(name, "%s%d", THRES_DSET_NAME,i); /* Create the dataset */ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 7f80c23..96d7e75e7 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -15,10 +15,10 @@ /* The HDF5 test files */ const char *FILENAME[] = { - "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ - "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ - "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ - "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ + "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ + "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */ + "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ + "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */ }; const char *FILENAME_ENHANCE[] = { @@ -28,12 +28,12 @@ const char *FILENAME_ENHANCE[] = { "h5clear_fsm_persist_user_equal.h5", /* 3: user block, persisting free-space, stored EOA = actual EOF */ "h5clear_fsm_persist_user_greater.h5", /* 4: user block, persisting free-space, stored EOA > actual EOF */ "h5clear_fsm_persist_user_less.h5", /* 5: user block, persisting free-space, stored EOA < actual EOF */ - "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, + "h5clear_status_noclose.h5", /* 6 -- v3 superblock, nonzero status_flags, no flush, exit, stored EOA < actual EOF */ "h5clear_fsm_persist_noclose.h5" /* 7 -- persisting free-space, no flush, exit, stored EOA < actual EOF */ }; -#define KB 1024U +#define KB 1024U #define CACHE_IMAGE_FILE "h5clear_mdc_image.h5" #define DSET "DSET" @@ -42,14 +42,14 @@ const char *FILENAME_ENHANCE[] = { #define USERBLOCK 512 /*------------------------------------------------------------------------- - * Function: gen_cache_image_file + * Function: gen_cache_image_file * - * Purpose: To create a file with cache image feature enabled. + * Purpose: To create a file with cache image feature enabled. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; March 2017 + * Programmer: Vailin Choi; March 2017 * *------------------------------------------------------------------------- */ @@ -136,9 +136,9 @@ error: } /* gen_cache_image_file() */ /*------------------------------------------------------------------------- - * Function: gen_enhance_files + * Function: gen_enhance_files * - * Purpose: To create the first 6 files in FILENAME_ENHANCE[]: + * Purpose: To create the first 6 files in FILENAME_ENHANCE[]: * (0) FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" * (1) FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" * (2) FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" @@ -149,15 +149,15 @@ error: * value to the location where the EOA is stored in the superblock. * Also modify the chksum in the superblock due to this change. * - * The first call to this routine (without user block) will generate + * The first call to this routine (without user block) will generate * the first 3 files. * The second call to this routine (with user block) will generate * the last 3 files. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; March 2017 + * Programmer: Vailin Choi; March 2017 * *------------------------------------------------------------------------- */ @@ -190,7 +190,7 @@ gen_enhance_files(hbool_t user) if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) goto error; - /* + /* * Create the file, then write invalid EOA to the file. */ for(i = 0+u; i < 3+u; i++) { @@ -221,21 +221,21 @@ gen_enhance_files(hbool_t user) if(H5Fclose(fid) < 0) goto error; - /* + /* * No further action for: - * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" + * --FILENAME_ENHANCE[0]: "h5clear_fsm_persist_equal.h5" * --FILENAME_ENHANCE[3]: "h5clear_fsm_persist_user_equal.h5", */ if(!(i % 3)) continue; - /* + /* * For the following files: * --FILENAME_ENHANCE[1]: "h5clear_fsm_persist_greater.h5" * --FILENAME_ENHANCE[2]: "h5clear_fsm_persist_less.h5" * --FILENAME_ENHANCE[4]: "h5clear_fsm_persist_greater.h5" * --FILENAME_ENHANCE[5]: "h5clear_fsm_persist_less.h5" * - * Write invalid value to the location for stored eoa and + * Write invalid value to the location for stored eoa and * update the chksum value. */ /* Open the file */ @@ -306,9 +306,9 @@ error: } /* gen_enhance_files() */ /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Generate test files used by h5clear. + * Purpose: Generate test files used by h5clear. * * (A) gen_cache_image_file(): * --generate a file with cache image feature @@ -317,10 +317,10 @@ error: * --generate the first 6 files in FILENAME_ENHANCE[]: * (0) "h5clear_fsm_persist_equal.h5" * (1) "h5clear_fsm_persist_greater.h5" - * (2) "h5clear_fsm_persist_less.h5" - * (3) "h5clear_fsm_persist_user_equal.h5" + * (2) "h5clear_fsm_persist_less.h5" + * (3) "h5clear_fsm_persist_user_equal.h5" * (4) "h5clear_fsm_persist_user_greater.h5" - * (5) "h5clear_fsm_persist_user_less.h5" + * (5) "h5clear_fsm_persist_user_less.h5" * * (C) Generate the following FILENAME[] files in main(): * (0a) "h5clear_sec2_v3.h5" @@ -328,43 +328,43 @@ error: * (1a) "h5clear_log_v3.h5", * (1b) "latest_h5clear_log_v3.h5" * (2) "h5clear_sec2_v0.h5" - * (3) "h5clear_sec2_v2.h5" - * - * These HDF5 files are created with non-zero status_flags in + * (3) "h5clear_sec2_v2.h5" + * + * These HDF5 files are created with non-zero status_flags in * the superblock via flushing and exiting without closing the * library. - * Due to file locking, status_flags in the superblock will be - * nonzero after H5Fcreate. The library will clear status_flags - * on file closing. + * Due to file locking, status_flags in the superblock will be + * nonzero after H5Fcreate. The library will clear status_flags + * on file closing. * This program, after "H5Fcreate" the files, exits without - * going through library closing. Thus, status_flags for these - * files are not cleared. - * The library will check consistency of status_flags when - * opening a file with superblock >= v3 and will return error + * going through library closing. Thus, status_flags for these + * files are not cleared. + * The library will check consistency of status_flags when + * opening a file with superblock >= v3 and will return error * accordingly. - * The library will not check status_flags when opening a file - * with < v3 superblock. - * These files are used by "h5clear" to see if the tool clears - * status_flags properly so users can open the files afterwards. - * + * The library will not check status_flags when opening a file + * with < v3 superblock. + * These files are used by "h5clear" to see if the tool clears + * status_flags properly so users can open the files afterwards. + * * (D) Generate the last two files in FILENAME_ENHANCE[] in main(): - * (6) "h5clear_status_noclose.h5", + * (6) "h5clear_status_noclose.h5", * (7) "h5clear_fsm_persist_noclose.h5" * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Vailin Choi; July 2013 + * Programmer: Vailin Choi; July 2013 * *------------------------------------------------------------------------- */ int main(void) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t fapl = -1, new_fapl = -1; /* File access property lists */ - char fname[512]; /* File name */ + hid_t fid = -1; /* File ID */ + hid_t fcpl = -1; /* File creation property list */ + hid_t fapl = -1, new_fapl = -1; /* File access property lists */ + char fname[512]; /* File name */ unsigned new_format; /* To use latest library format or not */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1; /* Dataset ID */ @@ -382,7 +382,7 @@ main(void) if(gen_enhance_files(TRUE) < 0) goto error; - /* + /* * Generate files in FILENAME[] */ /* Create a copy of the file access property list */ @@ -396,13 +396,13 @@ main(void) if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) goto error; - /* + /* * Files created within this for loop will have v3 superblock and nonzero status_flags * --FILENAME[0]: "h5clear_sec2_v3.h5", "latest_h5clear_sec2_v3.h5" * --FILENAME[1]: "h5clear_log_v3.h5", "latest_h5clear_log_v3.h5" */ for(new_format = FALSE; new_format <= TRUE; new_format++) { - hid_t fapl2, my_fapl; /* File access property lists */ + hid_t fapl2, my_fapl; /* File access property lists */ /* Set to use the appropriate file access property list */ if(new_format) @@ -415,14 +415,14 @@ main(void) if((my_fapl = H5Pcopy(fapl2)) < 0) goto error; /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]); + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - + /* Close the property list */ if(H5Pclose(my_fapl) < 0) goto error; @@ -439,8 +439,8 @@ main(void) goto error; /* Create the file */ - sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); - if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) + HDsprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]); + if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0) goto error; /* Flush the file */ @@ -453,11 +453,11 @@ main(void) } /* end for */ - /* + /* * Create a sec2 file with v0 superblock but nonzero status_flags: * FILENAME[2]: "h5clear_sec2_v0.h5" */ - if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; /* Flush the file */ @@ -465,9 +465,9 @@ main(void) goto error; - /* + /* * Create a sec2 file with v2 superblock but nonzero status_flags: - * FILENAME[3]: "h5clear_sec2_v2.h5" + * FILENAME[3]: "h5clear_sec2_v2.h5" */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) goto error; @@ -476,14 +476,14 @@ main(void) if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0) goto error; - if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) + if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0) goto error; /* Flush the file */ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) goto error; - + /* Close the property lists */ if(H5Pclose(fapl) < 0) goto error; @@ -492,10 +492,10 @@ main(void) if(H5Pclose(fcpl) < 0) goto error; - /* + /* * Create the last two files in FILENAME_ENHANCE[]: * --FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 - * --FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + * --FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 */ /* * FILENAME_ENHANCE[6]: h5clear_status_noclose.h5 @@ -503,7 +503,7 @@ main(void) * --version 3 superblock * --nonzero status_flags * --does not persist free-space - * --does not flush the file, just exit without closing file: + * --does not flush the file, just exit without closing file: * --this file is similar to the user-suppplied test file attached with HDFFV-10347 */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -542,8 +542,8 @@ main(void) /* Does not flush and does not close the file */ - /* - * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 + /* + * FILENAME_ENHANCE[7]: h5clear_fsm_persist_noclose.h5 * --stored EOA < actual EOF * --persisting free-space * --undefined fsinfo.eoa_pre_fsm_fsalloc diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 08ebfc7..7f1f038 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -51,14 +51,14 @@ int main(void) int result = 0; herr_t error = 1; - printf("%-70s", "Testing alignment in compound datatypes"); + HDprintf("%-70s", "Testing alignment in compound datatypes"); - strcpy(string5, "Hi!"); + HDstrcpy(string5, "Hi!"); HDunlink(fname); fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fil < 0) { - puts("*FAILED*"); + HDputs("*FAILED*"); return 1; } @@ -123,8 +123,8 @@ int main(void) data = (char *)HDmalloc(H5Tget_size(fix)); if(!data) { - perror("malloc() failed"); - abort(); + HDperror("malloc() failed"); + HDabort(); } set = H5Dopen2(fil, setname, H5P_DEFAULT); @@ -136,7 +136,7 @@ int main(void) out: if(error < 0) { result = 1; - puts("*FAILED - HDF5 library error*"); + HDputs("*FAILED - HDF5 library error*"); } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) @@ -145,7 +145,7 @@ out: result = 1; mname = H5Tget_member_name(fix, 0); - printf("%14s (%2d) %6s = %s\n", + HDprintf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,0), string5, (char *)(data + H5Tget_member_offset(fix, 0))); if(mname) @@ -153,7 +153,7 @@ out: fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); mname = H5Tget_member_name(fix, 1); - printf("Data comparison:\n" + HDprintf("Data comparison:\n" "%14s (%2d) %6f = %f\n" " %6f = %f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,1), @@ -164,7 +164,7 @@ out: fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2))); mname = H5Tget_member_name(fix, 2); - printf("%14s (%2d) %6f = %f\n" + HDprintf("%14s (%2d) %6f = %f\n" " %6f = %6f\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix,2), (double)fnok[0], (double)fptr[0], @@ -173,7 +173,7 @@ out: H5free_memory(mname); fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1))); - printf("\n" + HDprintf("\n" "Short circuit\n" " %6f = %f\n" " %6f = %f\n" @@ -183,9 +183,9 @@ out: (double)fok[1], (double)fptr[1], (double)fnok[0], (double)fptr[2], (double)fnok[1], (double)fptr[3]); - puts("*FAILED - compound type alignmnent problem*"); + HDputs("*FAILED - compound type alignmnent problem*"); } else { - puts(" PASSED"); + HDputs(" PASSED"); } if(data) @@ -200,7 +200,7 @@ out: H5Pclose(plist); H5Fclose(fil); HDunlink(fname); - fflush(stdout); + HDfflush(stdout); return result; } -- cgit v0.12 From 538f743c145fbbfa7b1119693efd2ff61b34efae Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Thu, 15 Aug 2019 17:51:15 -0500 Subject: Changes based on PR feedback. --- release_docs/RELEASE.txt | 4 ++-- src/H5Fint.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2cc880a..b940095 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -338,8 +338,8 @@ Bug Fixes since HDF5-1.10.3 release to unsigned later on, the decimal part is chopped off causing the test failure. - This was fixed by performing ((value of log10) + 1) first before casting - the result to unsigned. + This was fixed by obtaining the rounded integer value (HDceil) for the + log10 value of read attempts first before casting the result to unsigned. (VC - 2019/8/14, HDFFV-10813) diff --git a/src/H5Fint.c b/src/H5Fint.c index 6aec40c..29f017e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2992,8 +2992,10 @@ H5F_set_retries(H5F_t *f) /* Initialize the # of bins for retries */ f->shared->retries_nbins = 0; if(f->shared->read_attempts > 1) { - tmp = HDlog10((double)(f->shared->read_attempts - 1)); - f->shared->retries_nbins = (unsigned)(tmp + 1); + /* Use HDceil to ensure that the log10 value is rounded up to the + nearest integer before casting to unsigned */ + tmp = HDceil(HDlog10((double)f->shared->read_attempts)); + f->shared->retries_nbins = (unsigned)tmp; } FUNC_LEAVE_NOAPI(SUCCEED) -- cgit v0.12 From 96bf97f534b00232c0ec13282b5b1eac7dc99865 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 16 Aug 2019 13:23:29 -0500 Subject: Update HD prefix and reconcile hl/cpp test --- hl/c++/test/ptableTest.cpp | 24 +- hl/test/gen_test_ds.c | 10 +- hl/test/h5hltest.h | 4 +- hl/test/test_ds.c | 94 ++-- hl/test/test_dset_append.c | 104 ++-- hl/test/test_file_image.c | 84 +-- hl/test/test_h5do_compat.c | 50 +- hl/test/test_image.c | 28 +- hl/test/test_ld.c | 1134 ++++++++++++++++++++-------------------- hl/test/test_lite.c | 90 ++-- hl/test/test_packet.c | 30 +- hl/test/test_packet_vlen.c | 750 +++++++++++++------------- hl/test/test_table.c | 36 +- test/use_disable_mdc_flushes.c | 2 +- 14 files changed, 1224 insertions(+), 1216 deletions(-) diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index f41dbb3..d0b2c39 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -81,7 +81,8 @@ int BasicTest() hsize_t count; int error; - TESTING2("basic functionality") + printf("Testing %-62s", "basic functionality"); + HDfflush(stdout); FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) @@ -137,7 +138,8 @@ int TestCompoundDatatype() hsize_t count; int error; - TESTING2("compound datatypes") + printf("Testing %-62s", "compound datatypes"); + HDfflush(stdout); /* Create compound datatype */ typedef struct compoundType @@ -206,7 +208,8 @@ int TestGetNext() int records[2]; int i; - TESTING2("GetNextPacket") + printf("Testing %-62s", "GetNextPacket"); + HDfflush(stdout); /* Create a dataset */ FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); @@ -268,7 +271,8 @@ int TestCompress() unsigned int config = 0; size_t cd_nelemts = 0; - TESTING2("compression") + printf("Testing %-62s", "compression"); + HDfflush(stdout); #ifdef H5_HAVE_FILTER_DEFLATE try { /* Prepare property list to set compression, randomly use deflate */ @@ -315,7 +319,8 @@ int TestGetPacket() int record; int theRecs[3]; int i; - TESTING2("GetPacket") + printf("Testing %-62s", "GetPacket"); + HDfflush(stdout); /* Create a dataset. Does not need to specify property list because there is no compression. */ @@ -353,7 +358,8 @@ const char* PT_TESTERROR = "/TestErrors"; int TestErrors() { - TESTING2("error conditions") + printf("Testing %-62s", "error conditions"); + HDfflush(stdout); /* Create a dataset */ FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1); @@ -464,7 +470,8 @@ const char* PT_SYSTEMTST1 = "/SystemTest1"; const char* PT_SYSTEMTST2 = "/SystemTest2"; int SystemTest() { - TESTING2("multiple datatypes") + printf("Testing %-62s", "multiple datatypes"); + HDfflush(stdout); hid_t dtypeID1, dtypeID2; hsize_t count; @@ -602,7 +609,8 @@ int TestHDFFV_9758() s1[i].e = 100+i; } - TESTING2("data corruption in packed structs (HDFFV-9758)") + printf("Testing %-62s", "data corruption in packed structs (HDFFV-9758)"); + HDfflush(stdout); // Build a compound datatype compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index f8f1d39..273e393 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -281,7 +281,7 @@ static int test_long_attachscales(const char *filename) strcpy(dsname, DATASET_NAME); strcat(dsname, "al"); - TESTING2("test_long_attachscales"); + HL_TESTING2("test_long_attachscales"); if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; @@ -342,7 +342,7 @@ static int test_duplicatelong_attachscales(const char *filename) strcpy(dsname, DATASET_NAME); strcat(dsname, "al2"); - TESTING2("test_duplicatelong_attachscales"); + HL_TESTING2("test_duplicatelong_attachscales"); if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; @@ -406,7 +406,7 @@ static int test_long_scalenames(const char *filename) { if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) goto out; - TESTING2("set long scale/cmp scale name"); + HL_TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { strcpy(scalename, DS_1_NAME); strcat(scalename, "al"); @@ -483,7 +483,7 @@ static int test_samelong_scalenames(const char *filename) { if((fid = open_test_file(filename)) < 0) goto out; - TESTING2("set same long scale/cmp scale name"); + HL_TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { strcpy(scalename, DS_1_NAME); strcat(scalename, "al"); @@ -554,7 +554,7 @@ static int test_foreign_scaleattached(const char *filename) hid_t did = -1; hid_t dsid = -1; - TESTING2("test_foreign_scaleattached"); + HL_TESTING2("test_foreign_scaleattached"); if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto out; diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index 5dd3c20..85f47bd 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -28,8 +28,8 @@ #include "H5HLprivate2.h" /* Macros used in HL tests */ -#define HL_TESTING2(WHAT) {HDprintf("%-70s", "Testing " WHAT); HDfflush(stdout);} -#define HL_TESTING3(WHAT) {HDprintf("%-70s", "" WHAT); HDfflush(stdout);} +#define HL_TESTING2(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);} +#define HL_TESTING3(WHAT) {HDprintf("Testing %-62s", WHAT); HDfflush(stdout);} /* Implements verbose 'assert' with 'goto error' exit */ #define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0) diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 6c75423..9389a0d 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1146,7 +1146,7 @@ static int test_detachscales(void) and detach them to check that at the end there is no attributes REFERENCE_LIST on a dimension scale and DIMENSION_LIST on a dataset */ - TESTING2("test_detachscales"); + HL_TESTING2("test_detachscales"); if((fid = H5Fcreate("test_detach.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; @@ -1280,7 +1280,7 @@ static int test_char_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "ac"); - TESTING2("test_char_attachscales"); + HL_TESTING2("test_char_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1333,7 +1333,7 @@ static int test_short_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "as"); - TESTING2("test_short_attachscales"); + HL_TESTING2("test_short_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1410,7 +1410,7 @@ static int test_int_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a"); - TESTING2("test_int_attachscales"); + HL_TESTING2("test_int_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1471,7 +1471,7 @@ static int test_long_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al"); - TESTING2("test_long_attachscales"); + HL_TESTING2("test_long_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1528,7 +1528,7 @@ static int test_duplicatelong_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "al2"); - TESTING2("test_duplicatelong_attachscales"); + HL_TESTING2("test_duplicatelong_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1585,7 +1585,7 @@ static int test_float_attachscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "af"); - TESTING2("test_float_attachscales"); + HL_TESTING2("test_float_attachscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1647,7 +1647,7 @@ static int test_numberofscales(const char *fileext) HDsnprintf(dsname, sizeof(dsname), "%s%s", DATASET_NAME, "a"); - TESTING2("test_numberofscales"); + HL_TESTING2("test_numberofscales"); if((fid = open_test_file(fileext)) < 0) goto out; @@ -1729,7 +1729,7 @@ static int test_char_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set char scale/cmp scale name"); + HL_TESTING2("set char scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "ac"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "ac"); @@ -1789,7 +1789,7 @@ static int test_short_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set short scale/cmp scale name"); + HL_TESTING2("set short scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "as"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "as"); @@ -1897,7 +1897,7 @@ static int test_int_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set int scale/cmp scale name"); + HL_TESTING2("set int scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "a"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "a"); @@ -1973,7 +1973,7 @@ static int test_long_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set long scale/cmp scale name"); + HL_TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "al"); @@ -2041,7 +2041,7 @@ static int test_samelong_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set same long scale/cmp scale name"); + HL_TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "al"); HDsnprintf(name, sizeof(name), "%s%s", DS_1_NAME, "al"); @@ -2109,7 +2109,7 @@ static int test_float_scalenames(const char *fileext) { if((fid = open_test_file(fileext)) < 0) goto out; - TESTING2("set float scale/cmp scale name"); + HL_TESTING2("set float scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { HDsnprintf(scalename, sizeof(scalename), "%s%s", DS_1_NAME, "af"); HDsnprintf(name, sizeof(name), "%s%s", SCALE_1_NAME, "af"); @@ -2181,7 +2181,7 @@ static int test_foreign_scaleattached(const char *fileforeign) hid_t dsid = -1; const char *filename = H5_get_srcdir_filename(fileforeign); - TESTING2("test_foreign_scaleattached"); + HL_TESTING2("test_foreign_scaleattached"); if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) goto out; @@ -2426,7 +2426,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING2("detach scales "); + HL_TESTING2("detach scales "); /*------------------------------------------------------------------------- @@ -3013,7 +3013,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING2("set/get label"); + HL_TESTING2("set/get label"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -3103,7 +3103,7 @@ static int test_simple(void) */ - TESTING2("set scale/get scale name"); + HL_TESTING2("set scale/get scale name"); if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"Latitude set 0") < 0) @@ -3205,7 +3205,7 @@ static int test_simple(void) */ - TESTING2("iterate scales"); + HL_TESTING2("iterate scales"); /*------------------------------------------------------------------------- @@ -3771,7 +3771,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach a dataset to itself"); + HL_TESTING2("attach a dataset to itself"); if(H5DSattach_scale(did, did, 0) == SUCCEED) goto out; @@ -3782,7 +3782,7 @@ static int test_errors(void) * attempt to attach a group with a dataset, it should fail *------------------------------------------------------------------------- */ - TESTING2("attach a group with a dataset"); + HL_TESTING2("attach a group with a dataset"); if(H5DSattach_scale(gid,dsid,0)==SUCCEED) goto out; @@ -3793,7 +3793,7 @@ static int test_errors(void) * attempt to attach a dataset with a group, it should fail *------------------------------------------------------------------------- */ - TESTING2("attach a dataset with a group"); + HL_TESTING2("attach a dataset with a group"); if(H5DSattach_scale(did,gid,0)==SUCCEED) goto out; @@ -3804,7 +3804,7 @@ static int test_errors(void) * attempt to set scale for a group, it should fail *------------------------------------------------------------------------- */ - TESTING2("set scale for a group"); + HL_TESTING2("set scale for a group"); if(H5DSset_scale(gid,"scale 1")==SUCCEED) goto out; @@ -3834,7 +3834,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach a scale that has scales"); + HL_TESTING2("attach a scale that has scales"); /* create the data space for the scale */ if((sidds = H5Screate_simple(rankds, s1_dim, NULL)) < 0) @@ -3903,7 +3903,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach to a dataset that is a scale"); + HL_TESTING2("attach to a dataset that is a scale"); /* open the previous written "ds_b", that is a scale */ if((dsid = H5Dopen2(fid,"ds_b", H5P_DEFAULT)) < 0) @@ -3930,7 +3930,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("attach to a dataset that is a reserved class dataset"); + HL_TESTING2("attach to a dataset that is a reserved class dataset"); /* make an image */ if(H5IMmake_image_8bit(fid,"image",(hsize_t)100,(hsize_t)50,NULL) < 0) @@ -3965,7 +3965,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("is scale"); + HL_TESTING2("is scale"); /* open a non scale dataset */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -3999,7 +3999,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale from dataset it is not attached to"); + HL_TESTING2("detach scale from dataset it is not attached to"); /* open the previous written "ds_a" */ if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0) @@ -4027,7 +4027,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale from group"); + HL_TESTING2("detach scale from group"); /* open the previous written "ds_a" */ if((dsid = H5Dopen2(fid,"ds_a", H5P_DEFAULT)) < 0) @@ -4055,7 +4055,7 @@ static int test_errors(void) *------------------------------------------------------------------------- */ - TESTING2("detach scale when scale is group"); + HL_TESTING2("detach scale when scale is group"); /* open the previous written "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4147,7 +4147,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate when the dataset has no scales "); + HL_TESTING2("iterate when the dataset has no scales "); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4169,7 +4169,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate on dimension that is outside the rank "); + HL_TESTING2("iterate on dimension that is outside the rank "); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4190,7 +4190,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate for dimension with many scales "); + HL_TESTING2("iterate for dimension with many scales "); /* open the previously written "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4227,7 +4227,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate on group "); + HL_TESTING2("iterate on group "); /* open */ if((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) @@ -4249,7 +4249,7 @@ static int test_iterators(void) *------------------------------------------------------------------------- */ - TESTING2("iterate in deleted scales "); + HL_TESTING2("iterate in deleted scales "); if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0) goto out; @@ -4343,7 +4343,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach"); + HL_TESTING2("attach"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4371,7 +4371,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("detach"); + HL_TESTING2("detach"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4397,7 +4397,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach, set, get names, labels"); + HL_TESTING2("attach, set, get names, labels"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; @@ -4436,7 +4436,7 @@ static int test_rank(void) *------------------------------------------------------------------------- */ - TESTING2("attach a scalar scale"); + HL_TESTING2("attach a scalar scale"); /* create the data space for the dataset */ if((sid = H5Screate_simple(2, dimss, NULL)) < 0) @@ -4549,7 +4549,7 @@ static int test_types(void) *------------------------------------------------------------------------- */ - TESTING2("floating point and short scales"); + HL_TESTING2("floating point and short scales"); /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) @@ -4612,7 +4612,7 @@ static int test_types(void) *------------------------------------------------------------------------- */ - TESTING2("string scales"); + HL_TESTING2("string scales"); /* get the dataset id for "dset_b" */ if((did = H5Dopen2(fid,"dset_b", H5P_DEFAULT)) < 0) @@ -4709,7 +4709,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("generating scales"); + HL_TESTING2("generating scales"); /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 2 dimension scales @@ -4954,7 +4954,7 @@ static int test_errors2(void) goto out; - TESTING2("attach scales"); + HL_TESTING2("attach scales"); /*------------------------------------------------------------------------- @@ -4977,7 +4977,7 @@ static int test_errors2(void) PASSED(); - TESTING2("detach scales"); + HL_TESTING2("detach scales"); /*------------------------------------------------------------------------- * detach with invalid indices @@ -4998,7 +4998,7 @@ static int test_errors2(void) PASSED(); - TESTING2("set/get label"); + HL_TESTING2("set/get label"); /*------------------------------------------------------------------------- * set/get label invalid indices @@ -5023,7 +5023,7 @@ static int test_errors2(void) PASSED(); - TESTING2("iterate scales"); + HL_TESTING2("iterate scales"); /*------------------------------------------------------------------------- @@ -5122,7 +5122,7 @@ static int test_attach_detach(void) hid_t var1_id, var2_id, var3_id; /* DS component name */ hsize_t dims[RANK1] = {DIM1}; - TESTING2("permutations of attaching and detaching"); + HL_TESTING2("permutations of attaching and detaching"); if((fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; diff --git a/hl/test/test_dset_append.c b/hl/test/test_dset_append.c index 8bb4f84..1914a08 100644 --- a/hl/test/test_dset_append.c +++ b/hl/test/test_dset_append.c @@ -18,7 +18,7 @@ #include "h5hltest.h" #include "H5DOpublic.h" -#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) +#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER) # define H5_ZLIB_HEADER "zlib.h" #endif #if defined(H5_ZLIB_HEADER) @@ -64,22 +64,22 @@ test_dataset_append_notset(hid_t fid) int i, j; /* Local index variables */ h5_stat_t sb1, sb2; /* File info */ - TESTING("Append flush with H5DOappend()--append rows with default dapl"); + HL_TESTING2("Append flush with H5DOappend()--append rows with default dapl"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, DNAME_NOTSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR; /* Append 6 rows to the dataset */ @@ -104,7 +104,7 @@ test_dataset_append_notset(hid_t fid) TEST_ERROR; /* File size before flushing should be less */ - if(sb1.st_size > sb2.st_size) + if(sb1.st_size > sb2.st_size) TEST_ERROR; /* Closing */ @@ -183,28 +183,28 @@ test_dataset_append_rows_columns(hid_t fid) int i, j; /* Local index variables */ - TESTING("Append flush with H5DOappend()--append rows & columns"); + HL_TESTING2("Append flush with H5DOappend()--append rows & columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DNAME_UNLIM, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 6 rows to the dataset */ @@ -246,7 +246,7 @@ test_dataset_append_rows_columns(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 13; j++) @@ -336,28 +336,28 @@ test_dataset_append_rows(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append rows"); + HL_TESTING2("Append flush with H5DOappend()--append rows"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DNAME_ROW, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 6 rows to the dataset */ @@ -380,7 +380,7 @@ test_dataset_append_rows(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 10; j++) @@ -470,28 +470,28 @@ test_dataset_append_columns(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append columns"); + HL_TESTING2("Append flush with H5DOappend()--append columns"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 1 extendible dimension */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DNAME_COLUMN, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 3 columns to the dataset */ @@ -515,7 +515,7 @@ test_dataset_append_columns(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 3; j++) @@ -614,28 +614,28 @@ test_dataset_append_BUG1(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append rows & columns--BUG1"); - + HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG1"); + /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DBUGNAME1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 6 rows to the dataset */ @@ -677,7 +677,7 @@ test_dataset_append_BUG1(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 13; j++) @@ -775,28 +775,28 @@ test_dataset_append_BUG2(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append rows & columns--BUG2"); - + HL_TESTING2("Append flush with H5DOappend()--append rows & columns--BUG2"); + /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DBUGNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 6 rows to the dataset */ @@ -839,7 +839,7 @@ test_dataset_append_BUG2(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 13; j++) @@ -930,28 +930,28 @@ test_dataset_append_less(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append size < boundary size"); + HL_TESTING2("Append flush with H5DOappend()--append size < boundary size"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DNAME_LESS, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append to the dataset 2 rows at a time for 3 times */ @@ -996,7 +996,7 @@ test_dataset_append_less(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 13; j++) @@ -1057,7 +1057,7 @@ error: * * Purpose: Verify that the object flush property and the append flush property * are working properly when appending rows and columns to an - * extendible dataset where + * extendible dataset where * row: the append size is 3 times of the boundary size * the append callback/flush is performed on the 1st boundary hit * column: the boundary is greater than the append size @@ -1090,28 +1090,28 @@ test_dataset_append_vary(hid_t fid) unsigned append_ct = 0; /* The # of appends */ unsigned *flush_ptr; /* Points to the flush counter */ - TESTING("Append flush with H5DOappend()--append & boundary size vary"); + HL_TESTING2("Append flush with H5DOappend()--append & boundary size vary"); /* Get the file's file access property list */ if((ffapl = H5Fget_access_plist(fid)) < 0) FAIL_STACK_ERROR; /* Set to create a chunked dataset with 2 extendible dimensions */ - if((sid = H5Screate_simple(2, dims, maxdims)) < 0) + if((sid = H5Screate_simple(2, dims, maxdims)) < 0) FAIL_STACK_ERROR; - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR; if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) FAIL_STACK_ERROR; /* Set append flush property */ - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) FAIL_STACK_ERROR; if(H5Pset_append_flush(dapl, 2, boundary, append_func, &append_ct) < 0) FAIL_STACK_ERROR; /* Create the dataset */ - if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) + if((did = H5Dcreate2(fid, DNAME_VARY, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl)) < 0) TEST_ERROR; /* Append 6 rows to the dataset, once */ @@ -1151,7 +1151,7 @@ test_dataset_append_vary(hid_t fid) /* Read the dataset */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR; - + /* Verify the data */ for(i = 0; i < 6; i++) for(j = 0; j < 13; j++) @@ -1227,7 +1227,7 @@ int main(void) int nerrors = 0; /* The # of errors encountered */ /* Get a copy of file access property list */ - if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) FAIL_STACK_ERROR; /* Set to use the latest library format */ diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index a98642c..6cf39e8 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -44,10 +44,10 @@ extend the image, and then performs writes that extend the images. The fifth loop reads the extended images and verify that the content are correct. The sixth and final loop closes the file images and deallocates the image - buffers if appropriate. */ + buffers if appropriate. */ /*------------------------------------------------------------------------- -* test file image operations +* test file image operations *------------------------------------------------------------------------- */ static int @@ -67,11 +67,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) void **buf_ptr; /* pointer to array of pointers to image buffers */ char **filename; /* pointer to array of pointers to filenames */ unsigned *input_flags; /* pointer to array of flag combinations */ - size_t i, j, k, nrow, n_values; + size_t i, j, k, nrow, n_values; herr_t status1; void *handle_ptr = NULL; /* pointers to driver buffer */ - unsigned char **core_buf_ptr_ptr = NULL; - + unsigned char **core_buf_ptr_ptr = NULL; + VERIFY(open_images > 1 , "The number of open images must be greater than 1"); VERIFY(nflags > 0, "The number of flag combinations must be greater than 0"); @@ -100,7 +100,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (NULL == (dset_id = (hid_t *)HDmalloc(sizeof(hid_t) * open_images))) FAIL_PUTS_ERROR("malloc() failed"); - TESTING("get file images"); + HL_TESTING2("get file images"); /* create several file images */ for (i = 0; i < open_images; i++) { @@ -118,11 +118,11 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Fcreate() failed"); - /* define dataspace for the dataset */ - if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0) + /* define dataspace for the dataset */ + if ((file_space = H5Screate_simple(RANK, dims1, max_dims)) < 0) FAIL_PUTS_ERROR("H5Screate_simple() failed"); - /* create dataset property list */ + /* create dataset property list */ if ((plist = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_PUTS_ERROR("H5Pcreate() failed"); @@ -133,8 +133,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* create and write an integer type dataset named "dset" */ if ((dset_id[i] = H5Dcreate2(file_id[i], DSET_NAME, H5T_NATIVE_INT, file_space, H5P_DEFAULT, plist, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dcreate() failed"); - - /* dataset in open image 1 is written with "wrong" data */ + + /* dataset in open image 1 is written with "wrong" data */ if (i == 1) { if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data2) < 0) FAIL_PUTS_ERROR("H5Dwrite() failed"); @@ -144,7 +144,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (H5Dwrite(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data1) < 0) FAIL_PUTS_ERROR("H5Dwrite() failed"); } /* end else */ - + /* flush into the file */ if (H5Fflush(file_id[i], H5F_SCOPE_LOCAL) < 0) FAIL_PUTS_ERROR("H5Fflush() failed"); @@ -152,7 +152,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* close dataset property list */ if (H5Pclose(plist) < 0) FAIL_PUTS_ERROR("H5Pclose() failed"); - + /* close dataspace */ if (H5Sclose(file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); @@ -172,7 +172,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* buffer for file image 2 is filled with counter data (non-valid image) */ if (i == 2) { for (j = 0; j < (size_t)buf_size[i]; j++) - ((char*)(buf_ptr[i]))[j] = (char)j; + ((char*)(buf_ptr[i]))[j] = (char)j; } /* end if */ /* buffers for the rest of the file images are filled with data from the respective files */ else { @@ -187,14 +187,14 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("open file images and check image copies"); - - /* open the file images with the core driver for data access */ + HL_TESTING2("open file images and check image copies"); + + /* open the file images with the core driver for data access */ for (i = 0; i < open_images; i++) { /* open file image 2 filled with counter data (non-valid image) */ if (i == 2) { H5E_BEGIN_TRY { - /* attempt to set file image in the core driver */ + /* attempt to set file image in the core driver */ file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i]); } H5E_END_TRY @@ -202,7 +202,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) } /* end if */ /* open rest of valid file images */ else { - /* set file image in the core driver */ + /* set file image in the core driver */ if ((file_id[i] = H5LTopen_file_image(buf_ptr[i], (size_t)buf_size[i], input_flags[i])) < 0) FAIL_PUTS_ERROR("H5LTopen_file_image() failed"); @@ -218,7 +218,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) else VERIFY(*core_buf_ptr_ptr != buf_ptr[i], "vfd buffer and user buffer should be different"); - /* + /* * When the vfd and user buffers are different and H5LT_FILE_IMAGE_OPEN_RW is enabled, * status_flags in the superblock needs to be cleared in the vfd buffer for * the comparison to proceed as expected. The user buffer as returned from H5Fget_file_image() @@ -249,7 +249,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("read file images"); + HL_TESTING2("read file images"); /* read open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -259,7 +259,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) continue; } /* end if */ - /* open dataset in file image */ + /* open dataset in file image */ if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dopen() failed"); @@ -274,8 +274,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* read dataset */ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0) FAIL_PUTS_ERROR("H5Dread() failed"); - - /* compute number of elements in dataset */ + + /* compute number of elements in dataset */ n_values = (size_t)(dims3[0] * dims3[1]); /* determine the number of rows in dataset */ @@ -297,15 +297,15 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if (data3[j * nrow + k ] != data1[j * nrow + k ]) FAIL_PUTS_ERROR("comparison of image values with original data failed"); } /* end else */ - - /* close dataspace */ + + /* close dataspace */ if (H5Sclose (file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); } /* end for */ - PASSED(); + PASSED(); - TESTING("write and extend file images"); + HL_TESTING2("write and extend file images"); /* write open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -365,7 +365,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) hid_t attr_space_id = -1; hid_t attr_id = -1; herr_t status2; - size_t l; + size_t l; if ((attr_space_id = H5Screate_simple(attr_rank, attr_dims, attr_dims)) < 0) FAIL_PUTS_ERROR("attr_space H5Screate_simple() failed"); @@ -396,9 +396,9 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) H5Aclose(attr_id); } H5E_END_TRY; #endif - if (H5Dclose(dset_id[i]) < 0) - FAIL_PUTS_ERROR("H5Dclose() failed"); - dset_id[i] = -1; + if (H5Dclose(dset_id[i]) < 0) + FAIL_PUTS_ERROR("H5Dclose() failed"); + dset_id[i] = -1; } /* end if */ else { /* write dataset without extending it */ @@ -422,7 +422,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED(); - TESTING("read extended file images"); + HL_TESTING2("read extended file images"); /* read open file images and verify data */ for (i = 0; i < open_images; i++) { @@ -430,7 +430,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) if ((dset_id[i] < 0) || (file_id[i] < 0) || (!(input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW ))) continue; - /* open dataset in file image */ + /* open dataset in file image */ if ((dset_id[i] = H5Dopen2(file_id[i], DSET_NAME, H5P_DEFAULT)) < 0) FAIL_PUTS_ERROR("H5Dopen() failed"); @@ -445,8 +445,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) /* read dataset */ if (H5Dread(dset_id[i], H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data3) < 0) FAIL_PUTS_ERROR("H5Dread() failed"); - - /* compute number of elements in dataset */ + + /* compute number of elements in dataset */ n_values = (size_t)(dims3[0] * dims3[1]); /* determine the number of rows in dataset */ @@ -457,8 +457,8 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) for (k = 0; k < nrow; k++) if (data3[j * nrow + k ] != data4[j * nrow + k ]) FAIL_PUTS_ERROR("comparison of image values with original data failed"); - - /* close dataspace */ + + /* close dataspace */ if (H5Sclose (file_space) < 0) FAIL_PUTS_ERROR("H5Sclose() failed"); @@ -469,7 +469,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) PASSED() - TESTING("close file images"); + HL_TESTING2("close file images"); /* close file images and release buffer if appropriate */ for (i = 0; i < open_images; i++) { @@ -489,7 +489,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) VERIFY(buf_ptr[i] != NULL, "buffer pointer must be non NULL"); HDfree(buf_ptr[i]); } /* end if */ - + } /* end for */ /* release temporary working buffers */ @@ -521,8 +521,8 @@ int main( void ) size_t open_images = 10; /* number of open file images */ size_t nflags = 8; /* number of flag combinations */ unsigned flags[8]; /* array with flag combinations */ - - /* set flag combinations for testing */ + + /* set flag combinations for testing */ flags[0] = 0; flags[1] = H5LT_FILE_IMAGE_DONT_RELEASE; flags[2] = H5LT_FILE_IMAGE_DONT_COPY; diff --git a/hl/test/test_h5do_compat.c b/hl/test/test_h5do_compat.c index 4df5eef..75028fb 100644 --- a/hl/test/test_h5do_compat.c +++ b/hl/test/test_h5do_compat.c @@ -26,14 +26,14 @@ #define NX 8 #define CHUNK_NX 4 - + /*------------------------------------------------------------------------- - * Function: test_direct_chunk_write + * Function: test_direct_chunk_write * - * Purpose: Test the basic functionality of H5DOwrite_chunk + * Purpose: Test the basic functionality of H5DOwrite_chunk * - * Return: Success: An identifer for the dataset used in the tests - * Failure: H5I_INVALID_HID + * Return: Success: An identifer for the dataset used in the tests + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ create_dataset(hid_t fid) /* Initialize the data */ for (i = 0; i < NX; i++) - data[i] = i; + data[i] = i; /* Write the initialized data */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) @@ -91,14 +91,14 @@ create_dataset(hid_t fid) } /* end create_dataset() */ - + /*------------------------------------------------------------------------- - * Function: test_direct_chunk_write + * Function: test_direct_chunk_write * - * Purpose: Test the basic functionality of H5DOwrite_chunk + * Purpose: Test the basic functionality of H5DOwrite_chunk * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -111,7 +111,7 @@ test_direct_chunk_write(hid_t did) size_t data_size; int i; - TESTING("H5DOwrite_chunk wrapper"); + HL_TESTING2("H5DOwrite_chunk wrapper"); /* Set the size of the chunk data */ data_size = CHUNK_NX * sizeof(int); @@ -120,9 +120,9 @@ test_direct_chunk_write(hid_t did) for (i = 0; i < CHUNK_NX; i++) chunk_data[i] = (i * 10) + i; - /* Write the direct chunk data repeatedly to cover all the chunks in the + /* Write the direct chunk data repeatedly to cover all the chunks in the * dataset, using the direct writing function. - */ + */ offset[0] = 0; for (i = 0; i < NX/CHUNK_NX; i++) { if (H5DOwrite_chunk(did, H5P_DEFAULT, filter_mask, offset, data_size, chunk_data) < 0) @@ -138,14 +138,14 @@ error: return 1; } /* test_direct_chunk_write() */ - + /*------------------------------------------------------------------------- - * Function: test_direct_chunk_read + * Function: test_direct_chunk_read * - * Purpose: Test the basic functionality of H5DOread_chunk + * Purpose: Test the basic functionality of H5DOread_chunk * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ @@ -169,7 +169,7 @@ test_direct_chunk_read(hid_t did) int i,j; - TESTING("H5DOread_chunk wrapper"); + HL_TESTING2("H5DOread_chunk wrapper"); /* Create dataspaces for reading */ if ((mem_sid = H5Screate_simple(1, chunk_dims, NULL)) < 0) @@ -232,15 +232,15 @@ error: #endif /* H5_NO_DEPRECATED_SYMBOLS */ - + /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Test direct chunk write function H5DOwrite_chunk and + * Purpose: Test direct chunk write function H5DOwrite_chunk and * chunk direct read function H5DOread_chunk * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * *------------------------------------------------------------------------- */ diff --git a/hl/test/test_image.c b/hl/test/test_image.c index c30b572..e350533 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -169,7 +169,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("indexed image"); + HL_TESTING2("indexed image"); /* Write image */ if ( H5IMmake_image_8bit( fid, IMAGE1_NAME, width, height, buf1 ) < 0 ) @@ -205,7 +205,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("true color image"); + HL_TESTING2("true color image"); /* Write image */ if ( H5IMmake_image_24bit( fid, IMAGE2_NAME, width, height, "INTERLACE_PIXEL", buf2 ) ) @@ -232,7 +232,7 @@ static int test_simple(void) *------------------------------------------------------------------------- */ - TESTING("pallete functions"); + HL_TESTING2("pallete functions"); if ( H5IMget_npalettes( fid, IMAGE1_NAME, &npals ) < 0 ) goto out; @@ -351,7 +351,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image"); + HL_TESTING2("make indexed image"); /* read first data file */ if (read_data(DATA_FILE1,&width,&height)<0) @@ -364,7 +364,7 @@ static int test_data(void) PASSED(); - TESTING2("attaching palettes"); + HL_TESTING2("attaching palettes"); /*------------------------------------------------------------------------- * palette #1. rainbow palette. data is contained in "pal_rgb.h" @@ -464,7 +464,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make true color image with pixel interlace"); + HL_TESTING2("make true color image with pixel interlace"); /* read second data file */ if ((read_data(DATA_FILE2,&width,&height))<0) @@ -481,7 +481,7 @@ static int test_data(void) *------------------------------------------------------------------------- */ - TESTING2("make true color image with plane interlace"); + HL_TESTING2("make true color image with plane interlace"); /* read third data file */ if ((read_data(DATA_FILE3,&width,&height))<0) @@ -627,7 +627,7 @@ static int test_generate(void) goto out; if(n_elements > INT_MAX / (int)sizeof(float)) goto out; - + data = (float *)HDmalloc((size_t)n_elements * sizeof(float)); if(NULL == data) goto out; @@ -652,7 +652,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from all the data"); + HL_TESTING2("make indexed image from all the data"); for ( i = 0; i < n_elements; i++ ) image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin )); @@ -669,7 +669,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from land data"); + HL_TESTING2("make indexed image from land data"); for ( i = 0; i < n_elements; i++ ) { @@ -691,7 +691,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("make indexed image from sea data"); + HL_TESTING2("make indexed image from sea data"); for ( i = 0; i < n_elements; i++ ) { @@ -712,7 +712,7 @@ static int test_generate(void) *------------------------------------------------------------------------- */ - TESTING2("attaching palettes"); + HL_TESTING2("attaching palettes"); /* make a palette */ if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0) @@ -815,7 +815,7 @@ static int read_data(const char* fname, /*IN*/ printf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ - + if(fscanf(f, "%d", &h) < 0 && HDferror(f)) { printf( "fscanf error in file %s.\n", data_file ); goto out; @@ -870,7 +870,7 @@ static int read_data(const char* fname, /*IN*/ /* Indicate success */ ret_val = 1; -out: +out: if(f) HDfclose(f); diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index 12a226a..e3cde5d 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -29,12 +29,12 @@ #define DSET_ONE "DSET_ONE" #define DSET_ALLOC_LATE "DSET_ALLOC_LATE" #define DSET_ALLOC_EARLY "DSET_ALLOC_EARLY" -#define DSET_TWO "DSET_TWO" -#define TWO_DIM_1 4 -#define TWO_DIM_2 10 -#define DSET_CMPD "DSET_CMPD" -#define DSET_CMPD_ESC "DSET_CMPD_ESC" -#define DSET_CMPD_TWO "DSET_CMPD_TWO" +#define DSET_TWO "DSET_TWO" +#define TWO_DIM_1 4 +#define TWO_DIM_2 10 +#define DSET_CMPD "DSET_CMPD" +#define DSET_CMPD_ESC "DSET_CMPD_ESC" +#define DSET_CMPD_TWO "DSET_CMPD_TWO" #define DSET_NULL "DSET_NULL" #define DSET_SCALAR "DSET_SCALAR" @@ -53,63 +53,63 @@ #define INVALID_ESC_FIELDS2 "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,." #define INVALID_ESC_FIELDS3 "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\," -/* +/* * Test variations (retained original) for one-dimensional dataset: - * Varies from 10->13; 10->9, 10->10, 10->1, 10->11 + * Varies from 10->13; 10->9, 10->10, 10->1, 10->11 */ #define ONE_NTESTS 5 int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}; -/* +/* * Test variations (retained original) for two-dimensional dataset: - * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10}; - * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10}; - * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10} + * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10}; + * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10}; + * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10} */ -#define TWO_NTESTS 9 +#define TWO_NTESTS 9 int two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0}, - {-1,2}, {-1,-1}, {-1,0}, - {0,2}, {0,-1}, {0,0} }; + {-1,2}, {-1,-1}, {-1,0}, + {0,2}, {0,-1}, {0,0} }; /* Verify that the two input values are the same */ -#define VERIFY_EQUAL(_x, _y) \ -{ \ - long __x = (long)_x, __y = (long)_y; \ - if(__x != __y) TEST_ERROR \ +#define VERIFY_EQUAL(_x, _y) \ +{ \ + long __x = (long)_x, __y = (long)_y; \ + if(__x != __y) TEST_ERROR \ } /* Temporary buffer for reading in the test file */ -#define TMP_BUF_SIZE 2048 +#define TMP_BUF_SIZE 2048 char g_tmp_buf[TMP_BUF_SIZE]; /* Macros for verifying compound fields */ /* Verify all fields */ -#define VERIFY_ELMTS_ALL(ent1, ent2) { \ - VERIFY_EQUAL(ent1.field1, ent2.field1); \ - VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \ - VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \ - VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \ - VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \ - VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \ - VERIFY_EQUAL(ent1.field3, ent2.field3); \ - VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \ +#define VERIFY_ELMTS_ALL(ent1, ent2) { \ + VERIFY_EQUAL(ent1.field1, ent2.field1); \ + VERIFY_EQUAL(ent1.field2.a, ent2.field2.a); \ + VERIFY_EQUAL(ent1.field2.b.a, ent2.field2.b.a); \ + VERIFY_EQUAL(ent1.field2.b.b, ent2.field2.b.b); \ + VERIFY_EQUAL(ent1.field2.b.c, ent2.field2.b.c); \ + VERIFY_EQUAL(ent1.field2.c, ent2.field2.c); \ + VERIFY_EQUAL(ent1.field3, ent2.field3); \ + VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \ } /* Verify fields selected in VALID_FIELDS1 */ -#define VERIFY_ELMTS_VALID1(ent1, ent2) { \ - VERIFY_EQUAL(ent1.field1, ent2.field1); \ - VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \ - VERIFY_EQUAL(ent1.field3, ent2.field3); \ - VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \ - VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \ +#define VERIFY_ELMTS_VALID1(ent1, ent2) { \ + VERIFY_EQUAL(ent1.field1, ent2.field1); \ + VERIFY_EQUAL(ent1.field2_a, ent2.field2.a); \ + VERIFY_EQUAL(ent1.field3, ent2.field3); \ + VERIFY_EQUAL(ent1.field4.a, ent2.field4.a); \ + VERIFY_EQUAL(ent1.field4.b, ent2.field4.b); \ } /* Verify fields selected in VALID_FIELDS2 */ -#define VERIFY_ELMTS_VALID2(ent1, ent2) { \ - VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \ - VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \ - VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \ +#define VERIFY_ELMTS_VALID2(ent1, ent2) { \ + VERIFY_EQUAL(ent1.field2_b_a, ent2.field2.b.a); \ + VERIFY_EQUAL(ent1.field2_c, ent2.field2.c); \ + VERIFY_EQUAL(ent1.field4_b, ent2.field4.b); \ } /* The types of 2-dimensional dataset: DSET_TWO or DSET_CMPD_TWO */ @@ -118,34 +118,34 @@ char g_tmp_buf[TMP_BUF_SIZE]; #define TWO_CMPD_VALID1 2 /* DSET_CMPD_TWO with VALID_FIELDS1 or VALID_ESC_FIELDS1 */ #define TWO_CMPD_VALID2 3 /* DSET_CMPD_TWO with VALID_FIELDS2 or VALID_ESC_FIELDS2 */ -#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) { \ - if(type == TWO_NONE) { \ - int *iib = (int *)_ldbuf; \ - int *ib = (int *)_buf; \ - \ - VERIFY_EQUAL(iib[k], ib[ind + n]) \ - } else if(type == TWO_CMPD_NULL) { \ - set_t *ccb = (set_t *)_ldbuf; \ - set_t *cb = (set_t *)_buf; \ - \ - VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \ - } else if(type == TWO_CMPD_VALID1) { \ - test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \ - set_t *cb = (set_t *)_buf; \ - \ - VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \ - } else if(type == TWO_CMPD_VALID2) { \ - test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \ - set_t *cb = (set_t *)_buf; \ - \ - VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \ - } \ +#define VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) { \ + if(type == TWO_NONE) { \ + int *iib = (int *)_ldbuf; \ + int *ib = (int *)_buf; \ + \ + VERIFY_EQUAL(iib[k], ib[ind + n]) \ + } else if(type == TWO_CMPD_NULL) { \ + set_t *ccb = (set_t *)_ldbuf; \ + set_t *cb = (set_t *)_buf; \ + \ + VERIFY_ELMTS_ALL(ccb[k], cb[ind + n]) \ + } else if(type == TWO_CMPD_VALID1) { \ + test_valid_fields1 *vb1 = (test_valid_fields1 *)_ldbuf; \ + set_t *cb = (set_t *)_buf; \ + \ + VERIFY_ELMTS_VALID1(vb1[k], cb[ind + n]) \ + } else if(type == TWO_CMPD_VALID2) { \ + test_valid_fields2 *vb2 = (test_valid_fields2 *)_ldbuf; \ + set_t *cb = (set_t *)_buf; \ + \ + VERIFY_ELMTS_VALID2(vb2[k], cb[ind + n]) \ + } \ } /* Tests for test_LD_elmts_pipe() */ -#define ONE_TESTS 3 +#define ONE_TESTS 3 int onetests[ONE_TESTS] = {3, 9, 1}; -#define TWO_TESTS 5 +#define TWO_TESTS 5 int twotests[TWO_TESTS][2] = { {2,2}, {2,-1}, {2,0}, {-1,2}, {0,2} }; @@ -185,9 +185,9 @@ typedef struct set_t { sub4_t field4; } set_t; -/* NOTE: - * This will fail on heiwa and amani when VALID_FIELDS1 is "field1,field3,field4" - * because of alignment problems: +/* NOTE: + * This will fail on heiwa and amani when VALID_FIELDS1 is "field1,field3,field4" + * because of alignment problems: * amani and heiwa - 8 byte alignment * jam - 4 byte alignemnt * This will need to be fixed in the library for H5Tget_native_type(). @@ -211,185 +211,185 @@ typedef struct test_valid_fields2 { /* Temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */ -#define TEST_BUF_SIZE 100 -int *iibuf; /* buffer for storing retrieved elements */ -int *ibuf; /* buffer for storing retrieved elements (integer) */ -set_t *cbuf; /* buffer for storing retrieved elemnets (compound) */ -set_t *ccbuf; /* buffer for storing retrieved elemnets (compound) */ -test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */ -test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */ - - -/* +#define TEST_BUF_SIZE 100 +int *iibuf; /* buffer for storing retrieved elements */ +int *ibuf; /* buffer for storing retrieved elements (integer) */ +set_t *cbuf; /* buffer for storing retrieved elemnets (compound) */ +set_t *ccbuf; /* buffer for storing retrieved elemnets (compound) */ +test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */ +test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */ + + +/* ********************************************************************************* * * Testing for the High Level public routine: H5LDget_dset_dims() - * 1) An invalid dataset id - * 2) "DSET_ALLOC_EARLY": NULL cur_dims - * 3) "DSET_ALLOC_LATE": nonNULL cur_dims - * 4) "DSET_CMPD_TWO": nonNULL cur_dims - * 5) "DSET_NULL": nonNULL cur_dims - * 6) "DSET_SCALAR": nonNULL cur_dims + * 1) An invalid dataset id + * 2) "DSET_ALLOC_EARLY": NULL cur_dims + * 3) "DSET_ALLOC_LATE": nonNULL cur_dims + * 4) "DSET_CMPD_TWO": nonNULL cur_dims + * 5) "DSET_NULL": nonNULL cur_dims + * 6) "DSET_SCALAR": nonNULL cur_dims * ********************************************************************************* */ static herr_t test_LD_dims_params(const char *file) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */ - hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */ + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */ + hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */ hid_t invalid_id = -1; - herr_t ret; /* return value */ + herr_t ret; /* return value */ const char *filename = H5_get_srcdir_filename(file); - TESTING("H5LDget_dset_dims"); + HL_TESTING2("H5LDget_dset_dims"); /* Open the copied file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * 1. Verify failure with negative dataset id */ H5E_BEGIN_TRY { - ret = H5LDget_dset_dims(invalid_id, one_cur_dims); + ret = H5LDget_dset_dims(invalid_id, one_cur_dims); } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) - /* + /* * 2. Verify failure for NULL cur_dims */ if((did = H5Dopen2(fid, DSET_ALLOC_EARLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR H5E_BEGIN_TRY { - ret = H5LDget_dset_dims(did, NULL); + ret = H5LDget_dset_dims(did, NULL); } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * 3. Verify for nonNULL cur_dims */ if((did = H5Dopen2(fid, DSET_ALLOC_LATE, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5LDget_dset_dims(did, one_cur_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR VERIFY_EQUAL(one_cur_dims[0], 10) if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * 4. Verify nonNULL cur_dims for a 2-dimensional dataset */ if((did = H5Dopen2(fid, DSET_CMPD_TWO, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5LDget_dset_dims(did, two_cur_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR VERIFY_EQUAL(two_cur_dims[0], TWO_DIM_1) VERIFY_EQUAL(two_cur_dims[1], TWO_DIM_2) if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * 5. Verify nonNULL cur_dims for dataset with H5S_NULL dataspace */ one_cur_dims[0] = 0; if((did = H5Dopen2(fid, DSET_NULL, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5LDget_dset_dims(did, one_cur_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR VERIFY_EQUAL(one_cur_dims[0], 0) if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * 6. Verify nonNULL cur_dims for dataset with H5S_SCALAR dataspace */ one_cur_dims[0] = 0; if((did = H5Dopen2(fid, DSET_SCALAR, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5LDget_dset_dims(did, one_cur_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR VERIFY_EQUAL(one_cur_dims[0], 0) if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(did); - H5Fclose(fid); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_dims_params() */ - -/* + +/* ********************************************************************************* * * Testing for the High Level public routine: H5LDget_dset_dims() * Verify that the dimension sizes retrieved via H5LDget_dset_dims() are correct * for the following cases: * - * DSET_ONE: one-dimensional dataset - * 1. Increase dims[0] - * 2. Decrease dims[0] - * 3. same dims[0] - * 4. Decrease dims[0] - * 5. Increase dims[0] + * DSET_ONE: one-dimensional dataset + * 1. Increase dims[0] + * 2. Decrease dims[0] + * 3. same dims[0] + * 4. Decrease dims[0] + * 5. Increase dims[0] * - * one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1} - * Varies from 10->3; 10->9, 10->10, 10->1, 10->11 + * one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1} + * Varies from 10->3; 10->9, 10->10, 10->1, 10->11 * - * DSET_TWO: two-dimensional dataset - * 1. Increase dims[0], increase dims[1] - * 2. Increase dims[0], decrease dims[1] - * 3. Increase dims[0], same dims[1] - * 4. Decrease dims[0], increase dims[1] - * 5. Decrease dims[0], decrease dims[1] - * 6. Decrease dims[0], same dims[1] - * 7. same dims[0], increase dims[1] - * 8. same dims[0], decrease dims[1] - * 9. same dims[0], same dims[1] + * DSET_TWO: two-dimensional dataset + * 1. Increase dims[0], increase dims[1] + * 2. Increase dims[0], decrease dims[1] + * 3. Increase dims[0], same dims[1] + * 4. Decrease dims[0], increase dims[1] + * 5. Decrease dims[0], decrease dims[1] + * 6. Decrease dims[0], same dims[1] + * 7. same dims[0], increase dims[1] + * 8. same dims[0], decrease dims[1] + * 9. same dims[0], same dims[1] * - * two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0}, - * {-1,2}, {-1,-1}, {-1,0}, - * {0,2}, {0,-1}, {0,0} } - * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10}; - * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10}; - * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10} + * two_tests[TWO_NTESTS][2] = { {2,2}, {2,-1}, {2,0}, + * {-1,2}, {-1,-1}, {-1,0}, + * {0,2}, {0,-1}, {0,0} } + * Varies from {4,10}->{6,12}; {4,10}->{6,9}; {4,10}->{6,10}; + * {4,10}->{3,12}; {4,10}->{3,9}; {4,10}->{3,10}; + * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10} * ********************************************************************************* */ static herr_t test_LD_dims(const char *file) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */ - hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */ - hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */ - hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */ - hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */ - hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/ - int i; /* local index variable */ - - TESTING("H5LDget_dset_dims with H5Dset_extent"); + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hsize_t one_prev_dims[1]; /* original dimension sizes for 1-dimensonal dataset */ + hsize_t one_cur_dims[1]; /* current dimension sizes for 1-dimensonal dataset */ + hsize_t one_ext_dims[1]; /* extended dimension sizes for 1-dimensonal dataset */ + hsize_t two_prev_dims[2]; /* original dimension sizes for 2-dimensional dataset */ + hsize_t two_cur_dims[2]; /* current dimension sizes for 2-dimensional dataset */ + hsize_t two_ext_dims[2]; /* extended dimension sizes for 2-dimensional dataset*/ + int i; /* local index variable */ + + HL_TESTING2("H5LDget_dset_dims with H5Dset_extent"); /* Make a copy of the test file */ if(h5_make_local_copy(file, COPY_FILENAME) < 0) @@ -397,75 +397,75 @@ test_LD_dims(const char *file) /* Open the copied file */ if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Testing with one-dimensional dataset: DSET_ONE */ if((did = H5Dopen2(fid, DSET_ONE, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Retrieve dimension sizes */ if(H5LDget_dset_dims(did, one_prev_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR for(i = 0; i < ONE_NTESTS; i++) { - /* Set up the extended dimension sizes */ - one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]); + /* Set up the extended dimension sizes */ + one_ext_dims[0] = (hsize_t)((int)one_prev_dims[0] + one_tests[i]); - /* Change the dimension size */ - if(H5Dset_extent(did, one_ext_dims) < 0) - FAIL_STACK_ERROR + /* Change the dimension size */ + if(H5Dset_extent(did, one_ext_dims) < 0) + FAIL_STACK_ERROR - /* Retrieve the dimension size */ - if(H5LDget_dset_dims(did, one_cur_dims) < 0) - FAIL_STACK_ERROR + /* Retrieve the dimension size */ + if(H5LDget_dset_dims(did, one_cur_dims) < 0) + FAIL_STACK_ERROR - /* Verify that the retrieved dimension size is correct as expected */ - VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0]) + /* Verify that the retrieved dimension size is correct as expected */ + VERIFY_EQUAL(one_cur_dims[0], one_ext_dims[0]) } /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Testing with two-dimensional dataset: DSET_TWO */ if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Retrieve the dimension sizes */ if(H5LDget_dset_dims(did, two_prev_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR for(i = 0; i < TWO_NTESTS; i++) { - /* Set up the extended dimension sizes */ - two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]); - two_ext_dims[1] = (hsize_t) ((int)two_prev_dims[1] + two_tests[i][1]); + /* Set up the extended dimension sizes */ + two_ext_dims[0] = (hsize_t)((int)two_prev_dims[0] + two_tests[i][0]); + two_ext_dims[1] = (hsize_t) ((int)two_prev_dims[1] + two_tests[i][1]); - /* Change the dimension sizes */ - if(H5Dset_extent(did, two_ext_dims) < 0) - FAIL_STACK_ERROR + /* Change the dimension sizes */ + if(H5Dset_extent(did, two_ext_dims) < 0) + FAIL_STACK_ERROR - /* Retrieve the dimension sizes */ - if(H5LDget_dset_dims(did, two_cur_dims) < 0) - FAIL_STACK_ERROR + /* Retrieve the dimension sizes */ + if(H5LDget_dset_dims(did, two_cur_dims) < 0) + FAIL_STACK_ERROR - /* Verify that the retrieved dimension sizes are correct as expected */ - VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0]) - VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1]) + /* Verify that the retrieved dimension sizes are correct as expected */ + VERIFY_EQUAL(two_cur_dims[0], two_ext_dims[0]) + VERIFY_EQUAL(two_cur_dims[1], two_ext_dims[1]) } /* end TWO_NTESTS */ /* Close the dataset */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Remove the copied file */ HDremove(COPY_FILENAME); @@ -475,172 +475,172 @@ test_LD_dims(const char *file) error: H5E_BEGIN_TRY { - H5Dclose(did); - H5Fclose(fid); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_dims() */ - -/* + +/* ********************************************************************************** * * Testing for the High Level public routine: H5LDget_dset_type_size() * Verify that the data type size returned via H5LDget_dset_type_size() * are correct for the following cases: * - * Verify failure for an invalid dataset id + * Verify failure for an invalid dataset id * - * DSET_CMPD: one-dimensional dataset with compound type - * 1. The whole element - * 2. VALID_FIELDS1: "field1,field2.a,field3,field4" - * 3. VALID_FIELDS2: "field2.b.a,field2.c,field4.b" - * 4. INVALID_FIELDS1: "field2.k.a,field2.c,field4.k" - * 5. INVALID_FIELDS2: "field2.b.a,field2.c,field4.b." - * 6. INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b" + * DSET_CMPD: one-dimensional dataset with compound type + * 1. The whole element + * 2. VALID_FIELDS1: "field1,field2.a,field3,field4" + * 3. VALID_FIELDS2: "field2.b.a,field2.c,field4.b" + * 4. INVALID_FIELDS1: "field2.k.a,field2.c,field4.k" + * 5. INVALID_FIELDS2: "field2.b.a,field2.c,field4.b." + * 6. INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b" * - * DSET_CMPD_ESC: one-dimensional dataset with compound type and - * member names with escape/separator characters - * 1. The whole element - * 2. VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\," - * 3. VALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," - * 4. INVALID_ESC_FIELDS1: "field2\\..\\,k.a,field2\\..\\\\c,field4\\,.k\\," - * 5. INVALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,." - * 6. INVALID_ESC_FIELDS3: "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\," + * DSET_CMPD_ESC: one-dimensional dataset with compound type and + * member names with escape/separator characters + * 1. The whole element + * 2. VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\," + * 3. VALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," + * 4. INVALID_ESC_FIELDS1: "field2\\..\\,k.a,field2\\..\\\\c,field4\\,.k\\," + * 5. INVALID_ESC_FIELDS2: "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\,." + * 6. INVALID_ESC_FIELDS3: "field2\\..\\,,b.a,field2\\..\\\\c,field4\\,.b\\," * ********************************************************************************** */ static int test_LD_size(const char *file) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hid_t dtid=-1; /* dataset's datatype identifier */ + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hid_t dtid=-1; /* dataset's datatype identifier */ hid_t invalid_id=-1; - hid_t memb0_tid=-1; /* type identifier for a member in the compound type */ - hid_t memb1_tid=-1; /* type identifier for a member in the compound type */ - hid_t memb2_tid=-1; /* type identifier for a member in the compound type */ - hid_t memb3_tid=-1; /* type identifier for a member in the compound type */ - hid_t memb_tid=-1; /* type identifier for a member in the compound type */ - hid_t memb_tid2=-1; /* type identifier for a member in the compound type */ - size_t dsize; /* size of the dataset's datatype */ - size_t ck_dsize; /* size of the dataset's datatype to be checked against */ + hid_t memb0_tid=-1; /* type identifier for a member in the compound type */ + hid_t memb1_tid=-1; /* type identifier for a member in the compound type */ + hid_t memb2_tid=-1; /* type identifier for a member in the compound type */ + hid_t memb3_tid=-1; /* type identifier for a member in the compound type */ + hid_t memb_tid=-1; /* type identifier for a member in the compound type */ + hid_t memb_tid2=-1; /* type identifier for a member in the compound type */ + size_t dsize; /* size of the dataset's datatype */ + size_t ck_dsize; /* size of the dataset's datatype to be checked against */ const char *filename = H5_get_srcdir_filename(file); - TESTING("H5LDget_dset_type_size"); + HL_TESTING2("H5LDget_dset_type_size"); /* Open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Verify failure with an invalid dataset id */ H5E_BEGIN_TRY { - dsize = H5LDget_dset_type_size(invalid_id, NULL); + dsize = H5LDget_dset_type_size(invalid_id, NULL); } H5E_END_TRY; VERIFY_EQUAL(dsize, 0) - /* + /* * Testing one-dimensional dataset with compound datatype: - * DSET_CMPD + * DSET_CMPD */ /* Open dataset DSET_CMPD */ if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Return size of the whole element */ if((dsize = H5LDget_dset_type_size(did, NULL)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the dataset's datatype and then its datatype size */ if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0) FAIL_STACK_ERROR if((ck_dsize = H5Tget_size(dtid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #1 */ VERIFY_EQUAL(dsize, ck_dsize) /* Get datatype id for each member */ if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field1" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field3" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Obtain size for VALID_FIELDS1: "field1,field2.a,field3,field4" */ if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS1)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the datatype size for "field1" */ if((ck_dsize = H5Tget_size(memb0_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field2.a" */ if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field3" */ if((ck_dsize += H5Tget_size(memb2_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field4" */ if((ck_dsize += H5Tget_size(memb3_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #2 */ VERIFY_EQUAL(dsize, ck_dsize) /* Obtain datatype size for VALID_FIELDS2: "field2.b.a,field2.c,field4.b" */ if((dsize = H5LDget_dset_type_size(did, VALID_FIELDS2)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the datatype size for "field2.b.a" */ if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize = H5Tget_size(memb_tid2)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field2.c" */ if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field4.b" */ if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #3 */ VERIFY_EQUAL(dsize, ck_dsize) /* - * Verify failure for the following invalid nested fields: - * INVALID_FIELDS1: "field2.k.a,field2.c,field4.k" + * Verify failure for the following invalid nested fields: + * INVALID_FIELDS1: "field2.k.a,field2.c,field4.k" * INVALID_FIELDS2: "field2.b.a,field2.c,field4.b." * INVALID_FIELDS3: "field2.b.a,,field2.c,field4.b" */ @@ -655,119 +655,119 @@ test_LD_size(const char *file) /* Verify failure for case #6 */ dsize = H5LDget_dset_type_size(did, INVALID_FIELDS3); VERIFY_EQUAL(dsize, 0) - + /* Closing */ if(H5Tclose(memb0_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb1_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb2_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb3_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Testing one-dimensional dataset with compound datatype and - * member names consisting of escape/separator characters: - * DSET_CMPD_ESC + * member names consisting of escape/separator characters: + * DSET_CMPD_ESC */ /* Open dataset DSET_CMPD_ESC */ if((did = H5Dopen2(fid, DSET_CMPD_ESC, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Return size of the whole element */ if((dsize = H5LDget_dset_type_size(did, NULL)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the dataset's datatype and then its datatype size */ if((dtid = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0) FAIL_STACK_ERROR if((ck_dsize = H5Tget_size(dtid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #1 */ VERIFY_EQUAL(dsize, ck_dsize) /* Get datatype id for each member */ if((memb0_tid = H5Tget_member_type(dtid, 0)) < 0) /* "field,1" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb1_tid = H5Tget_member_type(dtid, 1)) < 0) /* "field2." */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb2_tid = H5Tget_member_type(dtid, 2)) < 0) /* "field\3" */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb3_tid = H5Tget_member_type(dtid, 3)) < 0) /* "field4," */ - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Obtain size for VALID_ESC_FIELDS1: "field\\,1,field2\\..\\.a,field\\\\3,field4\\," */ if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS1)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the datatype size for "field\\,1" */ if((ck_dsize = H5Tget_size(memb0_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field2\\..\\.a" */ if((memb_tid = H5Tget_member_type(memb1_tid, 0)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field\\\\3" */ if((ck_dsize += H5Tget_size(memb2_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field4\\," */ if((ck_dsize += H5Tget_size(memb3_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #2 */ VERIFY_EQUAL(dsize, ck_dsize) - /* Obtain datatype size for VALID_ESC_FIELDS2: - "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," */ + /* Obtain datatype size for VALID_ESC_FIELDS2: + "field2\\..\\,b.a,field2\\..\\\\c,field4\\,.b\\," */ if((dsize = H5LDget_dset_type_size(did, VALID_ESC_FIELDS2)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the datatype size for "field2\..,b.a" */ if((memb_tid = H5Tget_member_type(memb1_tid, 1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((memb_tid2 = H5Tget_member_type(memb_tid, 0)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize = H5Tget_size(memb_tid2)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid2) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field2\..\\c" */ if((memb_tid = H5Tget_member_type(memb1_tid, 2)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Add the datatype size for "field4\,.b\," */ if((memb_tid = H5Tget_member_type(memb3_tid, 1)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if((ck_dsize += H5Tget_size(memb_tid)) == 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify case #3 */ VERIFY_EQUAL(dsize, ck_dsize) /* - * Verify failure for the following invalid nested fields: + * Verify failure for the following invalid nested fields: * INVALID_ESC_FIELDS1: "field2\..\,k.a,field2\..\\c,field4\,.k\," * INVALID_ESC_FIELDS2: "field2\..\,b.a,field2\..\\c,field4\,.b\,." * INVALID_ESC_FIELDS3: "field2\..\,,b.a,field2\..\\c,field4\,.b\," @@ -786,90 +786,90 @@ test_LD_size(const char *file) /* Closing */ if(H5Tclose(memb0_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb1_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb2_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(memb3_tid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Tclose(memb0_tid); - H5Tclose(memb1_tid); - H5Tclose(memb2_tid); - H5Tclose(memb3_tid); - H5Tclose(memb_tid); - H5Tclose(memb_tid2); - H5Tclose(dtid); - H5Dclose(did); - H5Fclose(fid); + H5Tclose(memb0_tid); + H5Tclose(memb1_tid); + H5Tclose(memb2_tid); + H5Tclose(memb3_tid); + H5Tclose(memb_tid); + H5Tclose(memb_tid2); + H5Tclose(dtid); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_size() */ - -/* + +/* ************************************************************************************** * Testing for the High Level public routine: H5LDget_dset_elmts() - * Verify failures when calling H5LDget_dset_elmts() with the following - * invalid conditions: + * Verify failures when calling H5LDget_dset_elmts() with the following + * invalid conditions: * - * A. DSET_TWO: two-dimensional dataset - * 1. CUR_DIMS and PREV_DIMS are NULL - * 2. PREV_DIMS is NULL - * 3. CUR_DIMS is NULL - * 4. FIELDS is nonnull but the dataset is not compound datatype - * 5. BUF is NULL - * 6. CUR_DIMS is not greater than PREV_DIMS + * A. DSET_TWO: two-dimensional dataset + * 1. CUR_DIMS and PREV_DIMS are NULL + * 2. PREV_DIMS is NULL + * 3. CUR_DIMS is NULL + * 4. FIELDS is nonnull but the dataset is not compound datatype + * 5. BUF is NULL + * 6. CUR_DIMS is not greater than PREV_DIMS * - * B. DSET_CMPD: one-dimensional dataset with compound type - * 1. Invalid dataset id - * 2. FIELDS are not valid members in the compound type + * B. DSET_CMPD: one-dimensional dataset with compound type + * 1. Invalid dataset id + * 2. FIELDS are not valid members in the compound type * ************************************************************************************** */ static int test_LD_elmts_invalid(const char *file) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hid_t sid=-1; /* dataspace identifier */ + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hid_t sid=-1; /* dataspace identifier */ hid_t invalid_id=-1; - int ret; /* return value */ - hsize_t cur_dims[2]; /* current dimension sizes of the dataset */ - hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */ - char tbuf[2]; /* temporary buffer for testing */ - int ndims; /* # of dimension sizes */ - int i; /* local index variable */ + int ret; /* return value */ + hsize_t cur_dims[2]; /* current dimension sizes of the dataset */ + hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */ + char tbuf[2]; /* temporary buffer for testing */ + int ndims; /* # of dimension sizes */ + int i; /* local index variable */ const char *filename = H5_get_srcdir_filename(file); - TESTING("H5LDget_dset_elmts on invalid conditions"); + HL_TESTING2("H5LDget_dset_elmts on invalid conditions"); /* Open the copied file */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Testing two-dimensional dataset: DSET_TWO */ /* Open dataset: DSET_TWO */ if((did = H5Dopen2(fid, DSET_TWO, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Verify failure from case #1: cur_dims and prev_dims are NULL */ ret = H5LDget_dset_elmts(did, NULL, NULL, NULL, NULL); @@ -884,15 +884,15 @@ test_LD_elmts_invalid(const char *file) VERIFY_EQUAL(ret, FAIL) if((sid = H5Dget_space(did)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the # of dimensions and current dimension sizes */ if((ndims = H5Sget_simple_extent_dims(sid, cur_dims, NULL)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Set up valid cur_dims and prev_dims */ for(i = 0; i < ndims; i++) - prev_dims[i] = cur_dims[i] - 1; + prev_dims[i] = cur_dims[i] - 1; /* Verify failure from case #4: FIELDS is nonNULL but the dataset is not compound datatype */ ret = H5LDget_dset_elmts(did, prev_dims, cur_dims, "field1", tbuf); @@ -910,26 +910,26 @@ test_LD_elmts_invalid(const char *file) /* Close DSET_TWO */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - /* + /* * Testing one-dimensional dataset with compound datatype: - * DSET_CMPD + * DSET_CMPD */ /* Verify failure from case #1: an invalid dataset id */ H5E_BEGIN_TRY { - ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); + ret = H5LDget_dset_elmts(invalid_id, prev_dims, cur_dims, NULL, tbuf); } H5E_END_TRY; VERIFY_EQUAL(ret, FAIL) /* Open dataset: DSET_CMPD */ if((did = H5Dopen2(fid, DSET_CMPD, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Retrieve the current dimension sizes */ if(H5LDget_dset_dims(did, cur_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Set up valid cur_dims, prev_dims */ prev_dims[0] = cur_dims[0] - 1; @@ -940,118 +940,118 @@ test_LD_elmts_invalid(const char *file) /* Close DSET_CMPD */ if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Sclose(sid); - H5Dclose(did); - H5Fclose(fid); + H5Sclose(sid); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_elmts_invalid() */ - -/* + +/* ************************************************************************************** * Testing for the High Level public routine: H5LDget_dset_elmts() - * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected - * when the dataset's dimension sizes are changed according to one_tests[]: + * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected + * when the dataset's dimension sizes are changed according to one_tests[]: * - * one-dimensional dataset : - * DSET_ONE with NULL fields - * DSET_CMPD with fields: NULL, VALID_FIELDS1, VALID_FIELDS2 - * DSET_CMPD_ESC with fields: NULL, VALID_ESC_FIELDS1, VALID_ESC_FIELDS2 - * - * case #1. increase dims[0] - * case #2. decrease dims[0] (failure) - * case #3. same dims[0] (failure) - * case #4. decrease dims[0] (failure) - * case #5. increase dims[0] + * one-dimensional dataset : + * DSET_ONE with NULL fields + * DSET_CMPD with fields: NULL, VALID_FIELDS1, VALID_FIELDS2 + * DSET_CMPD_ESC with fields: NULL, VALID_ESC_FIELDS1, VALID_ESC_FIELDS2 + * + * case #1. increase dims[0] + * case #2. decrease dims[0] (failure) + * case #3. same dims[0] (failure) + * case #4. decrease dims[0] (failure) + * case #5. increase dims[0] * ************************************************************************************** */ static herr_t test_LD_elmts_one(const char *file, const char *dname, const char *fields) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hid_t dtype=-1; /* dataset's data type */ - hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */ - hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */ - int i, j; /* local index variable */ - int ret = 0; /* return value */ + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hid_t dtype=-1; /* dataset's data type */ + hsize_t ext_dims[1]; /* extended dimension sizes of the dataset */ + hsize_t prev_dims[1]; /* previous dimension sizes of the dataset */ + int i, j; /* local index variable */ + int ret = 0; /* return value */ - TESTING("H5LDget_dset_elmts: one-dimensional dataset"); + HL_TESTING2("H5LDget_dset_elmts: one-dimensional dataset"); /* Copy the test file */ if(h5_make_local_copy(file, COPY_FILENAME) < 0) TEST_ERROR for(i = 0; i < TEST_BUF_SIZE; i++) { - cbuf[i].field1 = i; - cbuf[i].field2.a = i; - cbuf[i].field2.b.a = i; - cbuf[i].field2.b.b = i; - cbuf[i].field2.b.c = i; - cbuf[i].field2.c = i; - cbuf[i].field3 = (double)i; - cbuf[i].field4.a = i; - cbuf[i].field4.b = i; - ibuf[i] = i; + cbuf[i].field1 = i; + cbuf[i].field2.a = i; + cbuf[i].field2.b.a = i; + cbuf[i].field2.b.b = i; + cbuf[i].field2.b.c = i; + cbuf[i].field2.c = i; + cbuf[i].field3 = (double)i; + cbuf[i].field4.a = i; + cbuf[i].field4.b = i; + ibuf[i] = i; } /* end for */ /* Open the copied file */ if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Open the dataset */ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the dataset's data type */ if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get current dimension sizes before extending the dataset's dimension sizes */ if(H5LDget_dset_dims(did, prev_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Loop through different variations of extending the dataset */ for(i = 0; i < ONE_NTESTS; i++) { - HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1)); - HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2)); - HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); - HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int)); - - ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]); - - /* Change the dimension sizes of the dataset */ - if(H5Dset_extent(did, ext_dims) < 0) - FAIL_STACK_ERROR - - /* Initialize data */ - if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) { - if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0) - FAIL_STACK_ERROR - } /* end if */ + HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1)); + HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2)); + HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); + HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int)); + + ext_dims[0] = (hsize_t)((int)prev_dims[0] + one_tests[i]); + + /* Change the dimension sizes of the dataset */ + if(H5Dset_extent(did, ext_dims) < 0) + FAIL_STACK_ERROR + + /* Initialize data */ + if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) { + if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0) + FAIL_STACK_ERROR + } /* end if */ else if(!HDstrcmp(dname, DSET_ONE)) { - if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0) - FAIL_STACK_ERROR - } /* end if */ - - /* There are changes in dimension sizes */ - if(one_tests[i] > 0) { - if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) { - if(fields) { + if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0) + FAIL_STACK_ERROR + } /* end if */ + + /* There are changes in dimension sizes */ + if(one_tests[i] > 0) { + if(!HDstrcmp(dname, DSET_CMPD) || !HDstrcmp(dname, DSET_CMPD_ESC)) { + if(fields) { if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) { /* Retrieve the elmemts in BUF */ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0) @@ -1067,24 +1067,24 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields) VERIFY_ELMTS_VALID2(vbuf2[j], cbuf[prev_dims[0] + (hsize_t)j]) } /* end else-if */ else - TEST_ERROR - } /* end if */ + TEST_ERROR + } /* end if */ else { - /* Retrieve the elmemts in BUF */ - if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0) - TEST_ERROR - for(j = 0; j < one_tests[i]; j++) - VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j]) - } /* end else-if */ - } /* end if */ + /* Retrieve the elmemts in BUF */ + if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0) + TEST_ERROR + for(j = 0; j < one_tests[i]; j++) + VERIFY_ELMTS_ALL(ccbuf[j], cbuf[prev_dims[0] + (hsize_t)j]) + } /* end else-if */ + } /* end if */ else { - /* Retrieve the elmemts in BUF */ - if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0) - TEST_ERROR - for(j = 0; j < one_tests[i]; j++) - VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j]) - } /* end else */ - } /* end if */ + /* Retrieve the elmemts in BUF */ + if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0) + TEST_ERROR + for(j = 0; j < one_tests[i]; j++) + VERIFY_EQUAL(iibuf[j], ibuf[prev_dims[0] + (hsize_t)j]) + } /* end else */ + } /* end if */ else { /* Verify failure when changes between prev_dims and ext_dims are same/decrease */ ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf); @@ -1108,56 +1108,56 @@ test_LD_elmts_one(const char *file, const char *dname, const char *fields) error: H5E_BEGIN_TRY { - H5Tclose(dtype); - H5Dclose(did); - H5Fclose(fid); + H5Tclose(dtype); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_elmts_one() */ - + /* ************************************************************************************** * - * Helper routine to verify elements of a 2-dimensional dataset - * _ldbuf contains the elements retrieved via H5LDget_dset_elmts() - * _buf contains the data written to the dataset + * Helper routine to verify elements of a 2-dimensional dataset + * _ldbuf contains the elements retrieved via H5LDget_dset_elmts() + * _buf contains the data written to the dataset * - * e.g. prev_dims[2] = {4, 6}; ext_dims[2] = {6, 10} - * elements marked in 'v' in _buf are compared to elements in _ldbuf - * 0 1 2 3 4 5 | 6 7 8 9 - * 0 | v v v v - * 1 | v v v v - * 2 | v v v v - * 3 | v v v v - * --------------------- - * 4 v v v v v v v v v v - * 5 v v v v v v v v v v + * e.g. prev_dims[2] = {4, 6}; ext_dims[2] = {6, 10} + * elements marked in 'v' in _buf are compared to elements in _ldbuf + * 0 1 2 3 4 5 | 6 7 8 9 + * 0 | v v v v + * 1 | v v v v + * 2 | v v v v + * 3 | v v v v + * --------------------- + * 4 v v v v v v v v v v + * 5 v v v v v v v v v v * ************************************************************************************** */ static herr_t verify_elmts_two(int type, hsize_t *ext_dims, hsize_t *prev_dims, void *_ldbuf, void *_buf) { - int k, m; /* Local index variable */ + int k, m; /* Local index variable */ - k = 0; + k = 0; for(m = 0; m < (int)ext_dims[0]; m++) { - int n, ind; /* Local index variable */ - - ind = m * (int)ext_dims[1]; - if(m < (int)prev_dims[0]) { - for(n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) { - VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) - ++k; - } /* end for */ - } /* end if */ - else { - for(n = 0; n < (int)ext_dims[1]; n++) { - VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) - ++k; - } /* end for */ - } /* end else */ + int n, ind; /* Local index variable */ + + ind = m * (int)ext_dims[1]; + if(m < (int)prev_dims[0]) { + for(n = (int)prev_dims[1]; n < (int)ext_dims[1]; n++) { + VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) + ++k; + } /* end for */ + } /* end if */ + else { + for(n = 0; n < (int)ext_dims[1]; n++) { + VERIFY_ELMTS(type, k, ind, _ldbuf, _buf) + ++k; + } /* end for */ + } /* end else */ } /* end for */ return(0); @@ -1166,106 +1166,106 @@ error: return(-1); } /* verify_elmts_two() */ - -/* + +/* ************************************************************************************** * Testing for the High Level public routine: H5LDget_dset_elmts() - * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected when - * the datset's dimension sizes are changed accordingly to two_tests[]: + * Verify elements retrieved via H5LDget_dset_elmts() are correct as expected when + * the datset's dimension sizes are changed accordingly to two_tests[]: * - * two-dimensional dataset: DSET_TWO with NULL fields - * DSET_CMPD_TWO with fields: NULL, VALID_FIELDS1, VALID_FIELDS2 + * two-dimensional dataset: DSET_TWO with NULL fields + * DSET_CMPD_TWO with fields: NULL, VALID_FIELDS1, VALID_FIELDS2 + * + * dims[0] dims[1] + * ------- ------- + * case #1: increase increase + * case #2: increase decrease + * case #3: increase same + * case #4: decrease increase + * case #5: decrease decrease (failure) + * case #6: decrease same (failure) + * case #7: same increase + * case #8: same decrease (failure) + * case #9: same same (failure) * - * dims[0] dims[1] - * ------- ------- - * case #1: increase increase - * case #2: increase decrease - * case #3: increase same - * case #4: decrease increase - * case #5: decrease decrease (failure) - * case #6: decrease same (failure) - * case #7: same increase - * case #8: same decrease (failure) - * case #9: same same (failure) - * ************************************************************************************** */ static herr_t test_LD_elmts_two(const char *file, const char *dname, const char *fields) { - hid_t fid=-1; /* file identifier */ - hid_t did=-1; /* dataset identifier */ - hid_t dtype=-1; /* dataset's data type */ - hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */ - hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */ - int i; /* local index variable */ - int ret = 0; /* return value */ + hid_t fid=-1; /* file identifier */ + hid_t did=-1; /* dataset identifier */ + hid_t dtype=-1; /* dataset's data type */ + hsize_t ext_dims[2]; /* extended dimension sizes of the dataset */ + hsize_t prev_dims[2]; /* previous dimension sizes of the dataset */ + int i; /* local index variable */ + int ret = 0; /* return value */ - TESTING("H5LDget_dset_elmts: two-dimensional dataset"); + HL_TESTING2("H5LDget_dset_elmts: two-dimensional dataset"); /* Copy the test file */ if(h5_make_local_copy(file, COPY_FILENAME) < 0) TEST_ERROR for(i = 0; i < TEST_BUF_SIZE; i++) { - cbuf[i].field1 = i; - cbuf[i].field2.a = i; - cbuf[i].field2.b.a = i; - cbuf[i].field2.b.b = i; - cbuf[i].field2.b.c = i; - cbuf[i].field2.c = i; - cbuf[i].field3 = (double)i; - cbuf[i].field4.a = i; - cbuf[i].field4.b = i; - ibuf[i] = i; + cbuf[i].field1 = i; + cbuf[i].field2.a = i; + cbuf[i].field2.b.a = i; + cbuf[i].field2.b.b = i; + cbuf[i].field2.b.c = i; + cbuf[i].field2.c = i; + cbuf[i].field3 = (double)i; + cbuf[i].field4.a = i; + cbuf[i].field4.b = i; + ibuf[i] = i; } /* end for */ /* Open the copied file */ if((fid = H5Fopen(COPY_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Open the dataset */ if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get the dataset's data type */ if((dtype = H5Tget_native_type(H5Dget_type(did), H5T_DIR_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Get current dimension sizes before extending the dataset's dimension sizes */ if(H5LDget_dset_dims(did, prev_dims) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Loop through different variations of extending the dataset */ for(i = 0; i < TWO_NTESTS; i++) { - HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1)); - HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2)); - HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); - HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int)); - - ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]); - ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]); - - /* Change the dimension sizes of the dataset */ - if(H5Dset_extent(did, ext_dims) < 0) - FAIL_STACK_ERROR - - /* Initialize data */ - if(!HDstrcmp(dname, DSET_CMPD_TWO)) { - if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0) - FAIL_STACK_ERROR - } /* end if */ + HDmemset(vbuf1, 0, TEST_BUF_SIZE * sizeof(test_valid_fields1)); + HDmemset(vbuf2, 0, TEST_BUF_SIZE * sizeof(test_valid_fields2)); + HDmemset(ccbuf, 0, TEST_BUF_SIZE * sizeof(set_t)); + HDmemset(iibuf, 0, TEST_BUF_SIZE * sizeof(int)); + + ext_dims[0] = (hsize_t)((int)prev_dims[0] + two_tests[i][0]); + ext_dims[1] = (hsize_t)((int)prev_dims[1] + two_tests[i][1]); + + /* Change the dimension sizes of the dataset */ + if(H5Dset_extent(did, ext_dims) < 0) + FAIL_STACK_ERROR + + /* Initialize data */ + if(!HDstrcmp(dname, DSET_CMPD_TWO)) { + if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, cbuf) < 0) + FAIL_STACK_ERROR + } /* end if */ else if(!HDstrcmp(dname, DSET_TWO)) { - if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0) - FAIL_STACK_ERROR - } /* end else-if */ + if(H5Dwrite(did, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf) < 0) + FAIL_STACK_ERROR + } /* end else-if */ else TEST_ERROR - /* There are changes in dimension sizes */ - if(two_tests[i][0] > 0 || two_tests[i][1] > 0) { - if(!HDstrcmp(dname, DSET_CMPD_TWO)) { - if(fields) { + /* There are changes in dimension sizes */ + if(two_tests[i][0] > 0 || two_tests[i][1] > 0) { + if(!HDstrcmp(dname, DSET_CMPD_TWO)) { + if(fields) { if(!HDstrcmp(fields, VALID_FIELDS1) || !HDstrcmp(fields, VALID_ESC_FIELDS1)) { /* Retrieve the elmemts in BUF */ if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, vbuf1) < 0) @@ -1282,37 +1282,37 @@ test_LD_elmts_two(const char *file, const char *dname, const char *fields) } /* end else-if */ else TEST_ERROR - } /* end if */ + } /* end if */ else { - /* Retrieve the elmemts in BUF */ - if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0) - TEST_ERROR - if(verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0) - TEST_ERROR - } /* end else */ - } /* end if */ + /* Retrieve the elmemts in BUF */ + if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, ccbuf) < 0) + TEST_ERROR + if(verify_elmts_two(TWO_CMPD_NULL, ext_dims, prev_dims, ccbuf, cbuf) < 0) + TEST_ERROR + } /* end else */ + } /* end if */ else { /* DSET_TWO */ - /* Retrieve the elmemts in BUF */ - if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0) - TEST_ERROR - if(verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0) - TEST_ERROR - } /* end else */ - } /* end if */ + /* Retrieve the elmemts in BUF */ + if(H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf) < 0) + TEST_ERROR + if(verify_elmts_two(TWO_NONE, ext_dims, prev_dims, iibuf, ibuf) < 0) + TEST_ERROR + } /* end else */ + } /* end if */ else { - /* Verify failure when changes between prev_dims and ext_dims are same/decrease */ - ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf); - VERIFY_EQUAL(ret, FAIL) - } /* end else */ + /* Verify failure when changes between prev_dims and ext_dims are same/decrease */ + ret = H5LDget_dset_elmts(did, prev_dims, ext_dims, fields, iibuf); + VERIFY_EQUAL(ret, FAIL) + } /* end else */ } /* end for */ /* Closing */ if(H5Tclose(dtype) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Dclose(did) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; /* Remove the copied file */ HDremove(COPY_FILENAME); @@ -1322,16 +1322,16 @@ test_LD_elmts_two(const char *file, const char *dname, const char *fields) error: H5E_BEGIN_TRY { - H5Tclose(dtype); - H5Dclose(did); - H5Fclose(fid); + H5Tclose(dtype); + H5Dclose(did); + H5Fclose(fid); } H5E_END_TRY; return(-1); } /* test_LD_elmts_two() */ /* - * Tests for High Level routines: - * H5LDget_dset_dims(), H5LDget_dset_elmts, H5LDget_dset_type_size() + * Tests for High Level routines: + * H5LDget_dset_dims(), H5LDget_dset_elmts, H5LDget_dset_type_size() */ int main(void) { @@ -1339,60 +1339,60 @@ int main(void) /* Set up temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */ if(NULL == (ibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(NULL == (iibuf = (int *)HDmalloc(sizeof(int) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(NULL == (cbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(NULL == (ccbuf = (set_t *)HDmalloc(sizeof(set_t) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(NULL == (vbuf1 = (test_valid_fields1 *)HDmalloc(sizeof(test_valid_fields1) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; if(NULL == (vbuf2 = (test_valid_fields2 *)HDmalloc(sizeof(test_valid_fields2) * TEST_BUF_SIZE))) - FAIL_STACK_ERROR; + FAIL_STACK_ERROR; - /* - * Testing H5LDget_dset_dims() + /* + * Testing H5LDget_dset_dims() */ nerrors += test_LD_dims_params(FILE); nerrors += test_LD_dims(FILE); - /* - * Testing H5LDget_dset_type_size() + /* + * Testing H5LDget_dset_type_size() */ nerrors += test_LD_size(FILE); - /* + /* * Testing invalid conditions for H5LDget_dset_elmts() */ nerrors += test_LD_elmts_invalid(FILE); - /* - * Testing H5LDget_dset_elmts(): - * 1-dimensional dataset + /* + * Testing H5LDget_dset_elmts(): + * 1-dimensional dataset */ nerrors += test_LD_elmts_one(FILE, DSET_ONE, NULL); - /* - * Testing H5LDget_dset_elmts(): - * 1-dimensional dataset w/ compound datatype + /* + * Testing H5LDget_dset_elmts(): + * 1-dimensional dataset w/ compound datatype */ nerrors += test_LD_elmts_one(FILE, DSET_CMPD, NULL); nerrors += test_LD_elmts_one(FILE, DSET_CMPD, VALID_FIELDS1); nerrors += test_LD_elmts_one(FILE, DSET_CMPD, VALID_FIELDS2); - /* + /* * Testing H5LDget_dset_elmts(): - * 1-dimensional dataset with compound datatype and - * member names with escape/separator characters + * 1-dimensional dataset with compound datatype and + * member names with escape/separator characters */ nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, NULL); nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, VALID_ESC_FIELDS1); nerrors += test_LD_elmts_one(FILE, DSET_CMPD_ESC, VALID_ESC_FIELDS2); - /* + /* * Testing H5LDget_dset_elmts() for 2-dimensional datasets */ nerrors += test_LD_elmts_two(FILE, DSET_TWO, NULL); @@ -1416,7 +1416,7 @@ int main(void) /* check for errors */ if(nerrors) - goto error; + goto error; puts("All tests for H5LD high level routines passed."); diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 51ab72b..e6b4668 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -87,7 +87,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset"); + HL_TESTING2("H5LTmake_dataset"); /* Make dataset */ if ( H5LTmake_dataset( file_id, DSET0_NAME, rank, dims, H5T_NATIVE_INT, data_int_in ) < 0 ) @@ -118,7 +118,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTread_dataset"); + HL_TESTING2("H5LTread_dataset"); if ( H5LTread_dataset( file_id, DSET0_NAME, H5T_NATIVE_INT, data_int_out ) < 0 ) goto out; @@ -143,7 +143,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_char"); + HL_TESTING2("H5LTmake_dataset_char"); /* Make dataset char */ if ( H5LTmake_dataset_char( file_id, DSET1_NAME, rank, dims, data_char_in ) < 0 ) @@ -179,7 +179,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_short"); + HL_TESTING2("H5LTmake_dataset_short"); /* Make dataset short */ if ( H5LTmake_dataset_short( file_id, DSET2_NAME, rank, dims, data_short_in ) < 0 ) @@ -214,7 +214,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_int"); + HL_TESTING2("H5LTmake_dataset_int"); /* Make dataset int */ if ( H5LTmake_dataset_int( file_id, DSET3_NAME, rank, dims, data_int_in ) < 0 ) @@ -250,7 +250,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_long"); + HL_TESTING2("H5LTmake_dataset_long"); /* Make dataset long */ if ( H5LTmake_dataset_long( file_id, DSET4_NAME, rank, dims, data_long_in ) < 0 ) @@ -286,7 +286,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_float"); + HL_TESTING2("H5LTmake_dataset_float"); /* Make dataset float */ if ( H5LTmake_dataset_float( file_id, DSET5_NAME, rank, dims, data_float_in ) < 0 ) @@ -322,7 +322,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_double"); + HL_TESTING2("H5LTmake_dataset_double"); /* Make dataset double */ if ( H5LTmake_dataset_double( file_id, DSET6_NAME, rank, dims, data_double_in ) < 0 ) @@ -358,7 +358,7 @@ static int test_dsets( void ) *------------------------------------------------------------------------- */ - TESTING("H5LTmake_dataset_string"); + HL_TESTING2("H5LTmake_dataset_string"); /* Make dataset string */ if ( H5LTmake_dataset_string(file_id,DSET7_NAME,data_string_in) < 0 ) @@ -517,7 +517,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_string"); + HL_TESTING2("H5LTset_attribute_string"); /* Set the attribute */ if ( H5LTset_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_in ) < 0 ) @@ -530,7 +530,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_string"); + HL_TESTING2("H5LTget_attribute_string"); /* Get the attribute */ @@ -550,7 +550,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_char"); + HL_TESTING2("H5LTset_attribute_char"); /* Set the attribute */ if ( H5LTset_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_in, (size_t)5 ) < 0 ) @@ -563,7 +563,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_char"); + HL_TESTING2("H5LTget_attribute_char"); /* Get the attribute */ if ( H5LTget_attribute_char( loc_id, obj_name, ATTR2_NAME, attr_char_out ) < 0 ) @@ -594,7 +594,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_short"); + HL_TESTING2("H5LTset_attribute_short"); /* Set the attribute */ if ( H5LTset_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_in, (size_t)5 ) < 0 ) @@ -608,7 +608,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_short"); + HL_TESTING2("H5LTget_attribute_short"); /* Get the attribute */ if ( H5LTget_attribute_short( loc_id, obj_name, ATTR3_NAME, attr_short_out ) < 0 ) @@ -640,7 +640,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_int"); + HL_TESTING2("H5LTset_attribute_int"); /* Set the attribute */ if ( H5LTset_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_in, (size_t)5 ) < 0 ) @@ -661,7 +661,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_int"); + HL_TESTING2("H5LTget_attribute_int"); /* Get the attribute */ if ( H5LTget_attribute_int( loc_id, obj_name, ATTR4_NAME, attr_int_out ) < 0 ) @@ -712,7 +712,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_long"); + HL_TESTING2("H5LTset_attribute_long"); /* Set the attribute */ if ( H5LTset_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_in, (size_t)5 ) < 0 ) @@ -725,7 +725,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_long"); + HL_TESTING2("H5LTget_attribute_long"); /* Get the attribute */ if ( H5LTget_attribute_long( loc_id, obj_name, ATTR5_NAME, attr_long_out ) < 0 ) @@ -756,7 +756,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_uchar"); + HL_TESTING2("H5LTset_attribute_uchar"); /* Set the attribute */ if ( H5LTset_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_in, (size_t)5 ) < 0 ) @@ -769,7 +769,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_uchar"); + HL_TESTING2("H5LTget_attribute_uchar"); /* Get the attribute */ if ( H5LTget_attribute_uchar( loc_id, obj_name, ATTR6_NAME, attr_uchar_out ) < 0 ) @@ -800,7 +800,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_ushort"); + HL_TESTING2("H5LTset_attribute_ushort"); /* Set the attribute */ if ( H5LTset_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_in, (size_t)5 ) < 0 ) @@ -814,7 +814,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_ushort"); + HL_TESTING2("H5LTget_attribute_ushort"); /* Get the attribute */ if ( H5LTget_attribute_ushort( loc_id, obj_name, ATTR7_NAME, attr_ushort_out ) < 0 ) @@ -846,7 +846,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_uint"); + HL_TESTING2("H5LTset_attribute_uint"); /* Set the attribute */ if ( H5LTset_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_in, (size_t)5 ) < 0 ) @@ -859,7 +859,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_uint"); + HL_TESTING2("H5LTget_attribute_uint"); /* Get the attribute */ if ( H5LTget_attribute_uint( loc_id, obj_name, ATTR8_NAME, attr_uint_out ) < 0 ) @@ -890,7 +890,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_ulong"); + HL_TESTING2("H5LTset_attribute_ulong"); /* Set the attribute */ if ( H5LTset_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_in, (size_t)5 ) < 0 ) @@ -903,7 +903,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_ulong"); + HL_TESTING2("H5LTget_attribute_ulong"); /* Get the attribute */ if ( H5LTget_attribute_ulong( loc_id, obj_name, ATTR9_NAME, attr_ulong_out ) < 0 ) @@ -935,7 +935,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_float"); + HL_TESTING2("H5LTset_attribute_float"); /* Set the attribute */ if ( H5LTset_attribute_float( loc_id, obj_name, ATTR10_NAME, attr_float_in, (size_t)5 ) < 0 ) @@ -948,7 +948,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_float"); + HL_TESTING2("H5LTget_attribute_float"); /* Get the attribute */ @@ -980,7 +980,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTset_attribute_double"); + HL_TESTING2("H5LTset_attribute_double"); /* Set the attribute */ if ( H5LTset_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_in, (size_t)5 ) < 0 ) @@ -993,7 +993,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_double"); + HL_TESTING2("H5LTget_attribute_double"); /* Get the attribute */ if ( H5LTget_attribute_double( loc_id, obj_name, ATTR11_NAME, attr_double_out ) < 0 ) @@ -1026,7 +1026,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) */ - TESTING("H5LTget_attribute_ndims"); + HL_TESTING2("H5LTget_attribute_ndims"); if ( H5LTget_attribute_ndims( loc_id, obj_name, ATTR2_NAME, &rank_out ) < 0 ) return -1; @@ -1042,7 +1042,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) *------------------------------------------------------------------------- */ - TESTING("H5LTget_attribute_info"); + HL_TESTING2("H5LTget_attribute_info"); if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * (size_t)rank_out ))) return -1; @@ -1079,7 +1079,7 @@ static int test_integers(void) char* dt_str; size_t str_len; - TESTING3("\n text for integer types"); + HL_TESTING3("\n text for integer types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_INT\n", H5LT_DDL))<0) goto out; @@ -1136,7 +1136,7 @@ static int test_fps(void) char* dt_str; size_t str_len; - TESTING3(" text for floating-point types"); + HL_TESTING3(" text for floating-point types"); if((dtype = H5LTtext_to_dtype("H5T_NATIVE_LDOUBLE\n", H5LT_DDL))<0) goto out; @@ -1197,7 +1197,7 @@ static int test_strings(void) char* dt_str = NULL; size_t str_len; - TESTING3(" text for string types"); + HL_TESTING3(" text for string types"); if((dtype = H5LTtext_to_dtype("H5T_STRING { STRSIZE 13; STRPAD H5T_STR_NULLTERM; CSET H5T_CSET_ASCII; CTYPE H5T_C_S1; }", H5LT_DDL))<0) goto out; @@ -1328,7 +1328,7 @@ static int test_opaques(void) char* dt_str; size_t str_len; - TESTING3(" text for opaque types"); + HL_TESTING3(" text for opaque types"); if((dtype = H5LTtext_to_dtype("H5T_OPAQUE { OPQ_SIZE 19; OPQ_TAG \"This is a tag for opaque type\"; }", H5LT_DDL))<0) goto out; @@ -1385,7 +1385,7 @@ static int test_enums(void) char* dt_str; size_t str_len; - TESTING3(" text for enum types"); + HL_TESTING3(" text for enum types"); if((dtype = H5LTtext_to_dtype("H5T_ENUM { H5T_STD_I32LE; \"RED\" 5; \"GREEN\" 6; \"BLUE\" 7; \"WHITE\" 8; }", H5LT_DDL))<0) goto out; @@ -1457,7 +1457,7 @@ static int test_variables(void) char* dt_str; size_t str_len; - TESTING3(" text for variable types"); + HL_TESTING3(" text for variable types"); if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_NATIVE_CHAR }\n", H5LT_DDL))<0) goto out; @@ -1518,7 +1518,7 @@ static int test_arrays(void) char* dt_str; size_t str_len; - TESTING3(" text for array types"); + HL_TESTING3(" text for array types"); if((dtype = H5LTtext_to_dtype("H5T_ARRAY { [5][7][13] H5T_ARRAY { [17][19] H5T_COMPOUND { H5T_STD_I8BE \"arr_compound_1\"; H5T_STD_I32BE \"arr_compound_2\"; } } }", H5LT_DDL))<0) goto out; @@ -1579,7 +1579,7 @@ static int test_compounds(void) char* dt_str; size_t str_len; - TESTING3(" text for compound types"); + HL_TESTING3(" text for compound types"); if((dtype = H5LTtext_to_dtype("H5T_COMPOUND { H5T_STD_I16BE \"one_field\" : 2; H5T_STD_U8LE \"two_field\" : 6; }", H5LT_DDL))<0) goto out; @@ -1673,7 +1673,7 @@ static int test_compound_bug(void) " } } \"sub\" : 8;\n" "}\n"; - TESTING3(" text for compound type of bug fix"); + HL_TESTING3(" text for compound type of bug fix"); if((dtype = H5LTtext_to_dtype(text, H5LT_DDL))<0) goto out; @@ -1765,7 +1765,7 @@ static int test_complicated_compound(void) size_t size = 1024; const char *filename = H5_get_srcdir_filename(INPUT_FILE); - TESTING3(" text for complicated compound types"); + HL_TESTING3(" text for complicated compound types"); /* Open input file */ fp = HDfopen(filename, "r"); @@ -1834,7 +1834,7 @@ out: */ static int test_text_dtype(void) { - TESTING("H5LTtext_to_dtype"); + HL_TESTING2("H5LTtext_to_dtype"); if(test_integers()<0) goto out; @@ -1882,7 +1882,7 @@ static int test_valid_path(void) htri_t path_valid; const char *data_string_in = "test"; - TESTING("H5LTpath_valid"); + HL_TESTING2("H5LTpath_valid"); /* Create a new file using default properties. */ diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 7003b26..61aebc7 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -178,7 +178,7 @@ static int test_create_close(hid_t fid) hid_t table; hid_t part_t; - TESTING("H5PTcreate_fl and H5PTclose"); + HL_TESTING2("H5PTcreate_fl and H5PTclose"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); @@ -188,11 +188,11 @@ static int test_create_close(hid_t fid) /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); if (H5Tclose(part_t) < 0) - goto error; + goto error; if( H5PTis_valid(table) < 0) - goto error; + goto error; if( H5PTis_varlen(table) != 0) - goto error; + goto error; /* Close the table */ err = H5PTclose(table); @@ -219,7 +219,7 @@ static int test_open(hid_t fid) herr_t err; hid_t table; - TESTING("H5PTopen"); + HL_TESTING2("H5PTopen"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -255,7 +255,7 @@ static int test_append(hid_t fid) hid_t table; hsize_t count = 0; - TESTING("H5PTappend"); + HL_TESTING2("H5PTappend"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -322,7 +322,7 @@ static int test_read(hid_t fid) particle_t readBuf[NRECORDS]; size_t c; - TESTING("H5PTread_packets"); + HL_TESTING2("H5PTread_packets"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -383,7 +383,7 @@ static int test_get_next(hid_t fid) particle_t readBuf2[NRECORDS]; size_t c; - TESTING("H5PTget_next"); + HL_TESTING2("H5PTget_next"); /* Open the table */ table = H5PTopen(fid, PT_NAME); @@ -454,7 +454,7 @@ static int test_big_table(hid_t fid) particle_t readPart; hsize_t count; - TESTING("large packet table"); + HL_TESTING2("large packet table"); /* Create a datatype for the particle struct */ part_t = make_particle_type(); @@ -528,7 +528,7 @@ static int test_opaque(hid_t fid) size_t c; particle_t readBuf[NRECORDS]; - TESTING("opaque data"); + HL_TESTING2("opaque data"); /* Create an opaque datatype for the particle struct */ if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 ) @@ -602,7 +602,7 @@ test_compress(void) particle_t readPart[1]; hsize_t count; - TESTING("packet table compression"); + HL_TESTING2("packet table compression"); /* Create a file. */ if((fid1 = H5Fcreate(TEST_COMPRESS_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -739,7 +739,7 @@ static int test_rw_nonnative_dt(hid_t fid) int writeBuffer[5]; int readBuffer[5]; - TESTING("reading/writing non-native packet table"); + HL_TESTING2("reading/writing non-native packet table"); /* Initialize buffers */ for(x=0; x<5; x++) { @@ -794,7 +794,7 @@ static int test_rw_nonnative_dt(hid_t fid) /* Close the packet table */ if( (err = H5PTclose(ptable)) < 0) goto error; - + PASSED(); return SUCCEED; @@ -819,7 +819,7 @@ static int test_error(hid_t fid) int id_open=0; particle_t readBuf[1]; - TESTING("error conditions"); + HL_TESTING2("error conditions"); /* Create a HL table */ if(create_hl_table(fid) < 0) @@ -981,7 +981,7 @@ int main(void) /* Close the file */ if (H5Fclose(fid) < 0) - status = 1; + status = 1; return status; } diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 1d6231e..4d83ae6 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -46,24 +46,24 @@ static int verify_attribute(hid_t fid, const char *table_name, const char *attr_ /*------------------------------------------------------------------------- * test_VLof_atomic(): Test that a packet table with VL datatypes of atomic - * datatypes can be created and written correctly. (HDFFV-442) + * datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_VLof_atomic(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen of atomic"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen of atomic"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -71,42 +71,42 @@ static int test_VLof_atomic(void) if (writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) - ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; + ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; } /* end for */ /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a vlen type that uses an atomic datatype as its base type */ vltype = H5Tvlen_create (H5T_NATIVE_UINT); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of an atomic type */ ptable = H5PTcreate(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the vlen datatype */ if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -114,33 +114,33 @@ static int test_VLof_atomic(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { - if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); - } + if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { + printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + } } /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf ); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -157,7 +157,7 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_VLof_comptype(): Test that a packet table with VL datatypes of - * compound datatypes can be created and written correctly. (HDFFV-442) + * compound datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -169,18 +169,18 @@ static int test_VLof_comptype(void) unsigned u; float f; } VLcomp_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - char msg[80]; /* For error message */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + char msg[80]; /* For error message */ herr_t ret; - TESTING3(" with vlen of compound datatypes"); + HL_TESTING3(" with vlen of compound datatypes"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -188,7 +188,7 @@ static int test_VLof_comptype(void) if(writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) { ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv; @@ -199,48 +199,48 @@ static int test_VLof_comptype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create the base compound type */ cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t)); if (cmptype < 0) - goto error; + goto error; /* Insert fields */ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; /* Create a variable length type that uses the VLcomp_t as its base type */ vltype = H5Tvlen_create(cmptype); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of compound datatype */ ptable = H5PTcreate(fid, PT_VLEN_COMP, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release the datatypes */ if (H5Tclose(cmptype) < 0) - goto error; + goto error; if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -248,39 +248,39 @@ static int test_VLof_comptype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); - continue; - } /* write len != read len */ + continue; + } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]); continue; - } /* write value != read value */ - } + } /* write value != read value */ + } } /* end for */ /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -298,8 +298,8 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_compound_VL_VL(): Test that a packet table of compound datatypes - * containing VL datatypes can be created and written - * correctly. (HDFFV-442) + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -310,23 +310,23 @@ static int test_compound_VL_VLtype(void) typedef struct { unsigned u; float f; - hvl_t v; + hvl_t v; } compVLVL_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ - hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing - a VL of VL of atomic datatype */ - hsize_t count; /* Number of records in the table */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t count; /* Number of records in the table */ compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ hvl_t *t1, *t2; - unsigned uu, vv, ww; /* Loop variables */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ + unsigned uu, vv, ww; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ - TESTING3(" with compound datatype containing vlen datatype"); + HL_TESTING3(" with compound datatype containing vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -336,15 +336,15 @@ static int test_compound_VL_VLtype(void) if (writeBuf[uu].v.p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) - { + { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + L2_INCM; for (ww = 0; ww < vv + L2_INCM; ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -354,58 +354,58 @@ static int test_compound_VL_VLtype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; /* Create a VL datatype of the VL of atomic datatype */ vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create the base compound type */ comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); if (comp_vlvl < 0) - goto error; + goto error; /* Insert fields: atomic, atomic, vlen */ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); if (ret < 0) - goto error; + goto error; /* Create a packet table that uses a compound datatype of vlen datatype */ ptable = H5PTcreate(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; if (H5Tclose(comp_vlvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -413,7 +413,7 @@ static int test_compound_VL_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { @@ -448,19 +448,19 @@ static int test_compound_VL_VLtype(void) /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -479,27 +479,27 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_VLof_VLtype(): Test that a packet table of VL datatype with VL - * datatypes of atomic datatypes can be created and written - * correctly. (HDFFV-442) + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_VLof_VLtype(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ - hsize_t count; /* Number of records in the table */ - hvl_t *t1; /* pointer to advance */ - unsigned uu, vv, ww; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen datatype of vlen datatype"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + unsigned uu, vv, ww; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen datatype of vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -510,12 +510,12 @@ static int test_VLof_VLtype(void) } /* end if */ writeBuf[uu].len = uu + 1; for (t1=(hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) - { + { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv * 1; for (ww = 0; ww < (vv * 1); ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -525,39 +525,39 @@ static int test_VLof_VLtype(void) /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of vlen datatype */ ptable = H5PTcreate(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -565,24 +565,24 @@ static int test_VLof_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -600,41 +600,41 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_ptlengthtype() - helper function, verifies that the named packet - * table is a fixed-length or variable-length as indicated by the last - * argument. + * table is a fixed-length or variable-length as indicated by the last + * argument. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value) { - hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ herr_t is_varlen = 0; herr_t ret = FAIL; /* Open the named packet table */ if( (ptable = H5PTopen(fid, table_name)) < 0) - goto error; + goto error; /* Verify the value returned from H5PTis_varlen is as expected */ is_varlen = H5PTis_varlen(ptable); if (is_varlen == FAIL) - goto error; + goto error; else if (is_varlen == expected_value) - ret = SUCCEED; + ret = SUCCEED; else { - char lenthtype[20]; - HDstrcpy(lenthtype, "fixed-length"); - if (expected_value == 1) - HDstrcpy(lenthtype, "variable-length"); - fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); - ret = FAIL; + char lenthtype[20]; + HDstrcpy(lenthtype, "fixed-length"); + if (expected_value == 1) + HDstrcpy(lenthtype, "variable-length"); + fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); + ret = FAIL; } /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return ret; @@ -645,71 +645,71 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_H5PTis_varlen(): Test that H5PTis_varlen works correctly on both - * fixed- and variable-length packet tables. + * fixed- and variable-length packet tables. * * Description: - * - Added a fixed-length packet table to the file for variety - * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen - * on each packet table. + * - Added a fixed-length packet table to the file for variety + * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen + * on each packet table. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_H5PTis_varlen(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - herr_t ret; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + herr_t ret; /* Returned status from a callee */ - TESTING("H5PTis_varlen"); + HL_TESTING2("H5PTis_varlen"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a new table */ ptable = H5PTcreate(fid, PT_FIXED_LEN, H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Open each packet table, and verify that H5PTis_varlen returns correct type for each table */ ret = verify_ptlengthtype(fid, PT_VLEN_ATOMIC, 1); /* vlen of atomic */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_VLEN_COMP, 1); /* vlen of compound */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_COMP_VLEN, 0); /* compound of vlen, no vlen */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_VLEN_VLEN, 1); /* vlen of vlen */ if (ret < 0) - goto error; + goto error; ret = verify_ptlengthtype(fid, PT_FIXED_LEN, 0); /* no vlen */ if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -722,11 +722,11 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * adding_attribute() - helper function, adds an attribute to the named - * packet table. + * packet table. * Note: - * For simplicity, the attributes that are added to the packet tables - * have the same characteristics except their names. They have the - * same type, space, and values. + * For simplicity, the attributes that are added to the packet tables + * have the same characteristics except their names. They have the + * same type, space, and values. * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -737,47 +737,47 @@ int attr_data[ATTR_DIM]={256,11945,-22107}; /* values to be written to attr */ static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name) { - hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ - hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */ - hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */ - hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */ - hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */ - int ret = FAIL; /* Returned status from a callee */ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */ + hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */ + hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */ + int ret = FAIL; /* Returned status from a callee */ /* Create dataspace for attribute */ space_id = H5Screate_simple(ATTR_RANK, dims, NULL); if (space_id < 0) - goto error; + goto error; /* Open the named packet table */ if( (ptable = H5PTopen(fid, table_name)) < 0) - goto error; + goto error; dset_id = H5PTget_dataset(ptable); if (dset_id < 0) - goto error; + goto error; /* Add the specified attribute to it */ attr_id = H5Acreate2(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); if (attr_id < 0) - goto error; + goto error; /* Write attribute values */ ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data); if (ret < 0) - goto error; + goto error; /* Close the attribute */ if (H5Aclose(attr_id) < 0) - goto error; + goto error; /* Close the dataspace */ if (H5Sclose(space_id) < 0) - goto error; + goto error; /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; @@ -790,39 +790,39 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_attribute() - helper function, verifies the named attribute can - * be read correctly. + * be read correctly. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static herr_t verify_attribute(hid_t fid, const char *table_name, const char *attr_name) { - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ - hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ - int read_data[ATTR_DIM]; /* Output buffer */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ + int read_data[ATTR_DIM]; /* Output buffer */ int ii; - herr_t ret = FAIL; /* Returned status from a callee */ + herr_t ret = FAIL; /* Returned status from a callee */ /* Open the named packet table */ ptable = H5PTopen(fid, table_name); if (ptable < 0) - goto error; + goto error; /* Get the dataset id of this packet table */ dset_id = H5PTget_dataset(ptable); if (dset_id < 0) - goto error; + goto error; /* Open first attribute for the dataset */ attr_id = H5Aopen(dset_id, attr_name, H5P_DEFAULT); if (attr_id < 0) - goto error; + goto error; /* Read attribute values */ ret = H5Aread(attr_id, H5T_NATIVE_INT, read_data); if (ret < 0) - goto error; + goto error; /* Verify values read in */ for (ii = 0; ii < ATTR_DIM; ii++) @@ -831,11 +831,11 @@ static herr_t verify_attribute(hid_t fid, const char *table_name, const char *at /* Close the attribute */ if (H5Aclose(attr_id) < 0) - goto error; + goto error; /* Close the packet table */ if (H5PTclose(ptable) < 0) - goto error; + goto error; return SUCCEED; @@ -849,58 +849,58 @@ error: /* An error has occurred. Clean up and exit. */ * test_attributes(): Test adding attributes to packet tables * * Description: - * Added attributes to some random packet tables in the file. + * Added attributes to some random packet tables in the file. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_attributes(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ - hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ - herr_t ret = FAIL; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ - TESTING("adding attributes to packet tables"); + HL_TESTING2("adding attributes to packet tables"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Add an arbitrary attribute to a few packet tables, using helper func */ attr_id = adding_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); if (attr_id < 0) - goto error; + goto error; attr_id = adding_attribute(fid, PT_VLEN_COMP, "Attribute 2"); if (attr_id < 0) - goto error; + goto error; attr_id = adding_attribute(fid, PT_COMP_VLEN, "Attribute 3"); if (attr_id < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; /* Open the file again */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Read each attribute and verify the values, using helper function */ ret = verify_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); if (ret < 0) - goto error; + goto error; ret = verify_attribute(fid, PT_VLEN_COMP, "Attribute 2"); if (ret < 0) - goto error; + goto error; ret = verify_attribute(fid, PT_COMP_VLEN, "Attribute 3"); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return(ret); @@ -913,17 +913,17 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * verify_accessors() - helper function, verifies that various info can be - * retrieved correctly using the info returned by the accessor functions. + * retrieved correctly using the info returned by the accessor functions. * * Description: - * Testing functions H5PTget_dataset and H5PTget_type + * Testing functions H5PTget_dataset and H5PTget_type * - * - Opens the named packet table - * - Gets its associated dataset ID then calls a C function on that ID - * to verify the dataset name - * - Gets its associated datatype ID then calls a C function on that ID - * to verify that the packet table is variable- or fixed-length as - * indicated by the expected_value argument + * - Opens the named packet table + * - Gets its associated dataset ID then calls a C function on that ID + * to verify the dataset name + * - Gets its associated datatype ID then calls a C function on that ID + * to verify that the packet table is variable- or fixed-length as + * indicated by the expected_value argument * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -990,18 +990,18 @@ error: /* An error has occurred. Clean up and exit. */ * test_accessors(): Test the accessor functions * * Description: - * Retrieves the dataset and datatype IDs and verifies various info - * to ensure these IDs are correct. + * Retrieves the dataset and datatype IDs and verifies various info + * to ensure these IDs are correct. * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int test_accessors(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ - herr_t ret = FAIL; /* Returned status from a callee */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ - TESTING("accessor functions"); + HL_TESTING2("accessor functions"); /* Open the file */ fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); @@ -1031,32 +1031,32 @@ error: /* An error has occurred. Clean up and exit. */ } /* test_accessors */ /************************************************************************** - Test set for deprecated function H5PTcreate_fl - Each test in this set is the same as the corresponding one in the - set for H5PTcreate, as of Mar 2016 + Test set for deprecated function H5PTcreate_fl + Each test in this set is the same as the corresponding one in the + set for H5PTcreate, as of Mar 2016 **************************************************************************/ /*------------------------------------------------------------------------- * testfl_VLof_atomic(): Test that a packet table with VL datatypes of atomic - * datatypes can be created and written correctly. (HDFFV-442) + * datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int testfl_VLof_atomic(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen of atomic"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen of atomic"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1064,42 +1064,42 @@ static int testfl_VLof_atomic(void) if (writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) - ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; + ((unsigned int *)writeBuf[uu].p)[vv] = uu * 10 + vv; } /* end for */ /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a vlen type that uses an atomic datatype as its base type */ vltype = H5Tvlen_create (H5T_NATIVE_UINT); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of an atomic type */ ptable = H5PTcreate_fl(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Close the vlen datatype */ if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1107,33 +1107,33 @@ static int testfl_VLof_atomic(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { - if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); - } + if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { + printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + } } /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf ); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1150,7 +1150,7 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_VLof_comptype(): Test that a packet table with VL datatypes of - * compound datatypes can be created and written correctly. (HDFFV-442) + * compound datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -1162,18 +1162,18 @@ static int testfl_VLof_comptype(void) unsigned u; float f; } VLcomp_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ - hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - hsize_t count; /* Number of records in the table */ - unsigned uu, vv; /* Loop variables */ - char msg[80]; /* For error message */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + unsigned uu, vv; /* Loop variables */ + char msg[80]; /* For error message */ herr_t ret; - TESTING3(" with vlen of compound datatypes"); + HL_TESTING3(" with vlen of compound datatypes"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1181,7 +1181,7 @@ static int testfl_VLof_comptype(void) if(writeBuf[uu].p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].len = uu + 1; for (vv = 0; vv < (uu + 1); vv++) { ((VLcomp_t *)writeBuf[uu].p)[vv].u = uu + vv; @@ -1192,48 +1192,48 @@ static int testfl_VLof_comptype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create the base compound type */ cmptype = H5Tcreate(H5T_COMPOUND, sizeof(VLcomp_t)); if (cmptype < 0) - goto error; + goto error; /* Insert fields */ ret = H5Tinsert(cmptype, "u", HOFFSET(VLcomp_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(cmptype, "f", HOFFSET(VLcomp_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; /* Create a variable length type that uses the VLcomp_t as its base type */ vltype = H5Tvlen_create(cmptype); if (vltype < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of compound datatype */ ptable = H5PTcreate_fl(fid, PT_VLEN_COMP, vltype, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release the datatypes */ if (H5Tclose(cmptype) < 0) - goto error; + goto error; if (H5Tclose(vltype) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1241,39 +1241,39 @@ static int testfl_VLof_comptype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); - continue; - } /* write len != read len */ + continue; + } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); continue; - } /* write value != read value */ - } + } /* write value != read value */ + } } /* end for */ /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1291,8 +1291,8 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_compound_VL_VL(): Test that a packet table of compound datatypes - * containing VL datatypes can be created and written - * correctly. (HDFFV-442) + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- @@ -1303,23 +1303,23 @@ static int testfl_compound_VL_VLtype(void) typedef struct { unsigned u; float f; - hvl_t v; + hvl_t v; } compVLVL_t; - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ - hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing - a VL of VL of atomic datatype */ - hsize_t count; /* Number of records in the table */ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t count; /* Number of records in the table */ compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ hvl_t *t1, *t2; - unsigned uu, vv, ww; /* Loop variables */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ + unsigned uu, vv, ww; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ - TESTING3(" with compound datatype containing vlen datatype"); + HL_TESTING3(" with compound datatype containing vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1329,15 +1329,15 @@ static int testfl_compound_VL_VLtype(void) if (writeBuf[uu].v.p == NULL) { fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; - } + } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) - { + { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + L2_INCM; for (ww = 0; ww < vv + L2_INCM; ww++) ((unsigned int*)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -1347,58 +1347,58 @@ static int testfl_compound_VL_VLtype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; /* Create a VL datatype of the VL of atomic datatype */ vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create the base compound type */ comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); if (comp_vlvl < 0) - goto error; + goto error; /* Insert fields: atomic, atomic, vlen */ ret = H5Tinsert(comp_vlvl, "u", HOFFSET(compVLVL_t, u), H5T_NATIVE_UINT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); if (ret < 0) - goto error; + goto error; ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); if (ret < 0) - goto error; + goto error; /* Create a packet table that uses a compound datatype of vlen datatype */ ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; if (H5Tclose(comp_vlvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1406,7 +1406,7 @@ static int testfl_compound_VL_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1441,19 +1441,19 @@ static int testfl_compound_VL_VLtype(void) /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1472,27 +1472,27 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * testfl_VLof_VLtype(): Test that a packet table of VL datatype with VL - * datatypes of atomic datatypes can be created and written - * correctly. (HDFFV-442) + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ static int testfl_VLof_VLtype(void) { - hid_t fid=H5I_INVALID_HID; /* Test file identifier */ - hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ - hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ - hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ - hsize_t count; /* Number of records in the table */ - hvl_t *t1; /* pointer to advance */ - unsigned uu, vv, ww; /* Loop variables */ - hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ - hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ - char msg[80]; /* For error message */ - herr_t ret; /* Returned status from a callee */ - - TESTING3(" with vlen datatype of vlen datatype"); + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + unsigned uu, vv, ww; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + HL_TESTING3(" with vlen datatype of vlen datatype"); /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { @@ -1503,12 +1503,12 @@ static int testfl_VLof_VLtype(void) } /* end if */ writeBuf[uu].len = uu + 1; for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) - { + { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); - if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); - goto error; - } + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + goto error; + } t1->len = vv + 1; for (ww = 0; ww < (vv + 1); ww++) ((unsigned int *)t1->p)[ww] = uu * 100 + vv * 10 + ww; @@ -1518,39 +1518,39 @@ static int testfl_VLof_VLtype(void) /* Open the file */ fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); if (fid < 0) - goto error; + goto error; /* Create a VL datatype of an atomic type */ vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); if (vlatomic < 0) - goto error; + goto error; vlofvl = H5Tvlen_create (vlatomic); if (vlofvl < 0) - goto error; + goto error; /* Create a packet table that uses a vlen datatype of vlen datatype */ ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) - goto error; + goto error; /* Release datatypes */ if (H5Tclose(vlatomic) < 0) - goto error; + goto error; if (H5Tclose(vlofvl) < 0) - goto error; + goto error; /* Write the entire buffer to the packet table */ ret = H5PTappend(ptable, (size_t)5, writeBuf ); if (ret < 0) - goto error; + goto error; /* Get the number of packets in the packet table, should be NRECORDS. */ ret = H5PTget_num_packets(ptable, &count); if (ret < 0) - goto error; + goto error; sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); @@ -1558,24 +1558,24 @@ static int testfl_VLof_VLtype(void) /* Read all five packets back */ ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); if (ret < 0) - goto error; + goto error; /* Free the buffers */ ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); if (ret < 0) - goto error; + goto error; ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); if (ret < 0) - goto error; + goto error; /* Close the packet table */ ret = H5PTclose(ptable); if (ret < 0) - goto error; + goto error; /* Close the file */ if (H5Fclose(fid) < 0) - goto error; + goto error; PASSED(); return SUCCEED; @@ -1593,25 +1593,25 @@ error: /* An error has occurred. Clean up and exit. */ /*------------------------------------------------------------------------- * test_packet_table_with_varlen(): Invokes individual tests to ensure that - * packet tables with variable length are created and written correctly - * without the specific VL PT functionality. (HDFFV-442) + * packet tables with variable length are created and written correctly + * without the specific VL PT functionality. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ int test_packet_table_with_varlen(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t fid=H5I_INVALID_HID; /* File identifier */ int status = SUCCEED; /* Create a file using default properties */ fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) - return FAIL; + return FAIL; /* Close the file. The file will be opened by each test function below */ if (H5Fclose(fid) < 0) - return FAIL; + return FAIL; HDputs("Testing packet table with various variable-length datatypes"); @@ -1620,46 +1620,46 @@ int test_packet_table_with_varlen(void) /* Test variable length of a simple type */ if (test_VLof_atomic() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a compound type */ if (test_VLof_comptype() < 0) - status = FAIL; + status = FAIL; /* Test compound type with variable length */ if (test_compound_VL_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (test_VLof_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (test_H5PTis_varlen() < 0) - status = FAIL; + status = FAIL; /* Test adding attributes to packet table */ if (test_attributes() < 0) - status = FAIL; + status = FAIL; /* Test accessor functions */ if (test_accessors() < 0) - status = FAIL; + status = FAIL; /************************************************************************** - Calling test functions for deprecated function H5PTcreate_fl - Mar 2016, -BMR + Calling test functions for deprecated function H5PTcreate_fl + Mar 2016, -BMR **************************************************************************/ /* Create a file using default properties */ fid = H5Fcreate(TESTFL_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fid < 0) - return FAIL; + return FAIL; /* Close the file. The file will be opened by each test function below */ if (H5Fclose(fid) < 0) - return FAIL; + return FAIL; HDputs("Testing packet table with various variable-length datatypes - H5PTcreate_fl"); @@ -1668,19 +1668,19 @@ int test_packet_table_with_varlen(void) /* Test variable length of a simple type */ if (testfl_VLof_atomic() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a compound type */ if (testfl_VLof_comptype() < 0) - status = FAIL; + status = FAIL; /* Test compound type with variable length */ if (testfl_compound_VL_VLtype() < 0) - status = FAIL; + status = FAIL; /* Test variable length of a variable length */ if (testfl_VLof_VLtype() < 0) - status = FAIL; + status = FAIL; return(status); } diff --git a/hl/test/test_table.c b/hl/test/test_table.c index e849175..1d6bcec 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -456,7 +456,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("making table"); + HL_TESTING2("making table"); if (H5TBmake_table(TITLE,fid,"table1",FIELDS,RECORDS,type_size_mem, field_names,field_offset,field_type, @@ -465,7 +465,7 @@ static int test_table(hid_t fid, int do_write) PASSED(); } - TESTING2("reading table"); + HL_TESTING2("reading table"); /*------------------------------------------------------------------------- * read the table @@ -495,7 +495,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing records"); + HL_TESTING2("writing records"); /* create an empty table */ if (H5TBmake_table(TITLE,fid,"table2",FIELDS,RECORDS,type_size_mem, @@ -538,7 +538,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("reading records"); + HL_TESTING2("reading records"); /*------------------------------------------------------------------------- * read records, start at 0, read 8 @@ -582,7 +582,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("appending records"); + HL_TESTING2("appending records"); /*------------------------------------------------------------------------- * append 2 records @@ -628,7 +628,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("inserting records"); + HL_TESTING2("inserting records"); /*------------------------------------------------------------------------- * insert 2 records @@ -688,7 +688,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("deleting records"); + HL_TESTING2("deleting records"); /*------------------------------------------------------------------------- * Create a table @@ -888,7 +888,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("deleting records (differing memory layout)"); + HL_TESTING2("deleting records (differing memory layout)"); dims = 3; arry3_32f = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, &dims); @@ -943,7 +943,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("adding records"); + HL_TESTING2("adding records"); /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table4",FIELDS,RECORDS,type_size_mem, @@ -1003,7 +1003,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("combining tables"); + HL_TESTING2("combining tables"); /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table6",FIELDS,RECORDS,type_size_mem, @@ -1098,7 +1098,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing fields by name"); + HL_TESTING2("writing fields by name"); /* make an empty table with fill values */ if (H5TBmake_table(TITLE,fid,"table9",FIELDS,RECORDS,type_size_mem, @@ -1161,7 +1161,7 @@ static int test_table(hid_t fid, int do_write) * *------------------------------------------------------------------------- */ - TESTING2("reading fields by name"); + HL_TESTING2("reading fields by name"); /*------------------------------------------------------------------------- * write and read the "Pressure" field @@ -1309,7 +1309,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("writing fields by index"); + HL_TESTING2("writing fields by index"); /* make an empty table */ if (H5TBmake_table(TITLE,fid,"table11",FIELDS,RECORDS,type_size_mem, @@ -1367,7 +1367,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("reading fields by index"); + HL_TESTING2("reading fields by index"); if (do_write) { @@ -1518,7 +1518,7 @@ static int test_table(hid_t fid, int do_write) if (do_write) { - TESTING2("inserting fields"); + HL_TESTING2("inserting fields"); /* make a table */ if (H5TBmake_table(TITLE,fid,"table13",FIELDS,RECORDS,type_size_mem, @@ -1561,7 +1561,7 @@ static int test_table(hid_t fid, int do_write) */ if (do_write) { - TESTING2("deleting fields"); + HL_TESTING2("deleting fields"); /* make a table */ if (H5TBmake_table(TITLE,fid,"table14",FIELDS,RECORDS,type_size_mem, @@ -1601,7 +1601,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("getting table info"); + HL_TESTING2("getting table info"); /* get table info */ if ( H5TBget_table_info (fid, "table1", &rfields, &rrecords ) < 0 ) @@ -1622,7 +1622,7 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ - TESTING2("getting field info"); + HL_TESTING2("getting field info"); /* alocate */ names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS ); diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index 8c8316d..b349269 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -539,7 +539,7 @@ done: int main(void) { - HDHDfprintf(stderr, "Non-POSIX platform. Skipping.\n"); + HDfprintf(stderr, "Non-POSIX platform. Skipping.\n"); return EXIT_SUCCESS; } /* end main() */ -- cgit v0.12 From 2bce24576ed39aa351f82efca9eb6d9ce8f18300 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 17 Aug 2019 13:33:41 -0500 Subject: This test cannot use HD prefix macro with printf of fprintf --- hl/c++/test/ptableTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index d0b2c39..e873503 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -31,7 +31,7 @@ int main(void) fileID = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(fileID <0) { - HDfprintf(stderr, "Couldn't create file.\n"); + fprintf(stderr, "Couldn't create file.\n"); num_errors = 1; } else { @@ -57,7 +57,7 @@ int main(void) err = H5Fclose(fileID); if( err < 0 ) { - HDfprintf(stderr, "Failed to close file.\n"); + fprintf(stderr, "Failed to close file.\n"); num_errors++; } -- cgit v0.12 From 9081fb266cc15198e0c75a77f23f2b252c6ee79f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 18 Aug 2019 11:33:45 -0500 Subject: Add missing HD prefix --- test/mf.c | 242 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/test/mf.c b/test/mf.c index 2d24f6e..05b108b 100644 --- a/test/mf.c +++ b/test/mf.c @@ -321,8 +321,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return(0); @@ -463,8 +463,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation: test 2"); @@ -511,8 +511,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ @@ -555,8 +555,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation: test 4"); @@ -603,8 +603,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); @@ -612,7 +612,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_eoa_shrink() */ @@ -741,8 +741,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of file allocation: test 2"); @@ -804,8 +804,8 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); @@ -813,7 +813,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_eoa_extend() */ @@ -1002,15 +1002,15 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + SKIPPED(); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_tmp() */ @@ -1088,7 +1088,7 @@ test_mf_fs_start(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1100,7 +1100,7 @@ test_mf_fs_start(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_start() */ @@ -1206,7 +1206,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify that the allocated block is section A in free-space */ if(addr != TBLOCK_ADDR70) - TEST_ERROR + TEST_ERROR state.tot_space -= TBLOCK_SIZE30; state.tot_sect_count -= 1; @@ -1240,7 +1240,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1283,7 +1283,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify that the allocated block is section A in free-space manager */ if(addr != TBLOCK_ADDR70) - TEST_ERROR + TEST_ERROR /* should still have 1 section of size 10 left in free-space manager */ state.tot_space -= (TBLOCK_SIZE20); @@ -1315,7 +1315,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1400,7 +1400,7 @@ test_mf_fs_alloc_free(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1412,7 +1412,7 @@ test_mf_fs_alloc_free(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_alloc_free() */ @@ -1559,7 +1559,7 @@ test_mf_fs_extend(hid_t fapl) /* should succeed */ if(was_extended <= 0) - TEST_ERROR + TEST_ERROR /* Section B is removed from free-space manager */ state.tot_space -= TBLOCK_SIZE50; @@ -1596,7 +1596,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1667,7 +1667,7 @@ test_mf_fs_extend(hid_t fapl) /* Should not be able to extend the allocated block */ if(was_extended) - TEST_ERROR + TEST_ERROR /* free-space info should remain the same */ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state)) @@ -1698,7 +1698,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1769,7 +1769,7 @@ test_mf_fs_extend(hid_t fapl) /* Should succeed in extending the allocated block */ if(was_extended <=0) - TEST_ERROR + TEST_ERROR /* Should have 1 section of size=10 left in free-space manager */ state.tot_space -= (TBLOCK_SIZE40); @@ -1800,7 +1800,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if (new_file_size != file_size) - TEST_ERROR + TEST_ERROR PASSED() @@ -1871,7 +1871,7 @@ test_mf_fs_extend(hid_t fapl) /* Should not succeed in extending the allocated block */ if(was_extended) - TEST_ERROR + TEST_ERROR /* Free-space info should be the same */ if(check_stats(f, f->shared->fs_man[H5FD_MEM_SUPER], &state)) @@ -1906,7 +1906,7 @@ test_mf_fs_extend(hid_t fapl) /* Verify the file is the correct size */ if(new_file_size != file_size) - TEST_ERROR + TEST_ERROR if(H5Pclose(fapl_new) < 0) FAIL_STACK_ERROR @@ -1918,7 +1918,7 @@ test_mf_fs_extend(hid_t fapl) error: H5E_BEGIN_TRY { H5Pclose(fapl_new); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_extend() */ @@ -2026,8 +2026,8 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("A free-space section absorbs an aggregator: test 2"); @@ -2087,15 +2087,15 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_fs_absorb() */ @@ -2229,15 +2229,15 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); } H5E_END_TRY; return(1); @@ -2371,15 +2371,15 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc2() */ @@ -2531,15 +2531,15 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc3() */ @@ -2698,15 +2698,15 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc4() */ @@ -2821,15 +2821,15 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc5() */ @@ -2977,15 +2977,15 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc6() */ @@ -3161,15 +3161,15 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_alloc7() */ @@ -3315,8 +3315,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 2"); @@ -3385,8 +3385,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_extend() of meta/sdata aggregator: test 3"); @@ -3453,15 +3453,15 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_aggr_extend() */ @@ -3562,8 +3562,8 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 2"); @@ -3621,8 +3621,8 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ TESTING("H5MF_try_shrink() of meta/sdata aggregator: test 3"); @@ -3683,8 +3683,8 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support metadata aggregator"); + SKIPPED(); + HDputs(" Current VFD doesn't support metadata aggregator"); } /* end else */ return(0); @@ -3850,8 +3850,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ TESTING("H5MF_try_shrink() of file allocation with alignment: test 2"); @@ -3905,8 +3905,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ TESTING("H5MF_try_extend() of file allocation with alignment: test 3"); @@ -3961,15 +3961,15 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_eoa() */ @@ -4248,15 +4248,15 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_fs() */ @@ -4518,15 +4518,15 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc1() */ @@ -4804,15 +4804,15 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc2() */ @@ -5180,15 +5180,15 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc3() */ @@ -5389,15 +5389,15 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc4() */ @@ -5612,15 +5612,15 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) PASSED() } /* end if */ else { - SKIPPED(); - puts(" Current VFD doesn't support mis-aligned fragments"); + SKIPPED(); + HDputs(" Current VFD doesn't support mis-aligned fragments"); } /* end else */ return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_align_alloc5() */ @@ -6136,18 +6136,18 @@ test_mf_fs_persist_split(void) if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Set up split driver */ if(H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT)<0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* File creation property list template */ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); @@ -6312,7 +6312,7 @@ test_mf_fs_persist_split(void) /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */ if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE3))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(tmp_addr != addr3) TEST_ERROR @@ -6882,14 +6882,14 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } else { SKIPPED(); - puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); + HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); } return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); H5Pclose(fapl2); } H5E_END_TRY; @@ -7066,14 +7066,14 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } else { SKIPPED(); - puts(" Current VFD doesn't support persistent free-space manager"); + HDputs(" Current VFD doesn't support persistent free-space manager"); } return(0); error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); H5Pclose(fcpl); H5Pclose(fapl2); } H5E_END_TRY; @@ -7243,7 +7243,7 @@ error: H5E_BEGIN_TRY { H5Pclose(fcpl); H5Pclose(fapl2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_strat_thres_persist() */ @@ -7429,7 +7429,7 @@ error: H5E_BEGIN_TRY { H5Pclose(fcpl); H5Pclose(fapl2); - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_mf_strat_thres_gone() */ @@ -7516,7 +7516,7 @@ test_dichotomy(hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(file); } H5E_END_TRY; return(1); } /* test_dichotomy() */ @@ -7770,7 +7770,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); + HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); } return(0); @@ -7894,7 +7894,7 @@ test_page_try_shrink(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support paged aggregation"); + HDputs(" Current VFD doesn't support paged aggregation"); } return(0); @@ -8049,7 +8049,7 @@ test_page_small_try_extend(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support paged aggregation"); + HDputs(" Current VFD doesn't support paged aggregation"); } return(0); @@ -8190,7 +8190,7 @@ test_page_large_try_extend(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support paged aggregation strategy"); + HDputs(" Current VFD doesn't support paged aggregation strategy"); } return(0); @@ -8343,7 +8343,7 @@ test_page_large(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support paged aggregation strategy"); + HDputs(" Current VFD doesn't support paged aggregation strategy"); } return(0); @@ -8506,7 +8506,7 @@ test_page_small(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support paged aggregation strategy"); + HDputs(" Current VFD doesn't support paged aggregation strategy"); } return(0); @@ -8812,7 +8812,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) } else { SKIPPED(); - puts(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); + HDputs(" Current VFD doesn't support persisting free-space or paged aggregation strategy"); } return(0); @@ -8969,12 +8969,12 @@ main(void) if(nerrors) goto error; - puts("All free-space manager tests for file memory passed."); + HDputs("All free-space manager tests for file memory passed."); return(0); error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); H5Pclose(new_fapl); -- cgit v0.12 From 935f27c1b803faf981131ff936619aecd9f76e38 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 19 Aug 2019 11:58:44 -0500 Subject: HDFFV-10887 Implement requested functions --- java/src/hdf/hdf5lib/H5.java | 7 ++-- java/src/jni/h5oImp.c | 60 +++++++++++++++++++++++++++++ java/src/jni/h5oImp.h | 27 +++++++++++++ java/test/TestH5Ocreate.java | 53 +++++++++++++++++++++++++ java/test/TestH5Oparams.java | 15 ++++++++ java/test/testfiles/JUnit-TestH5Ocreate.txt | 3 +- java/test/testfiles/JUnit-TestH5Oparams.txt | 5 ++- 7 files changed, 164 insertions(+), 6 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 481ca8c..4b563fd 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -5048,10 +5048,9 @@ public class H5 implements java.io.Serializable { **/ public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; - // /////// unimplemented //////// - // herr_t H5Odisable_mdc_flushes(hid_t object_id); - // herr_t H5Oenable_mdc_flushes(hid_t object_id); - // herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); + public synchronized static native void H5Odisable_mdc_flushes(long object_id); + public synchronized static native void H5Oenable_mdc_flushes(long object_id); + public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id); // //////////////////////////////////////////////////////////// // // diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c index cc88b81..b49a3e9 100644 --- a/java/src/jni/h5oImp.c +++ b/java/src/jni/h5oImp.c @@ -856,6 +856,66 @@ done: return; } /* end Java_hdf_hdf5lib_H5_H5Orefresh */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odisable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes + (JNIEnv *env, jclass clss, jlong loc_id) +{ + UNUSED(clss); + + if (H5Odisable_mdc_flushes((hid_t)loc_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oenable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes + (JNIEnv *env, jclass clss, jlong loc_id) +{ + UNUSED(clss); + + if (H5Oenable_mdc_flushes((hid_t)loc_id) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + return; +} /* end Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oare_mdc_flushes_disabled + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled + (JNIEnv *env, jclass clss, jlong loc_id) +{ + jboolean bval = JNI_FALSE; + hbool_t is_disabled = FALSE; + + UNUSED(clss); + + if (H5Oare_mdc_flushes_disabled((hid_t)loc_id, &is_disabled) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (is_disabled == TRUE) + bval = JNI_TRUE; + +done: + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled */ + #ifdef __cplusplus diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h index cb8c776..5241aba 100644 --- a/java/src/jni/h5oImp.h +++ b/java/src/jni/h5oImp.h @@ -202,6 +202,33 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Orefresh (JNIEnv*, jclass, jlong); +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odisable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odisable_1mdc_1flushes + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oenable_mdc_flushes + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oenable_1mdc_1flushes + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oare_mdc_flushes_disabled + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oare_1mdc_1flushes_1disabled + (JNIEnv*, jclass, jlong); + #ifdef __cplusplus } /* end extern "C" */ #endif /* __cplusplus */ diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index c3e36b4..de17d8b 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -557,4 +557,57 @@ public class TestH5Ocreate { } } + @Test + public void testH5Ocork() { + boolean corked = false; + + // Check cork status of the group: not corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertFalse("H5Oare_mdc_flushes_disabled: ", corked); + + // Cork the group: an object + try { + H5.H5Odisable_mdc_flushes(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Odisable_mdc_flushes: " + err); + } + + // Check cork status of the group: corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertTrue("H5Oare_mdc_flushes_disabled: ", corked); + + // Unork the group: an object + try { + H5.H5Oenable_mdc_flushes(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oenable_mdc_flushes: " + err); + } + + // Check cork status of the group: corked + try { + corked = H5.H5Oare_mdc_flushes_disabled(H5gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ocork: H5.H5Oare_mdc_flushes_disabled: " + err); + } + assertFalse("H5Oare_mdc_flushes_disabled: ", corked); + } + } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index d340ee7..cac3dcd 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -159,4 +159,19 @@ public class TestH5Oparams { H5.H5Orefresh(-1); } + @Test(expected = HDF5LibraryException.class) + public void testH5Odisable_mdc_flushes() throws Throwable { + H5.H5Odisable_mdc_flushes(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oenable_mdc_flushes() throws Throwable { + H5.H5Oenable_mdc_flushes(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oare_mdc_flushes_disabled() throws Throwable { + H5.H5Oare_mdc_flushes_disabled(-1); + } + } diff --git a/java/test/testfiles/JUnit-TestH5Ocreate.txt b/java/test/testfiles/JUnit-TestH5Ocreate.txt index c2365e5..5bc9e07 100644 --- a/java/test/testfiles/JUnit-TestH5Ocreate.txt +++ b/java/test/testfiles/JUnit-TestH5Ocreate.txt @@ -4,6 +4,7 @@ JUnit version 4.11 .testH5Oget_info_softlink .testH5Oget_info_externallink .testH5Ocopy +.testH5Ocork .testH5Olink .testH5Ocomment_by_name .testH5Oget_info_by_idx_n1_create @@ -17,5 +18,5 @@ JUnit version 4.11 Time: XXXX -OK (15 tests) +OK (16 tests) diff --git a/java/test/testfiles/JUnit-TestH5Oparams.txt b/java/test/testfiles/JUnit-TestH5Oparams.txt index 94220b9..bc23695 100644 --- a/java/test/testfiles/JUnit-TestH5Oparams.txt +++ b/java/test/testfiles/JUnit-TestH5Oparams.txt @@ -3,8 +3,10 @@ JUnit version 4.11 .testH5Ovisit_by_name_nullname .testH5Oget_info_invalid .testH5Ovisit_by_name_null +.testH5Odisable_mdc_flushes .testH5Oget_comment_invalid .testH5Oset_comment_by_name_invalid +.testH5Oare_mdc_flushes_disabled .testH5Oopen_null .testH5Oclose_invalid .testH5Oflush_invalid @@ -22,9 +24,10 @@ JUnit version 4.11 .testH5Ocopy_null_current .testH5Oset_comment_invalid .testH5Oopen_invalid +.testH5Oenable_mdc_flushes .testH5Ovisit_null Time: XXXX -OK (24 tests) +OK (27 tests) -- cgit v0.12 From 92f103cfd4b19b61a0ddf6e62e1692d2b3eeb4d9 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 19 Aug 2019 12:03:44 -0500 Subject: Add H5_DLL to all s3comms function prototypes to stop Windows unresolved external symbols errors. HDFFV-10889. --- src/H5FDs3comms.h | 88 +++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 16f6a8b..86fd741 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -538,19 +538,19 @@ typedef struct { * DECLARATION OF HTTP FIELD LIST ROUTINES * *******************************************/ -herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, - const char *name, - const char *value); +H5_DLL herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, + const char *name, + const char *value); /*********************************************** * DECLARATION OF HTTP REQUEST BUFFER ROUTINES * ***********************************************/ -herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf); +H5_DLL herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf); -hrb_t * H5FD_s3comms_hrb_init_request(const char *verb, - const char *resource, - const char *host); +H5_DLL hrb_t * H5FD_s3comms_hrb_init_request(const char *verb, + const char *resource, + const char *host); /************************************* * DECLARATION OF S3REQUEST ROUTINES * @@ -576,60 +576,60 @@ H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, H5_DLL struct tm * gmnow(void); -herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, - int cr_size, - char *signed_headers_dest, - int sh_size, - hrb_t *http_request); +H5_DLL herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, + int cr_size, + char *signed_headers_dest, + int sh_size, + hrb_t *http_request); H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest, - const unsigned char *msg, - size_t msg_len, - hbool_t lowercase); + const unsigned char *msg, + size_t msg_len, + hbool_t lowercase); -herr_t H5FD_s3comms_free_purl(parsed_url_t *purl); +H5_DLL herr_t H5FD_s3comms_free_purl(parsed_url_t *purl); -herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, - size_t key_len, - const char *msg, - size_t msg_len, - char *dest); +H5_DLL herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, + size_t key_len, + const char *msg, + size_t msg_len, + char *dest); -herr_t H5FD_s3comms_load_aws_profile(const char *name, - char *key_id_out, - char *secret_access_key_out, - char *aws_region_out); +H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name, + char *key_id_out, + char *secret_access_key_out, + char *aws_region_out); -herr_t H5FD_s3comms_nlowercase(char *dest, - const char *s, - size_t len); +H5_DLL herr_t H5FD_s3comms_nlowercase(char *dest, + const char *s, + size_t len); -herr_t H5FD_s3comms_parse_url(const char *str, - parsed_url_t **purl); +H5_DLL herr_t H5FD_s3comms_parse_url(const char *str, + parsed_url_t **purl); -herr_t H5FD_s3comms_percent_encode_char(char *repr, - const unsigned char c, - size_t *repr_len); +H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr, + const unsigned char c, + size_t *repr_len); H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *region, const char *iso8601now); -herr_t H5FD_s3comms_tostringtosign(char *dest, - const char *req_str, - const char *now, - const char *region); +H5_DLL herr_t H5FD_s3comms_tostringtosign(char *dest, + const char *req_str, + const char *now, + const char *region); H5_DLL herr_t H5FD_s3comms_trim(char *dest, - char *s, - size_t s_len, - size_t *n_written); + char *s, + size_t s_len, + size_t *n_written); H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, - const char *s, - size_t s_len, - hbool_t encode_slash, - size_t *n_written); + const char *s, + size_t s_len, + hbool_t encode_slash, + size_t *n_written); -- cgit v0.12 From 85a56a9c4f9629bb92b4b16a1dada30ae30b5b21 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 17:47:28 -0500 Subject: Partial H5F__accum_* routines. --- src/H5Faccum.c | 53 +++++++++++++++++++++++++---------------------------- src/H5Fint.c | 6 +++--- src/H5Fio.c | 2 +- src/H5Fpkg.h | 6 +++--- src/H5Fprivate.h | 1 + src/H5PB.c | 2 +- test/accum.c | 4 ++-- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 8d7852b..c2f6732 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -419,7 +419,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, const void *buf) { H5FD_t *file; /* File driver pointer */ @@ -428,19 +428,19 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + HDassert(f_sh); + HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); HDassert(buf); /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Check for accumulating metadata */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ @@ -732,9 +732,9 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ else { /* Make certain that data in accumulator is visible before new write */ - if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) > 0) + if((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0) /* Flush if dirty and reset accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f_sh, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Write the data */ @@ -783,7 +783,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ else { /* Access covers whole accumulator */ /* Reset accumulator, but don't flush */ - if(H5F__accum_reset(f, FALSE) < 0) + if(H5F__accum_reset(f_sh, FALSE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") } /* end else */ } /* end if */ @@ -1013,28 +1013,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_flush(H5F_t *f) +H5F__accum_flush(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* Check if we need to flush out the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f->shared->accum.dirty) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f_sh->accum.dirty) { H5FD_t *file; /* File driver pointer */ /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Flush the metadata contents */ - if(H5FD_write(file, H5FD_MEM_DEFAULT, f->shared->accum.loc + f->shared->accum.dirty_off, f->shared->accum.dirty_len, f->shared->accum.buf + f->shared->accum.dirty_off) < 0) + if(H5FD_write(file, H5FD_MEM_DEFAULT, f_sh->accum.loc + f_sh->accum.dirty_off, f_sh->accum.dirty_len, f_sh->accum.buf + f_sh->accum.dirty_off) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") /* Reset the dirty flag */ - f->shared->accum.dirty = FALSE; + f_sh->accum.dirty = FALSE; } /* end if */ done: @@ -1056,34 +1056,31 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_reset(H5F_t *f, hbool_t flush) +H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* Flush any dirty data in accumulator, if requested */ if(flush) - if(H5F__accum_flush(f) < 0) + if(H5F__accum_flush(f_sh) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") /* Check if we need to reset the metadata accumulator information */ - if(f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { - /* Sanity check */ - HDassert(!f->closing || FALSE == f->shared->accum.dirty); - + if(f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { /* Free the buffer */ - if(f->shared->accum.buf) - f->shared->accum.buf = H5FL_BLK_FREE(meta_accum, f->shared->accum.buf); + if(f_sh->accum.buf) + f_sh->accum.buf = H5FL_BLK_FREE(meta_accum, f_sh->accum.buf); /* Reset the buffer sizes & location */ - f->shared->accum.alloc_size = f->shared->accum.size = 0; - f->shared->accum.loc = HADDR_UNDEF; - f->shared->accum.dirty = FALSE; - f->shared->accum.dirty_len = 0; + f_sh->accum.alloc_size = f_sh->accum.size = 0; + f_sh->accum.loc = HADDR_UNDEF; + f_sh->accum.dirty = FALSE; + f_sh->accum.dirty_len = 0; } /* end if */ done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 29f017e..afedeb9 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1346,7 +1346,7 @@ H5F__dest(H5F_t *f, hbool_t flush) } /* end if */ /* Destroy other components of the file */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") if(H5FO_dest(f) < 0) @@ -1905,7 +1905,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) #endif /* H5_HAVE_PARALLEL */ /* Flush out the metadata accumulator */ - if(H5F__accum_flush(f) < 0) + if(H5F__accum_flush(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") @@ -3416,7 +3416,7 @@ H5F__start_swmr_write(H5F_t *f) } /* end if */ /* Flush and reset the accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Turn on SWMR write in shared file open flags */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 69e6bb2..402db36 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -192,7 +192,7 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") /* Flush and reset the accumulator */ - if(H5F__accum_reset(f, TRUE) < 0) + if(H5F__accum_reset(f->shared, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") /* Flush file buffers to disk. */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index dbf68c3..7af08a2 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -430,10 +430,10 @@ H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_cre /* Metadata accumulator routines */ H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); -H5_DLL herr_t H5F__accum_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL herr_t H5F__accum_flush(H5F_t *f); -H5_DLL herr_t H5F__accum_reset(H5F_t *f, hbool_t flush); +H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); +H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); /* Shared file list related routines */ H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 838fa28..a551495 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -278,6 +278,7 @@ typedef struct H5F_t H5F_t; #ifdef H5F_MODULE #define H5F_LOW_BOUND(F) ((F)->shared->low_bound) #define H5F_HIGH_BOUND(F) ((F)->shared->high_bound) +#define H5F_SHARED_INTENT(F_SH) ((F_SH)->flags) #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) diff --git a/src/H5PB.c b/src/H5PB.c index 25c5f43..088e25d 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -1025,7 +1025,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * buffering. */ if(NULL == page_buf || size >= page_buf->page_size || bypass_pb) { - if(H5F__accum_write(f, type, addr, size, buf) < 0) + if(H5F__accum_write(f->shared, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") /* Update statistics */ diff --git a/test/accum.c b/test/accum.c index da90995..a5ef9e6 100644 --- a/test/accum.c +++ b/test/accum.c @@ -67,8 +67,8 @@ void accum_printf(const H5F_t *f); #define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_free(f,a,s) H5F__accum_free(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) -#define accum_flush(f) H5F__accum_flush(f) -#define accum_reset(f) H5F__accum_reset(f, TRUE) +#define accum_flush(f) H5F__accum_flush(f->shared) +#define accum_reset(f) H5F__accum_reset(f->shared, TRUE) /* ================= */ /* Main Test Routine */ -- cgit v0.12 From df36318b5f338d469db0086151d86601236e922a Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 18:00:05 -0500 Subject: Rest of changes for 'top' file pointer to 'shared' file pointer for H5F__accum routines. --- src/H5Faccum.c | 20 ++++++++++---------- src/H5Fpkg.h | 4 ++-- src/H5MF.c | 5 ++--- src/H5PB.c | 2 +- test/accum.c | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/H5Faccum.c b/src/H5Faccum.c index c2f6732..c2724b1 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -111,7 +111,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); *------------------------------------------------------------------------- */ herr_t -H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_t *file; /* File driver pointer */ @@ -120,18 +120,18 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); + HDassert(f_sh); HDassert(buf); /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Check if this information is in the metadata accumulator */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; if(size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ @@ -847,7 +847,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, +H5F__accum_free(H5F_file_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, hsize_t size) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ @@ -857,16 +857,16 @@ H5F__accum_free(H5F_t *f, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); + HDassert(f_sh); /* Set up alias for file's metadata accumulator info */ - accum = &f->shared->accum; + accum = &f_sh->accum; /* Translate to file driver pointer */ - file = f->shared->lf; + file = f_sh->lf; /* Adjust the metadata accumulator to remove the freed block, if it overlaps */ - if((f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) + if((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && H5F_addr_overlap(addr, size, accum->loc, accum->size)) { size_t overlap_size; /* Size of overlap with accumulator */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7af08a2..7e7eca3 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -429,9 +429,9 @@ H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL herr_t H5F__accum_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); +H5_DLL herr_t H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5F__accum_free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); +H5_DLL herr_t H5F__accum_free(H5F_file_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); diff --git a/src/H5MF.c b/src/H5MF.c index 3d9ddb0..e91fa14 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1133,11 +1133,10 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN /* If it's metadata, check if the space to free intersects with the file's * metadata accumulator */ - if(H5FD_MEM_DRAW != alloc_type) { + if(H5FD_MEM_DRAW != alloc_type) /* Check if the space to free intersects with the file's metadata accumulator */ - if(H5F__accum_free(f, alloc_type, addr, size) < 0) + if(H5F__accum_free(f->shared, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't check free space intersection w/metadata accumulator") - } /* end if */ /* Check if the free space manager for the file has been initialized */ if(!f->shared->fs_man[fs_type]) { diff --git a/src/H5PB.c b/src/H5PB.c index 088e25d..6acc0cc 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -729,7 +729,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ */ if(NULL == page_buf || size >= page_buf->page_size || (bypass_pb && H5FD_MEM_DRAW == type)) { - if(H5F__accum_read(f, type, addr, size, buf) < 0) + if(H5F__accum_read(f->shared, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed") /* Update statistics */ diff --git a/test/accum.c b/test/accum.c index a5ef9e6..91acf0f 100644 --- a/test/accum.c +++ b/test/accum.c @@ -66,7 +66,7 @@ void accum_printf(const H5F_t *f); /* Private Test H5Faccum Function Wrappers */ #define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) #define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), (b)) -#define accum_free(f,a,s) H5F__accum_free(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) +#define accum_free(f,a,s) H5F__accum_free(f->shared, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) #define accum_flush(f) H5F__accum_flush(f->shared) #define accum_reset(f) H5F__accum_reset(f->shared, TRUE) -- cgit v0.12 From f285c76ef25366e889d25ac8c223c91c080cf3b7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 19 Aug 2019 18:48:06 -0500 Subject: First pass of converting H5PB_* routines to use shared file pointers. --- src/H5Fint.c | 2 +- src/H5Fio.c | 2 +- src/H5Fmpi.c | 32 +++++++++++++++++++++ src/H5Fprivate.h | 7 +++++ src/H5Fquery.c | 69 +++++++++++++++++++++++++++++++++++++++++++++ src/H5PB.c | 83 +++++++++++++++++++++++++------------------------------ src/H5PBprivate.h | 4 +-- testpar/t_file.c | 2 +- 8 files changed, 151 insertions(+), 50 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index afedeb9..1c67cea 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1910,7 +1910,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") /* Flush the page buffer */ - if(H5PB_flush(f) < 0) + if(H5PB_flush(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed") diff --git a/src/H5Fio.c b/src/H5Fio.c index 402db36..63b033f 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -159,7 +159,7 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_write(f, map_type, addr, size, buf) < 0) + if(H5PB_write(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") done: diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 12bcbc0..56f9547 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -170,6 +170,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_mpi_get_size + * + * Purpose: Retrieves the size of an MPI process. + * + * Return: Success: The size (positive) + * + * Failure: Negative + * + * Programmer: John Mainzer + * Friday, May 6, 2005 + * + *------------------------------------------------------------------------- + */ +int +H5F_shared_mpi_get_size(const H5F_file_t *f_sh) +{ + int ret_value = -1; + + FUNC_ENTER_NOAPI((-1)) + + HDassert(f_sh); + + /* Dispatch to driver */ + if((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_mpi_get_size() */ + + +/*------------------------------------------------------------------------- * Function: H5F_mpi_get_size * * Purpose: Retrieves the size of an MPI process. diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index a551495..cd38202 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -294,6 +294,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_READ_ATTEMPTS(F) ((F)->shared->read_attempts) #define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id) #define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno) +#define H5F_SHARED_HAS_FEATURE(F_SH,FL) ((F_SH)->lf->feature_flags & (FL)) #define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL)) #define H5F_BASE_ADDR(F) ((F)->shared->sblock->base_addr) #define H5F_SYM_LEAF_K(F) ((F)->shared->sblock->sym_leaf_k) @@ -337,6 +338,7 @@ typedef struct H5F_t H5F_t; #else /* H5F_MODULE */ #define H5F_LOW_BOUND(F) (H5F_get_low_bound(F)) #define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F)) +#define H5F_SHARED_INTENT(F_SH) (H5F_shared_get_intent(F_SH)) #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) #define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F)) @@ -352,6 +354,7 @@ typedef struct H5F_t H5F_t; #define H5F_GET_READ_ATTEMPTS(F) (H5F_get_read_attempts(F)) #define H5F_DRIVER_ID(F) (H5F_get_driver_id(F)) #define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM))) +#define H5F_SHARED_HAS_FEATURE(F_SH,FL) (H5F_shared_has_feature(F_SH,FL)) #define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL)) #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) @@ -724,6 +727,7 @@ H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f); +H5_DLL unsigned H5F_shared_get_intent(const H5F_file_t *f); H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL char *H5F_get_open_name(const H5F_t *f); H5_DLL char *H5F_get_actual_name(const H5F_t *f); @@ -787,7 +791,9 @@ H5_DLL char *H5F_mdc_log_location(const H5F_t *f); /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); +H5_DLL hbool_t H5F_shared_has_feature(const H5F_file_t *f, unsigned feature); H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); +H5_DLL haddr_t H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); @@ -838,6 +844,7 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); +H5_DLL int H5F_shared_mpi_get_size(const H5F_file_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index c168535..5b5f748 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -75,6 +75,28 @@ /*------------------------------------------------------------------------- + * Function: H5F_shared_get_intent + * + * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags + * (Mainly added to stop non-file routines from poking about in the + * H5F_file_t data structure) + * + * Return: 'intent' on success/abort on failure (shouldn't fail) + *------------------------------------------------------------------------- + */ +unsigned +H5F_shared_get_intent(const H5F_file_t *f_sh) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + + FUNC_LEAVE_NOAPI(f_sh->flags) +} /* end H5F_shared_get_intent() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_intent * * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags @@ -827,6 +849,27 @@ H5F_store_msg_crt_idx(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_shared_has_feature + * + * Purpose: Check if a file has a particular feature enabled + * + * Return: Success: Non-negative - TRUE or FALSE + * Failure: Negative (should not happen) + *------------------------------------------------------------------------- + */ +hbool_t +H5F_shared_has_feature(const H5F_file_t *f_sh, unsigned feature) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f_sh); + + FUNC_LEAVE_NOAPI((hbool_t)(f_sh->lf->feature_flags & feature)) +} /* end H5F_shared_has_feature() */ + + +/*------------------------------------------------------------------------- * Function: H5F_has_feature * * Purpose: Check if a file has a particular feature enabled @@ -904,6 +947,32 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_get_eoa + * + * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value + * + * Return: Non-negative on success/Negative on failure + *------------------------------------------------------------------------- + */ +haddr_t +H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type) +{ + haddr_t ret_value = HADDR_UNDEF; /* Return value */ + + FUNC_ENTER_NOAPI(HADDR_UNDEF) + + HDassert(f_sh); + + /* Dispatch to driver */ + if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type))) + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_get_eoa() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_eoa * * Purpose: Quick and dirty routine to retrieve the file's 'eoa' value diff --git a/src/H5PB.c b/src/H5PB.c index 6acc0cc..89f80dd 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -124,8 +124,8 @@ typedef struct { /* Local Prototypes */ /********************/ static herr_t H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry); -static htri_t H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type); -static herr_t H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry); +static htri_t H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); +static herr_t H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry); /*********************/ @@ -370,18 +370,18 @@ static herr_t H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) { H5PB_entry_t *page_entry = (H5PB_entry_t *)item; /* Pointer to page entry node */ - H5F_t *f = (H5F_t *)_op_data; + H5F_file_t *f_sh = (H5F_file_t *)_op_data; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Sanity checks */ HDassert(page_entry); - HDassert(f); + HDassert(f_sh); /* Flush the page if it's dirty */ if(page_entry->is_dirty) - if(H5PB__write_entry(f, page_entry) < 0) + if(H5PB__write_entry(f_sh, page_entry) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") done: @@ -401,21 +401,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_flush(H5F_t *f) +H5PB_flush(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); + HDassert(f_sh); /* Flush all the entries in the PB skiplist, if we have write access on the file */ - if(f->shared->page_buf && (H5F_ACC_RDWR & H5F_INTENT(f))) { - H5PB_t *page_buf = f->shared->page_buf; + if(f_sh->page_buf && (H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))) { + H5PB_t *page_buf = f_sh->page_buf; /* Iterate over all entries in page buffer skip list */ - if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, (void *)f)) + if(H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, f_sh)) HGOTO_ERROR(H5E_PAGEBUF, H5E_BADITER, FAIL, "can't flush page buffer skip list") } /* end if */ @@ -487,7 +487,7 @@ H5PB_dest(H5F_t *f) H5PB_t *page_buf = f->shared->page_buf; H5PB_ud1_t op_data; /* Iteration context */ - if(H5PB_flush(f) < 0) + if(H5PB_flush(f->shared) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer") /* Set up context info */ @@ -895,7 +895,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ htri_t can_make_space; /* check if we can make space in page buffer */ - if((can_make_space = H5PB__make_space(f, page_buf, type)) < 0) + if((can_make_space = H5PB__make_space(f->shared, page_buf, type)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") /* if make_space returns 0, then we can't use the page @@ -981,7 +981,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, +H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5PB_t *page_buf; /* Page buffering info for this file */ @@ -999,20 +999,20 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* Get pointer to page buffer info for this file */ - page_buf = f->shared->page_buf; + page_buf = f_sh->page_buf; #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) { #if 1 bypass_pb = TRUE; #else /* MSC - why this stopped working ? */ int mpi_size; - if((mpi_size = H5F_mpi_get_size(f)) < 0) + if((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") if(1 != mpi_size) bypass_pb = TRUE; @@ -1025,7 +1025,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * buffering. */ if(NULL == page_buf || size >= page_buf->page_size || bypass_pb) { - if(H5F__accum_write(f->shared, type, addr, size, buf) < 0) + if(H5F__accum_write(f_sh, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") /* Update statistics */ @@ -1084,7 +1084,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, } /* end else */ /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Check if existing pages for raw data need to be updated since raw data access is not atomic */ if(H5FD_MEM_DRAW == type && size >= page_buf->page_size) { @@ -1186,7 +1186,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, else page_buf->hits[0]++; } /* end if */ - /* If not found */ + /* If not found */ else { void *new_page_buf; size_t page_size = page_buf->page_size; @@ -1196,7 +1196,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, htri_t can_make_space; /* Check if we can make space in page buffer */ - if((can_make_space = H5PB__make_space(f, page_buf, type)) < 0) + if((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") /* If make_space returns 0, then we can't use the page @@ -1208,14 +1208,14 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, /* Write to VFD and return */ if(H5FD_write(file, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "driver write request failed") - + /* Break out of loop */ break; } /* end if */ } /* end if */ /* Don't bother searching if there is no write access */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) + if(H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh)) /* Lookup & remove the page from the new skip list page if * it exists to see if this is a new page from the MF layer */ @@ -1258,7 +1258,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, page_entry->type = (H5F_mem_page_t)type; /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* If the entire page falls outside the EOA, then fail */ @@ -1269,8 +1269,8 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, * returned will most likely be HADDR_UNDEF, so skip * that check. */ - if(!H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) - if(HADDR_UNDEF == (eof = H5FD_get_eof(f->shared->lf, H5FD_MEM_DEFAULT))) + if(!H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) + if(HADDR_UNDEF == (eof = H5FD_get_eof(f_sh->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eof request failed") /* Adjust the read size to not go beyond the EOA */ @@ -1360,26 +1360,19 @@ done: /*------------------------------------------------------------------------- * Function: H5PB__make_space() * - * Purpose: ??? - * - * This function was created without documentation. - * What follows is my best understanding of Mohamad's intent. - * - * If necessary and if possible, evict a page from the page - * buffer to make space for the supplied page. Depending on - * the page buffer configuration and contents, and the page + * Purpose: If necessary and if possible, evict a page from the page + * buffer to make space for the supplied page. Depending on + * the page buffer configuration and contents, and the page * supplied this may or may not be possible. * - * JRM -- 12/22/16 - * * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi * *------------------------------------------------------------------------- */ -static htri_t -H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) +static htri_t +H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) { H5PB_entry_t *page_entry; /* Pointer to page eviction candidate */ htri_t ret_value = TRUE; /* Return value */ @@ -1387,7 +1380,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); + HDassert(f_sh); HDassert(page_buf); /* Get oldest entry */ @@ -1444,7 +1437,7 @@ H5PB__make_space(H5F_t *f, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* Flush page if dirty */ if(page_entry->is_dirty) - if(H5PB__write_entry(f, page_entry) < 0) + if(H5PB__write_entry(f_sh, page_entry) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") /* Update statistics */ @@ -1478,7 +1471,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) +H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry) { haddr_t eoa; /* Current EOA for the file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1486,11 +1479,11 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) FUNC_ENTER_STATIC /* Sanity check */ - HDassert(f); + HDassert(f_sh); HDassert(page_entry); /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, (H5FD_mem_t)page_entry->type))) + if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, (H5FD_mem_t)page_entry->type))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* If the starting address of the page is larger than @@ -1498,14 +1491,14 @@ H5PB__write_entry(H5F_t *f, H5PB_entry_t *page_entry) */ if(page_entry->addr <= eoa) { H5FD_t *file; /* File driver I/O info */ - size_t page_size = f->shared->page_buf->page_size; + size_t page_size = f_sh->page_buf->page_size; /* Adjust the page length if it exceeds the EOA */ if((page_entry->addr + page_size) > eoa) page_size = (size_t)(eoa - page_entry->addr); /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; if(H5FD_write(file, (H5FD_mem_t)page_entry->type, page_entry->addr, page_size, page_entry->page_buf_ptr) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index b94b845..efa9550 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -86,13 +86,13 @@ typedef struct H5PB_t { /* General routines */ H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); -H5_DLL herr_t H5PB_flush(H5F_t *f); +H5_DLL herr_t H5PB_flush(H5F_file_t *f_sh); H5_DLL herr_t H5PB_dest(H5F_t *f); H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); -H5_DLL herr_t H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); diff --git a/testpar/t_file.c b/testpar/t_file.c index 4ecfc30..a3c007d 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -250,7 +250,7 @@ test_page_buffer_access(void) VRFY((ret == 0), ""); VRFY((H5SL_count(f->shared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - ret = H5PB_flush(f); + ret = H5PB_flush(f->shared); VRFY((ret == 0), ""); /* read elements 0 - 200 */ -- cgit v0.12 From 8c40dab59eaef1dea92df91a9d877edf3ce565d0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 19 Aug 2019 16:35:55 -0700 Subject: Untangle #ifdef mess in ROS3 code. --- configure.ac | 5 + java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 2 +- src/H5FDros3.c | 111 +------ src/H5FDros3.h | 42 +-- src/H5FDs3comms.c | 336 +-------------------- src/H5FDs3comms.h | 83 ++--- src/Makefile.am | 10 +- test/ros3.c | 151 ++------- test/s3comms.c | 76 +---- test/vfd.c | 68 +---- tools/lib/h5tools_utils.c | 18 +- tools/lib/h5tools_utils.h | 3 + tools/libtest/h5tools_test_utils.c | 36 +-- 13 files changed, 154 insertions(+), 787 deletions(-) diff --git a/configure.ac b/configure.ac index 7f1f0dd..e119e0a 100644 --- a/configure.ac +++ b/configure.ac @@ -2877,6 +2877,11 @@ else ROS3_VFD=no fi + +## Read-only S3 files are not built if not required. +AM_CONDITIONAL([ROS3_VFD_CONDITIONAL], [test "X$ROS3_VFD" = "Xyes"]) + + ## ---------------------------------------------------------------------- ## Is libhdfs (Hadoop Distributed File System) present? ## It might be specified with the `--with-libhdfs' command-line switch. diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index 6b086c3..881aad3 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -71,7 +71,7 @@ public class H5FD_ros3_fapl_t implements Serializable { * @param key "secret key" or "access key" for authenticating request */ public H5FD_ros3_fapl_t (String region, String id, String key) { - this.version = 1; /* must equal H5FD__CURR_ROS3_FAPL_T_VERSION */ + this.version = 1; /* must equal H5FD_CURR_ROS3_FAPL_T_VERSION */ /* as found in H5FDros3.h */ this.aws_region = region; this.secret_id = id; diff --git a/src/H5FDros3.c b/src/H5FDros3.c index 18f1f91..a369ca2 100644 --- a/src/H5FDros3.c +++ b/src/H5FDros3.c @@ -34,6 +34,8 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5FDs3comms.h" /* S3 Communications */ +#ifdef H5_HAVE_ROS3_VFD + /* toggle function call prints: 1 turns on */ #define ROS3_DEBUG 0 @@ -119,8 +121,6 @@ static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT]; * * Programmer: Jacob Smith * - * Changes: None - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -190,8 +190,6 @@ typedef struct { * * Programmer: Jacob Smith * - * Changes: None. - * ***************************************************************************/ typedef struct H5FD_ros3_t { H5FD_t pub; @@ -215,9 +213,7 @@ typedef struct H5FD_ros3_t { * */ #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) -#ifdef H5_HAVE_ROS3_VFD #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#endif /* H5_HAVE_ROS3_VFD */ /* Prototypes */ static herr_t H5FD_ros3_term(void); @@ -279,10 +275,8 @@ static const H5FD_class_t H5FD_ros3_g = { H5FD_FLMAP_DICHOTOMY /* fl_map */ }; -#ifdef H5_HAVE_ROS3_VFD /* Declare a free list to manage the H5FD_ros3_t struct */ H5FL_DEFINE_STATIC(H5FD_ros3_t); -#endif /* H5_HAVE_ROS3_VFD */ /*------------------------------------------------------------------------- @@ -292,8 +286,7 @@ H5FL_DEFINE_STATIC(H5FD_ros3_t); * * Return: Non-negative on success/Negative on failure * - * Changes: Rename as appropriate for ros3 vfd. - * Jacob Smith 2017 + * Programmer: Jacob Smith 2017 * *------------------------------------------------------------------------- */ @@ -324,11 +317,7 @@ done: * Return: Success: The driver ID for the ros3 driver. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * - * Changes: Rename as appropriate for ros3 vfd. - * Jacob Smith 2017 + * Programmer: Jacob Smith 2017 * *------------------------------------------------------------------------- */ @@ -372,11 +361,7 @@ done: * * Returns: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * - * Changes: Rename as appropriate for ros3 vfd. - * Jacob Smith 2017 + * Programmer: Jacob Smith 2017 * *--------------------------------------------------------------------------- */ @@ -464,10 +449,6 @@ done: * Programmer: Jacob Smith * 9/10/17 * - * Changes: Add checks for authenticate flag requring populated - * `aws_region` and `secret_id` strings. - * -- Jacob Smith 2017-11-01 - * *------------------------------------------------------------------------- */ static herr_t @@ -479,7 +460,7 @@ H5FD_ros3_validate_config(const H5FD_ros3_fapl_t * fa) HDassert(fa != NULL); - if ( fa->version != H5FD__CURR_ROS3_FAPL_T_VERSION ) { + if ( fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION ) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); } @@ -704,8 +685,6 @@ H5FD_ros3_fapl_free(void *_fa) * Programmer: Jacob Smith * 2017-12-08 * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t @@ -774,12 +753,8 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD - static H5FD_t * H5FD_ros3_open( const char *url, @@ -904,22 +879,6 @@ done: } /* end H5FD_ros3_open() */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -static H5FD_t * -H5FD_ros3_open( - const char H5_ATTR_UNUSED *url, - unsigned H5_ATTR_UNUSED flags, - hid_t H5_ATTR_UNUSED fapl_id, - haddr_t H5_ATTR_UNUSED maxaddr) -{ - H5FD_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_ros3_open() */ - -#endif /* H5_HAVE_ROS3_VFD */ - #if ROS3_STATS /*---------------------------------------------------------------------------- @@ -974,8 +933,6 @@ H5FD_ros3_open( * * Programmer: Jacob Smith * - * Changes: None. - * *---------------------------------------------------------------------------- */ static herr_t @@ -1228,12 +1185,8 @@ done: * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD - static herr_t H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) { @@ -1277,18 +1230,6 @@ done: } /* end H5FD_ros3_close() */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -static herr_t -H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) -{ - herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_ros3_close() */ - -#endif /* H5_HAVE_ROS3_VFD */ - /*------------------------------------------------------------------------- * @@ -1318,17 +1259,8 @@ H5FD_ros3_close(H5FD_t H5_ATTR_UNUSED *_file) * Programmer: Jacob Smith * 2017-11-06 * - * Changes: - * - * + Change from strcmp-like return values (-1, 0, 1) to instead return - * binary equivalence (0) or inequality (-1). - * + Replace "if still equal then check this" waterfall with GOTO jumps. - * Jacob Smith 2018-05-17 - * *------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD - static int H5FD_ros3_cmp( const H5FD_t *_f1, @@ -1463,20 +1395,6 @@ done: } /* H5FD_ros3_cmp() */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -static int -H5FD_ros3_cmp( - const H5FD_t H5_ATTR_UNUSED *_f1, - const H5FD_t H5_ATTR_UNUSED *_f2) -{ - int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD_ros3_cmp() */ - -#endif /* H5_HAVE_ROS3_VFD */ - /*------------------------------------------------------------------------- * Function: H5FD_ros3_query @@ -1536,8 +1454,6 @@ H5FD_ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1572,8 +1488,6 @@ H5FD_ros3_get_eoa(const H5FD_t *_file, * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1646,8 +1560,6 @@ H5FD_ros3_get_eof(const H5FD_t *_file, * Programmer: Jacob Smith * 2017-11-02 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1696,8 +1608,6 @@ done: * Programmer: Jacob Smith * 2017-11-?? * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1792,8 +1702,6 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1839,8 +1747,6 @@ done: * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1884,8 +1790,6 @@ done: * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1914,8 +1818,6 @@ H5FD_ros3_lock(H5FD_t H5_ATTR_UNUSED *_file, * Programmer: Jacob Smith * 2017-11-03 * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1926,4 +1828,5 @@ H5FD_ros3_unlock(H5FD_t H5_ATTR_UNUSED *_file) } /* end H5FD_ros3_unlock() */ +#endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 7dfc95b..250c7cc 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -21,11 +21,13 @@ #ifndef H5FDros3_H #define H5FDros3_H -#define H5FD_ROS3 (H5FD_ros3_init()) +#ifdef H5_HAVE_ROS3_VFD +#define H5FD_ROS3 (H5FD_ros3_init()) +#else +#define H5FD_ROS3 (H5I_INVALID_HID) +#endif /* H5_HAVE_ROS3_VFD */ -#ifdef __cplusplus -extern "C" { -#endif +#ifdef H5_HAVE_ROS3_VFD /**************************************************************************** * @@ -46,7 +48,7 @@ extern "C" { * to the above calls must have a recognized version number, or an error * will be flagged. * - * This field should be set to H5FD__CURR_ROS3_FAPL_T_VERSION. + * This field should be set to H5FD_CURR_ROS3_FAPL_T_VERSION. * * `authenticate` (hbool_t) * @@ -67,31 +69,27 @@ extern "C" { * * String: "Secret Access Key" associated with the ID and resource. * - * - * - * Programmer: John Mainzer - * - * Changes: - * - * - Add documentation of fields (except `version`) - * --- Jacob Smith 2017-12-04 - * ****************************************************************************/ -#define H5FD__CURR_ROS3_FAPL_T_VERSION 1 +#define H5FD_CURR_ROS3_FAPL_T_VERSION 1 -#define H5FD__ROS3_MAX_REGION_LEN 32 -#define H5FD__ROS3_MAX_SECRET_ID_LEN 128 -#define H5FD__ROS3_MAX_SECRET_KEY_LEN 128 +#define H5FD_ROS3_MAX_REGION_LEN 32 +#define H5FD_ROS3_MAX_SECRET_ID_LEN 128 +#define H5FD_ROS3_MAX_SECRET_KEY_LEN 128 typedef struct H5FD_ros3_fapl_t { int32_t version; hbool_t authenticate; - char aws_region[H5FD__ROS3_MAX_REGION_LEN + 1]; - char secret_id[H5FD__ROS3_MAX_SECRET_ID_LEN + 1]; - char secret_key[H5FD__ROS3_MAX_SECRET_KEY_LEN + 1]; + char aws_region[H5FD_ROS3_MAX_REGION_LEN + 1]; + char secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN + 1]; + char secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN + 1]; } H5FD_ros3_fapl_t; + +#ifdef __cplusplus +extern "C" { +#endif + H5_DLL hid_t H5FD_ros3_init(void); H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa_out); H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa); @@ -100,6 +98,8 @@ H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa); } #endif +#endif /* H5_HAVE_ROS3_VFD */ + #endif /* ifndef H5FDros3_H */ diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 42b281f..f8b4417 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -47,12 +47,12 @@ /* Local Macros */ /****************/ +#ifdef H5_HAVE_ROS3_VFD + /* toggle debugging (enable with 1) */ #define S3COMMS_DEBUG 0 -#ifdef H5_HAVE_ROS3_VFD - /* manipulate verbosity of CURL output * operates separately from S3COMMS_DEBUG * @@ -67,7 +67,6 @@ */ #define S3COMMS_MAX_RANGE_STRING_SIZE 128 -#endif /* H5_HAVE_ROS3_VFD */ /******************/ /* Local Typedefs */ @@ -137,8 +136,6 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); * Programmer: Jacob Smith * 2017-08-17 * - * Changes: None. - * *---------------------------------------------------------------------------- */ size_t @@ -217,14 +214,6 @@ curlwritecallback(char *ptr, * Programmer: Jacob Smith * 2017-09-22 * - * Changes: - * - * - Change return value to herr_t - * - Change list pointer to pointer-to-pointer-to-node - * - Change to use singly-linked list (from twin doubly-linked lists) - * with modification to hrb_node_t - * --- Jake Smith 2017-01-17 - * *---------------------------------------------------------------------------- */ herr_t @@ -635,19 +624,6 @@ done: * Programmer: Jacob Smith * 2017-07-21 * - * Changes: - * - * - Conditional free() of `hrb_node_t` pointer properties based on - * `which_free` property. - * --- Jacob Smith 2017-08-08 - * - * - Integrate with HDF5. - * - Returns herr_t instead of nothing. - * --- Jacob Smith 2017-09-21 - * - * - Change argument to from *buf to **buf, to null pointer within call - * --- Jacob Smith 2017-20-05 - * *---------------------------------------------------------------------------- */ herr_t @@ -709,25 +685,6 @@ done: * Programmer: Jacob Smith * 2017-07-21 * - * Changes: - * - * - Update struct membership for newer 'generic' `hrb_t` format. - * --- Jacob Smith, 2017-07-24 - * - * - Rename from `hrb_new()` to `hrb_request()` - * --- Jacob Smith, 2017-07-25 - * - * - Integrate with HDF5. - * - Rename from 'hrb_request()` to `H5FD_s3comms_hrb_init_request()`. - * - Remove `host` from input parameters. - * - Host, as with all other fields, must now be added through the - * add-field functions. - * - Add `version` (HTTP version string, e.g. "HTTP/1.1") to parameters. - * --- Jacob Smith 2017-09-20 - * - * - Update to use linked-list `hrb_node_t` headers in structure. - * --- Jacob Smith 2017-10-05 - * *---------------------------------------------------------------------------- */ hrb_t * @@ -842,64 +799,10 @@ done: } /* end H5FD_s3comms_hrb_init_request() */ - /**************************************************************************** * S3R FUNCTIONS ****************************************************************************/ -#ifndef H5_HAVE_ROS3_VFD -/* No-op, auto-fail, unused-variable implementations if ROS3 is not enabled */ - -herr_t -H5FD_s3comms_s3r_close(s3r_t H5_ATTR_UNUSED *handle) -{ - herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_s3comms_s3r_close() */ - -size_t -H5FD_s3comms_s3r_get_filesize(s3r_t H5_ATTR_UNUSED *handle) -{ - size_t ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_s3comms_s3r_get_filesize() */ - -herr_t -H5FD_s3comms_s3r_getsize(s3r_t H5_ATTR_UNUSED *handle) -{ - herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_s3comms_s3r_getsize() */ - -s3r_t * -H5FD_s3comms_s3r_open( - const char H5_ATTR_UNUSED *url, - const char H5_ATTR_UNUSED *region, - const char H5_ATTR_UNUSED *id, - const unsigned char H5_ATTR_UNUSED *signing_key) -{ - s3r_t *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD_s3comms_s3r_open() */ - -herr_t -H5FD_s3comms_s3r_read( - s3r_t H5_ATTR_UNUSED *handle, - haddr_t H5_ATTR_UNUSED offset, - size_t H5_ATTR_UNUSED len, - void H5_ATTR_UNUSED *dest) -{ - herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_s3comms_s3r_read() */ - -#else - /*---------------------------------------------------------------------------- * @@ -920,20 +823,6 @@ H5FD_s3comms_s3r_read( * Programmer: Jacob Smith * 2017-08-31 * - * Changes: - * - * - Remove all messiness related to the now-gone "setopt" utility - * as it no longer exists in the handle. - * - Return type to `void`. - * --- Jacob Smith 2017-09-01 - * - * - Incorporate into HDF environment. - * - Rename from `s3r_close()` to `H5FD_s3comms_s3r_close()`. - * --- Jacob Smith 2017-10-06 - * - * - Change separate host, resource, port info to `parsed_url_t` struct ptr. - * --- Jacob Smith 2017-11-01 - * *---------------------------------------------------------------------------- */ herr_t @@ -995,8 +884,6 @@ done: * * Programmer: Jacob Smith 2017-01-14 * - * Changes: None - * *---------------------------------------------------------------------------- */ size_t @@ -1044,44 +931,24 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) * Programmer: Jacob Smith * 2017-08-23 * - * Changes: - * - * - Update to revised `s3r_t` format and life cycle. - * --- Jacob Smith 2017-09-01 - * - * - Conditional change to static header buffer and structure. - * --- Jacob Smith 2017-09-05 - * - * - Incorporate into HDF environment. - * - Rename from `s3r_getsize()` to `H5FD_s3comms_s3r_getsize()`. - * --- Jacob Smith 2017-10-06 - * *---------------------------------------------------------------------------- */ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle) { -#ifdef H5_HAVE_ROS3_VFD uintmax_t content_length = 0; CURL *curlh = NULL; char *end = NULL; char *headerresponse = NULL; - herr_t ret_value = SUCCEED; struct s3r_datastruct sds = { S3COMMS_CALLBACK_DATASTRUCT_MAGIC, NULL, 0 }; char *start = NULL; -#else - herr_t ret_value = FAIL; -#endif /* H5_HAVE_ROS3_VFD */ - - + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); #endif @@ -1238,8 +1105,6 @@ done: H5MM_xfree(headerresponse); sds.magic += 1; /* set to bad magic */ -#endif /* H5_HAVE_ROS3_VFD */ - FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_s3r_getsize */ @@ -1282,20 +1147,6 @@ done: * Programmer: Jacob Smith * 2017-09-01 * - * Changes: - * - * - Incorporate into HDF environment. - * - Rename from `s3r_open()` to `H5FD_s3comms_s3r_open()`. - * --- Jacob Smith 2017-10-06 - * - * - Remove port number from signature. - * - Name (`url`) must be complete url with http scheme and optional port - * number in string. - * - e.g., "http://bucket.aws.com:9000/myfile.dat?query=param" - * - Internal storage of host, resource, and port information moved into - * `parsed_url_t` struct pointer. - * --- Jacob Smith 2017-11-01 - * *---------------------------------------------------------------------------- */ s3r_t * @@ -1304,20 +1155,14 @@ H5FD_s3comms_s3r_open(const char *url, const char *id, const unsigned char *signing_key) { -#ifdef H5_HAVE_ROS3_VFD size_t tmplen = 0; CURL *curlh = NULL; s3r_t *handle = NULL; parsed_url_t *purl = NULL; -#endif s3r_t *ret_value = NULL; - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); #endif @@ -1492,11 +1337,9 @@ H5FD_s3comms_s3r_open(const char *url, HDmemcpy(handle->httpverb, "GET", 4); ret_value = handle; -#endif /* H5_HAVE_ROS3_VFD */ done: if (ret_value == NULL) { -#ifdef H5_HAVE_ROS3_VFD if (curlh != NULL) { curl_easy_cleanup(curlh); } @@ -1513,7 +1356,6 @@ done: } H5MM_xfree(handle); } -#endif /* H5_HAVE_ROS3_VFD */ } FUNC_LEAVE_NOAPI(ret_value) @@ -1560,29 +1402,6 @@ done: * Programmer: Jacob Smith * 2017-08-22 * - * Changes: - * - * - Revise structure to prevent unnecessary hrb_t element creation. - * - Rename tmprstr -> rangebytesstr to reflect purpose. - * - Insert needed `free()`s, particularly for `sds`. - * --- Jacob Smith 2017-08-23 - * - * - Revise heavily to accept buffer, range as parameters. - * - Utilize modified s3r_t format. - * --- Jacob Smith 2017-08-31 - * - * - Incorporate into HDF library. - * - Rename from `s3r_read()` to `H5FD_s3comms_s3r_read()`. - * - Return `herr_t` succeed/fail instead of S3code. - * - Update to use revised `hrb_t` and `hrb_node_t` structures. - * --- Jacob Smith 2017-10-06 - * - * - Update to use `parsed_url_t *purl` in handle. - * --- Jacob Smith 2017-11-01 - * - * - Better define behavior upon read past EOF - * --- Jacob Smith 2017-01-19 - * *---------------------------------------------------------------------------- */ herr_t @@ -1591,7 +1410,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, size_t len, void *dest) { -#ifdef H5_HAVE_ROS3_VFD CURL *curlh = NULL; CURLcode p_status = CURLE_OK; struct curl_slist *curlheaders = NULL; @@ -1604,16 +1422,9 @@ H5FD_s3comms_s3r_read(s3r_t *handle, /* return value of HDsnprintf */ struct s3r_datastruct *sds = NULL; herr_t ret_value = SUCCEED; -#else - herr_t ret_value = FAIL; -#endif /* H5_HAVE_ROS3_VFD */ - - FUNC_ENTER_NOAPI_NOINIT -#ifdef H5_HAVE_ROS3_VFD - #if S3COMMS_DEBUG HDfprintf(stdout, "called H5FD_s3comms_s3r_read.\n"); #endif @@ -2105,12 +1916,9 @@ done: } } -#endif /* H5_HAVE_ROS3_VFD */ - FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_s3r_read */ -#endif /* H5_HAVE_ROS3_VFD */ /**************************************************************************** * MISCELLANEOUS FUNCTIONS @@ -2133,8 +1941,6 @@ done: * Programmer: Jacob Smith * 2017-07-12 * - * Changes: None. - * *---------------------------------------------------------------------------- */ struct tm * @@ -2192,8 +1998,6 @@ gmnow(void) * Programmer: Jacob Smith * 2017-10-04 * - * Changes: None. - * *---------------------------------------------------------------------------- */ herr_t @@ -2362,20 +2166,6 @@ done: * Programmer: Jacob Smith * 2017-07-12 * - * Changes: - * - * - Integrate into HDF. - * - Rename from hex() to H5FD_s3comms_bytes_to_hex. - * - Change return type from `void` to `herr_t`. - * --- Jacob Smtih 2017-09-14 - * - * - Add bool parameter `lowercase` to configure upper/lowercase output - * of a-f hex characters. - * --- Jacob Smith 2017-09-19 - * - * - Change bool type to `hbool_t` - * --- Jacob Smtih 2017-10-11 - * *---------------------------------------------------------------------------- */ herr_t @@ -2438,8 +2228,6 @@ done: * Programmer: Jacob Smith * 2017-11-01 * - * Changes: None. - * *---------------------------------------------------------------------------- */ herr_t @@ -2494,22 +2282,8 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) * Programmer: Jacob Smith * 2017-07-?? * - * Changes: - * - * - Integrate with HDF5. - * - Rename from `HMAC_SHA256` to `H5FD_s3comms_HMAC_SHA256`. - * - Rename output parameter from `md` to `dest`. - * - Return `herr_t` type instead of `void`. - * - Call `H5FD_s3comms_bytes_to_hex` to generate hex cleartext for output. - * --- Jacob Smith 2017-09-19 - * - * - Use static char array instead of malloc'ing `md` - * --- Jacob Smith 2017-10-10 - * *---------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD - herr_t H5FD_s3comms_HMAC_SHA256( const unsigned char *key, @@ -2556,23 +2330,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_HMAC_SHA256 */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -herr_t -H5FD_s3comms_HMAC_SHA256( - const unsigned char H5_ATTR_UNUSED *key, - size_t H5_ATTR_UNUSED key_len, - const char H5_ATTR_UNUSED *msg, - size_t H5_ATTR_UNUSED msg_len, - char H5_ATTR_UNUSED *dest) -{ - herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_s3comms_HMAC_SHA256() */ - -#endif /* H5_HAVE_ROS3_VFD */ - /*----------------------------------------------------------------------------- * @@ -2621,8 +2378,6 @@ H5FD_s3comms_HMAC_SHA256( * Programmer: Jacob Smith * 2018-02-27 * - * Changes: None - * *----------------------------------------------------------------------------- */ static herr_t @@ -2781,8 +2536,6 @@ done: * Programmer: Jacob Smith * 2018-02-27 * - * Changes: None - * *---------------------------------------------------------------------------- */ herr_t @@ -2903,8 +2656,6 @@ done: * Programmer: Jacob Smith * 2017-09-18 * - * Changes: None. - * *---------------------------------------------------------------------------- */ herr_t @@ -2968,8 +2719,6 @@ done: * Programmer: Jacob Smith * 2017-10-30 * - * Changes: None. - * *---------------------------------------------------------------------------- */ herr_t @@ -3242,12 +2991,6 @@ done: * * Programmer: Jacob Smith * - * Changes: - * - * - Integrate into HDF. - * - Rename from `hexutf8` to `H5FD_s3comms_percent_encode_char`. - * --- Jacob Smith 2017-09-15 - * *---------------------------------------------------------------------------- */ herr_t @@ -3421,19 +3164,8 @@ done: * Programmer: Jacob Smith * 2017-07-13 * - * Changes: - * - * - Integrate into HDF5. - * - Return herr_t type. - * --- Jacob Smith 2017-09-18 - * - * - NULL check and fail of input parameters. - * --- Jacob Smith 2017-10-10 - * *---------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD - herr_t H5FD_s3comms_signing_key( unsigned char *md, @@ -3526,22 +3258,6 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_signing_key() */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -herr_t -H5FD_s3comms_signing_key( - unsigned char H5_ATTR_UNUSED *md, - const char H5_ATTR_UNUSED *secret, - const char H5_ATTR_UNUSED *region, - const char H5_ATTR_UNUSED *iso8601now) -{ - herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOERR; - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5FD_s3comms_signing_key() */ - -#endif /* H5_HAVE_ROS3_VFD */ - /*---------------------------------------------------------------------------- * @@ -3577,20 +3293,8 @@ H5FD_s3comms_signing_key( * Programmer: Jacob Smith * 2017-07-?? * - * Changes: - * - * - Integrate with HDF5. - * - Rename from `tostringtosign` to `H5FD_s3comms_tostringtosign`. - * - Return `herr_t` instead of characters written. - * - Use HDF-friendly bytes-to-hex function (`H5FD_s3comms_bytes_to_hex`) - * instead of general-purpose, deprecated `hex()`. - * - Adjust casts to openssl's `SHA256`. - * - Input strings are now `const`. - * --- Jacob Smith 2017-09-19 - * *---------------------------------------------------------------------------- */ -#ifdef H5_HAVE_ROS3_VFD herr_t H5FD_s3comms_tostringtosign( char *dest, @@ -3681,22 +3385,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5ros3_tostringtosign() */ -#else /* H5_HAVE_ROS3_VFD not defined */ - -herr_t -H5FD_s3comms_tostringtosign( - char H5_ATTR_UNUSED *dest, - const char H5_ATTR_UNUSED *req, - const char H5_ATTR_UNUSED *now, - const char H5_ATTR_UNUSED *region) -{ - herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT_NOERR - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5ros3_tostringtosign() */ - -#endif /* H5_HAVE_ROS3_VFD */ - /*---------------------------------------------------------------------------- * @@ -3725,13 +3413,6 @@ H5FD_s3comms_tostringtosign( * Programmer: Jacob Smith * 2017-09-18 * - * Changes: - * - * - Rename from `trim()` to `H5FD_s3comms_trim()`. - * - Incorporate into HDF5. - * - Returns `herr_t` type. - * --- Jacob Smith 2017-??-?? - * *---------------------------------------------------------------------------- */ herr_t @@ -3826,16 +3507,6 @@ done: * Programmer: Jacob Smith * 2017-07-?? * - * Changes: - * - * - Integrate to HDF environment. - * - Rename from `uriencode` to `H5FD_s3comms_uriencode`. - * - Change return from characters written to herr_t; - * move to i/o parameter `n_written`. - * - No longer append null-terminator to string; - * programmer may append or not as appropriate upon return. - * --- Jacob Smith 2017-09-15 - * *---------------------------------------------------------------------------- */ herr_t @@ -3915,4 +3586,5 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_uriencode */ +#endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 16f6a8b..94fae7e 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -52,18 +52,15 @@ * *****************************************************************************/ -#include -#include -#include -#include -#include +#include "H5private.h" /* Generic Functions */ #ifdef H5_HAVE_ROS3_VFD + +/* Necessary S3 headers */ #include #include #include #include -#endif /* ifdef H5_HAVE_ROS3_VFD */ /***************** * PUBLIC MACROS * @@ -99,9 +96,6 @@ * It is left to the programmer to check return value of * ISO8601NOW (should equal ISO8601_SIZE - 1). * - * Programmer: Jacob Smith - * 2017-07-?? - * *--------------------------------------------------------------------------- */ #define ISO8601NOW(dest, now_gm) \ @@ -121,9 +115,6 @@ strftime((dest), ISO8601_SIZE, "%Y%m%dT%H%M%SZ", (now_gm)) * It is left to the programmer to check return value of * RFC7231NOW (should equal RFC7231_SIZE - 1). * - * Programmer: Jacob Smith - * 2017-07-?? - * *--------------------------------------------------------------------------- */ #define RFC7231NOW(dest, now_gm) \ @@ -169,11 +160,6 @@ strftime((dest), RFC7231_SIZE, "%a, %d %b %Y %H:%M:%S GMT", (now_gm)) * `region` should be relevant AWS region, i.e. "us-east-1". * `service` should be "s3". * - * Programmer: Jacob Smith - * 2017-09-19 - * - * Changes: None. - * *--------------------------------------------------------------------------- */ #define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \ @@ -266,16 +252,6 @@ HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, * Pointers to next node in the list, or NULL sentinel as end of list. * Next node must have a greater `lowername` as determined by strcmp(). * - * - * - * Programmer: Jacob Smith - * 2017-09-22 - * - * Changes: - * - * - Change from twin doubly-linked lists to singly-linked list. - * --- Jake Smith 2017-01-17 - * *---------------------------------------------------------------------------- */ typedef struct hrb_node_t { @@ -353,10 +329,6 @@ typedef struct hrb_node_t { * * Pointer to HTTP version string, e.g., "HTTP/1.1". * - * - * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ typedef struct { @@ -421,10 +393,6 @@ typedef struct { * Single string of all query parameters in url (if any). * "arg1=value1&arg2=value2" * - * - * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ typedef struct { @@ -514,15 +482,10 @@ typedef struct { * * Requred to authenticate. * - * - * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ typedef struct { unsigned long magic; -#ifdef H5_HAVE_ROS3_VFD CURL *curlhandle; size_t filesize; char *httpverb; @@ -530,15 +493,19 @@ typedef struct { char *region; char *secret_id; unsigned char *signing_key; -#endif /* ifdef H5_HAVE_ROS3_VFD */ } s3r_t; + #define S3COMMS_S3R_MAGIC 0x44d8d79 +#ifdef __cplusplus +extern "C" { +#endif + /******************************************* * DECLARATION OF HTTP FIELD LIST ROUTINES * *******************************************/ -herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, +H5_DLL herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value); @@ -546,9 +513,9 @@ herr_t H5FD_s3comms_hrb_node_set(hrb_node_t **L, * DECLARATION OF HTTP REQUEST BUFFER ROUTINES * ***********************************************/ -herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf); +H5_DLL herr_t H5FD_s3comms_hrb_destroy(hrb_t **buf); -hrb_t * H5FD_s3comms_hrb_init_request(const char *verb, +H5_DLL hrb_t * H5FD_s3comms_hrb_init_request(const char *verb, const char *resource, const char *host); @@ -576,7 +543,7 @@ H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, H5_DLL struct tm * gmnow(void); -herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, +H5_DLL herr_t H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int cr_size, char *signed_headers_dest, int sh_size, @@ -587,27 +554,27 @@ H5_DLL herr_t H5FD_s3comms_bytes_to_hex(char *dest, size_t msg_len, hbool_t lowercase); -herr_t H5FD_s3comms_free_purl(parsed_url_t *purl); +H5_DLL herr_t H5FD_s3comms_free_purl(parsed_url_t *purl); -herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, +H5_DLL herr_t H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *msg, size_t msg_len, char *dest); -herr_t H5FD_s3comms_load_aws_profile(const char *name, +H5_DLL herr_t H5FD_s3comms_load_aws_profile(const char *name, char *key_id_out, char *secret_access_key_out, char *aws_region_out); -herr_t H5FD_s3comms_nlowercase(char *dest, +H5_DLL herr_t H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len); -herr_t H5FD_s3comms_parse_url(const char *str, +H5_DLL herr_t H5FD_s3comms_parse_url(const char *str, parsed_url_t **purl); -herr_t H5FD_s3comms_percent_encode_char(char *repr, +H5_DLL herr_t H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr_len); @@ -616,7 +583,7 @@ H5_DLL herr_t H5FD_s3comms_signing_key(unsigned char *md, const char *region, const char *iso8601now); -herr_t H5FD_s3comms_tostringtosign(char *dest, +H5_DLL herr_t H5FD_s3comms_tostringtosign(char *dest, const char *req_str, const char *now, const char *region); @@ -626,10 +593,12 @@ H5_DLL herr_t H5FD_s3comms_trim(char *dest, size_t s_len, size_t *n_written); -H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, - const char *s, - size_t s_len, - hbool_t encode_slash, - size_t *n_written); +H5_DLL herr_t H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, + hbool_t encode_slash, size_t *n_written); + +#ifdef __cplusplus +} +#endif +#endif /* H5_HAVE_ROS3_VFD */ diff --git a/src/Makefile.am b/src/Makefile.am index 1e1273c..ccee69b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -62,9 +62,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Fsfile.c H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAint.c H5FAstat.c H5FAtest.c \ - H5FD.c H5FDcore.c \ - H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c H5FDs3comms.c \ - H5FDmulti.c H5FDros3.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ + H5FD.c H5FDcore.c H5FDfamily.c H5FDhdfs.c H5FDint.c H5FDlog.c \ + H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c H5FSsection.c \ H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ @@ -134,6 +133,11 @@ if DIRECT_VFD_CONDITIONAL libhdf5_la_SOURCES += H5FDdirect.c endif +# Only compile the read-only S3 VFD if necessary +if ROS3_VFD_CONDITIONAL + libhdf5_la_SOURCES += H5FDros3.c H5FDs3comms.c +endif + # Public headers include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5version.h \ H5Apublic.h H5ACpublic.h \ diff --git a/test/ros3.c b/test/ros3.c index 7a12a8d..73b6ac2 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -30,10 +30,9 @@ #include "H5FDros3.h" /* this file driver's utilities */ #include "H5FDs3comms.h" /* for loading of credentials */ - +#ifdef H5_HAVE_ROS3_VFD /* only include the testing macros if needed */ -#ifdef H5_HAVE_ROS3_VFD /***************************************************************************** * @@ -371,14 +370,10 @@ if (strcmp((actual), (expected)) != 0) { \ #endif /* ifdef/else JSVERIFY_EXP_ACT */ -#endif /* H5_HAVE_ROS3_VFD */ - /******************************** * OTHER MACROS AND DEFINITIONS * ********************************/ -#ifdef H5_HAVE_ROS3_VFD - #define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1) #define S3_TEST_PROFILE_NAME "ros3_vfd_test" @@ -408,16 +403,15 @@ static char s3_test_aws_access_key_id[64]; static char s3_test_aws_secret_access_key[128]; H5FD_ros3_fapl_t restricted_access_fa = { - H5FD__CURR_ROS3_FAPL_T_VERSION, /* fapl version */ + H5FD_CURR_ROS3_FAPL_T_VERSION, /* fapl version */ TRUE, /* authenticate */ "", /* aws region */ "", /* access key id */ ""}; /* secret access key */ H5FD_ros3_fapl_t anonymous_fa = { - H5FD__CURR_ROS3_FAPL_T_VERSION, + H5FD_CURR_ROS3_FAPL_T_VERSION, FALSE, "", "", "" }; -#endif /* H5_HAVE_ROS3_VFD */ /*--------------------------------------------------------------------------- @@ -437,21 +431,11 @@ H5FD_ros3_fapl_t anonymous_fa = { * Programmer: Jacob Smith * 2017-10-23 * - * Changes: None. - * *--------------------------------------------------------------------------- */ static int test_fapl_config_validation(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 fapl configuration validation"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -483,7 +467,7 @@ test_fapl_config_validation(void) struct testcase cases_arr[] = { { "non-authenticating config allows empties.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + { H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */ FALSE, /* authenticate */ "", /* aws_region */ "", /* secret_id */ @@ -492,7 +476,7 @@ test_fapl_config_validation(void) }, { "authenticating config asks for populated strings.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "", "", @@ -501,7 +485,7 @@ test_fapl_config_validation(void) }, { "populated strings; key is the empty string?\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "region", "me", @@ -510,7 +494,7 @@ test_fapl_config_validation(void) }, { "id cannot be empty.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "", "me", @@ -519,7 +503,7 @@ test_fapl_config_validation(void) }, { "region cannot be empty.\n", FAIL, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "where", "", @@ -528,7 +512,7 @@ test_fapl_config_validation(void) }, { "all strings populated.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, TRUE, "where", "who", @@ -547,7 +531,7 @@ test_fapl_config_validation(void) { "non-authenticating config cares not for (de)population" "of strings.\n", SUCCEED, - { H5FD__CURR_ROS3_FAPL_T_VERSION, + { H5FD_CURR_ROS3_FAPL_T_VERSION, FALSE, "someregion", "someid", @@ -603,7 +587,7 @@ test_fapl_config_validation(void) H5Pget_fapl_ros3(fapl_id, &fa_fetch), "unable to get fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa_fetch.version, "invalid version number" ) JSVERIFY( config.version, @@ -646,8 +630,6 @@ error: } H5E_END_TRY; } return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_fapl_config_validation */ @@ -670,23 +652,11 @@ error: * Programmer: John Mainzer * 7/12/17 * - * Changes: Test only fapl and flags. - * Jacob Smith 2017 - * *------------------------------------------------------------------------- */ static int test_ros3_fapl(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 fapl "); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3 defined */ - /************************ * test-local variables * ************************/ @@ -695,7 +665,7 @@ test_ros3_fapl(void) hid_t driver_id = -1; /* ID for this VFD */ unsigned long driver_flags = 0; /* VFD feature flags */ H5FD_ros3_fapl_t ros3_fa_0 = { - H5FD__CURR_ROS3_FAPL_T_VERSION, /* version */ + H5FD_CURR_ROS3_FAPL_T_VERSION, /* version */ FALSE, /* authenticate */ "", /* aws_region */ "", /* secret_id */ @@ -737,7 +707,6 @@ error: } H5E_END_TRY; return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_ros3_fapl() */ @@ -763,14 +732,6 @@ error: static int test_vfd_open(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD-level open"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -967,8 +928,6 @@ error: #undef FAPL_H5P_DEFAULT #undef FAPL_ROS3_ANON -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_vfd_open */ @@ -993,14 +952,6 @@ error: static int test_eof_eoa(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 eof/eoa gets and sets"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -1119,7 +1070,6 @@ error: } return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_eof_eoa */ @@ -1141,15 +1091,6 @@ error: static int test_H5FDread_without_eoa_set_fails(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD read-eoa temporal coupling library limitation "); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ - char buffer[256]; unsigned int i = 0; H5FD_t *file_shakespeare = NULL; @@ -1237,8 +1178,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_H5FDread_without_eoa_set_fails */ @@ -1262,14 +1201,6 @@ error: static int test_read(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD read/range-gets"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /* H5_HAVE_ROS3_VFD defined */ /********************* * test-local macros * @@ -1451,8 +1382,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_read */ @@ -1478,15 +1407,6 @@ error: static int test_noops_and_autofails(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 VFD always-fail and no-op routines"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1606,8 +1526,6 @@ error: return 1; -#endif /* H5_HAVE_ROS3_VFD */ - } /* test_noops_and_autofails*/ @@ -1632,14 +1550,6 @@ error: static int test_cmp(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("ROS3 cmp (comparison)"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else /********************* * test-local macros * @@ -1750,7 +1660,6 @@ error: } return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_cmp */ @@ -1776,15 +1685,6 @@ error: static int test_H5F_integration(void) { -#ifndef H5_HAVE_ROS3_VFD - TESTING("S3 file access through HD5F library (H5F API)"); - SKIPPED(); - puts(" ROS3 VFD not enabled"); - fflush(stdout); - return 0; - -#else - /********************* * test-local macros * *********************/ @@ -1883,11 +1783,10 @@ HDprintf("\nerror!"); fflush(stdout); (void)H5Fclose(file); return 1; -#endif /* H5_HAVE_ROS3_VFD */ } /* test_H5F_integration */ - +#endif /* H5_HAVE_ROS3_VFD */ /*------------------------------------------------------------------------- @@ -1907,10 +1806,15 @@ HDprintf("\nerror!"); fflush(stdout); int main(void) { +#ifdef H5_HAVE_ROS3_VFD int nerrors = 0; + const char *bucket_url_env = NULL; + +#endif /* H5_HAVE_ROS3_VFD */ + + HDprintf("Testing ros3 VFD functionality.\n"); #ifdef H5_HAVE_ROS3_VFD - const char *bucket_url_env = NULL; /************************ * initialize test urls * @@ -1987,15 +1891,14 @@ main(void) s3_test_credentials_loaded = 1; HDstrncpy(restricted_access_fa.aws_region, (const char *)s3_test_aws_region, - H5FD__ROS3_MAX_REGION_LEN); + H5FD_ROS3_MAX_REGION_LEN); HDstrncpy(restricted_access_fa.secret_id, (const char *)s3_test_aws_access_key_id, - H5FD__ROS3_MAX_SECRET_ID_LEN); + H5FD_ROS3_MAX_SECRET_ID_LEN); HDstrncpy(restricted_access_fa.secret_key, (const char *)s3_test_aws_secret_access_key, - H5FD__ROS3_MAX_SECRET_KEY_LEN); + H5FD_ROS3_MAX_SECRET_KEY_LEN); } -#endif /* H5_HAVE_ROS3_VFD */ /****************** * commence tests * @@ -2003,8 +1906,6 @@ main(void) h5_reset(); - HDprintf("Testing ros3 VFD functionality.\n"); - nerrors += test_fapl_config_validation(); nerrors += test_ros3_fapl(); nerrors += test_vfd_open(); @@ -2025,6 +1926,12 @@ main(void) } return nerrors; /* 0 if no errors, 1 if any errors */ -} /* main() */ +#else + HDprintf("SKIPPED - read-only S3 VFD not built\n"); + return EXIT_SUCCESS; + +#endif /* H5_HAVE_ROS3_VFD */ + +} /* main() */ diff --git a/test/s3comms.c b/test/s3comms.c index 7bc9961..9453b75 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -23,6 +23,8 @@ #include "H5FDs3comms.h" #include "H5MMprivate.h" /* memory management */ +#ifdef H5_HAVE_ROS3_VFD + /***************************************************************************** * * FILE-LOCAL TESTING MACROS @@ -361,8 +363,6 @@ if (strcmp((actual), (expected)) != 0) { \ #endif /* ifdef/else JSVERIFY_EXP_ACT */ -#ifdef H5_HAVE_ROS3_VFD - #define S3_TEST_PROFILE_NAME "ros3_vfd_test" #define S3_TEST_RESOURCE_TEXT_RESTRICTED "t8.shakespeare.txt" @@ -384,8 +384,6 @@ static char s3_test_aws_secret_access_key[128] = ""; static char s3_test_bucket_url[S3_TEST_MAX_URL_SIZE] = ""; static hbool_t s3_test_bucket_defined = FALSE; -#endif /* H5_HAVE_ROS3_VFD */ - /*--------------------------------------------------------------------------- * @@ -1163,7 +1161,6 @@ test_HMAC_SHA256(void) * test-local structures * *************************/ -#ifdef H5_HAVE_ROS3_VFD struct testcase { herr_t ret; /* SUCCEED/FAIL expected from call */ const unsigned char key[SHA256_DIGEST_LENGTH]; @@ -1211,16 +1208,9 @@ test_HMAC_SHA256(void) char *dest = NULL; int i = 0; int n_cases = 3; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("HMAC_SHA256"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < n_cases; i++) { if (cases[i].dest_size == 0) { dest = NULL; @@ -1272,7 +1262,6 @@ test_HMAC_SHA256(void) error: free(dest); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_HMAC_SHA256() */ @@ -1706,7 +1695,6 @@ error: static herr_t test_s3r_get_filesize(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * @@ -1714,16 +1702,9 @@ test_s3r_get_filesize(void) char url_raven[S3_TEST_MAX_URL_SIZE]; s3r_t *handle = NULL; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3r_get_filesize"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else /* setup -- compose url to target resource */ if (FALSE == s3_test_bucket_defined) { @@ -1759,7 +1740,6 @@ error: (void)H5FD_s3comms_s3r_close(handle); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_get_filesize() */ @@ -1776,7 +1756,6 @@ error: static herr_t test_s3r_open(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * @@ -1792,16 +1771,9 @@ test_s3r_open(void) s3r_t *handle = NULL; hbool_t curl_ready = FALSE; parsed_url_t *purl = NULL; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3r_open"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else if (s3_test_credentials_loaded == 0) { SKIPPED(); puts(" s3 credentials are not loaded"); @@ -2000,7 +1972,6 @@ error: curl_global_cleanup(); return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_open() */ @@ -2029,7 +2000,6 @@ error: static herr_t test_s3r_read(void) { -#ifdef H5_HAVE_ROS3_VFD #define S3COMMS_TEST_BUFFER_SIZE 256 @@ -2042,16 +2012,9 @@ test_s3r_read(void) s3r_t *handle = NULL; hbool_t curl_ready = FALSE; unsigned int i = 0; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("test_s3r_read"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else /* * initial setup */ @@ -2226,7 +2189,6 @@ error: return -1; #undef S3COMMS_TEST_BUFFER_SIZE -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_s3r_read() */ @@ -2249,7 +2211,6 @@ error: static herr_t test_signing_key(void) { -#ifdef H5_HAVE_ROS3_VFD /************************* * test-local structures * *************************/ @@ -2279,16 +2240,9 @@ test_signing_key(void) int i = 0; unsigned char *key = NULL; int ncases = 1; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("signing_key"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else for (i = 0; i < ncases; i++) { key = (unsigned char *)HDmalloc(sizeof(unsigned char) * \ SHA256_DIGEST_LENGTH); @@ -2365,7 +2319,6 @@ error: } return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_signing_key() */ @@ -2394,7 +2347,6 @@ error: static herr_t test_tostringtosign(void) { -#ifdef H5_HAVE_ROS3_VFD /************************ * test-local variables * ************************/ @@ -2403,16 +2355,9 @@ test_tostringtosign(void) const char iso8601now[] = "20130524T000000Z"; const char region[] = "us-east-1"; char s2s[512]; -#endif /* H5_HAVE_ROS3_VFD */ TESTING("s3comms tostringtosign"); -#ifndef H5_HAVE_ROS3_VFD - SKIPPED(); - puts(" ROS3 VFD is not enabled"); - fflush(stdout); - return 0; -#else JSVERIFY( SUCCEED, H5FD_s3comms_tostringtosign(s2s, canonreq, iso8601now, region), "unable to create string to sign" ) @@ -2437,7 +2382,6 @@ test_tostringtosign(void) error : return -1; -#endif /* H5_HAVE_ROS3_VFD */ } /* end test_tostringtosign() */ @@ -2679,6 +2623,7 @@ error: } /* end test_uriencode() */ +#endif /* H5_HAVE_ROS3_VFD */ @@ -2702,13 +2647,14 @@ error: int main(void) { - int nerrors = 0; #ifdef H5_HAVE_ROS3_VFD + int nerrors = 0; const char *bucket_url_env = NULL; -#endif /* H5_HAVE_ROS3_VFD */ h5_reset(); +#endif /* H5_HAVE_ROS3_VFD */ + HDprintf("Testing S3Communications functionality.\n"); #ifdef H5_HAVE_ROS3_VFD @@ -2744,8 +2690,6 @@ main(void) s3_test_bucket_defined = TRUE; } -#endif /* H5_HAVE_ROS3_VFD */ - /* tests ordered rougly by dependence */ nerrors += test_macro_format_credential() < 0 ? 1 : 0; nerrors += test_trim() < 0 ? 1 : 0; @@ -2774,5 +2718,13 @@ main(void) HDprintf("All S3comms tests passed.\n"); return 0; + +#else + + HDprintf("SKIPPED - read-only S3 VFD not built\n"); + return EXIT_SUCCESS; + +#endif /* H5_HAVE_ROS3_VFD */ + } /* end main() */ diff --git a/test/vfd.c b/test/vfd.c index 2b15430..68fe0bd 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -58,7 +58,7 @@ const char *FILENAME[] = { "stdio_file", /*7*/ "windows_file", /*8*/ "new_multi_file_v16",/*9*/ - "ro_s3_file6", /*10*/ + "ro_s3_file", /*10*/ NULL }; @@ -1940,6 +1940,7 @@ error: static herr_t test_ros3(void) { +#ifdef H5_HAVE_ROS3_VFD hid_t fid = -1; /* file ID */ hid_t fapl_id = -1; /* file access property list ID */ hid_t fapl_id_out = -1; /* from H5Fget_access_plist */ @@ -1951,14 +1952,20 @@ test_ros3(void) H5FD_ros3_fapl_t test_ros3_fa; H5FD_ros3_fapl_t ros3_fa_0 = { - /* version = */ H5FD__CURR_ROS3_FAPL_T_VERSION, + /* version = */ H5FD_CURR_ROS3_FAPL_T_VERSION, /* authenticate = */ FALSE, /* aws_region = */ "", /* secret_id = */ "", /* secret_key = */ "plugh", }; +#endif /*H5_HAVE_ROS3_VFD */ - TESTING("ROS3 file driver"); + TESTING("Read-only S3 file driver"); + +#ifndef H5_HAVE_ROS3_VFD + SKIPPED(); + return 0; +#else /* H5_HAVE_ROS3_VFD */ /* Set property list and file name for ROS3 driver. */ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) @@ -1988,61 +1995,13 @@ test_ros3(void) if (H5FDdriver_query(driver_id, &driver_flags) < 0) TEST_ERROR; - if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) TEST_ERROR + if(!(driver_flags & H5FD_FEAT_DATA_SIEVE)) + TEST_ERROR /* Check for extra flags not accounted for above */ if(driver_flags != (H5FD_FEAT_DATA_SIEVE)) TEST_ERROR - /* can't create analogs of the following tests until the - * ROS3 driver is up and running in a minimal fashion. - * Comment them out until we get to them. - */ -#if 0 - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) - TEST_ERROR; - - /* Retrieve the access property list... */ - if((fapl_id_out = H5Fget_access_plist(fid)) < 0) - TEST_ERROR; - - /* Check that the driver is correct */ - if(H5FD_ROS3 != H5Pget_driver(fapl_id_out)) - TEST_ERROR; - - /* ...and close the property list */ - if(H5Pclose(fapl_id_out) < 0) - TEST_ERROR; - - /* Check that we can get an operating-system-specific handle from - * the library. - */ - if(H5Fget_vfd_handle(fid, H5P_DEFAULT, &os_file_handle) < 0) - TEST_ERROR; - if(os_file_handle == NULL) - FAIL_PUTS_ERROR("NULL os-specific vfd/file handle was returned from H5Fget_vfd_handle"); - - - /* There is no garantee the size of metadata in file is constant. - * Just try to check if it's reasonable. - * - * Currently it should be around 2 KB. - */ - if(H5Fget_filesize(fid, &file_size) < 0) - TEST_ERROR; - if(file_size < 1 * KB || file_size > 4 * KB) - FAIL_PUTS_ERROR("suspicious file size obtained from H5Fget_filesize"); - - /* Close and delete the file */ - if(H5Fclose(fid) < 0) - TEST_ERROR; - h5_delete_test_file(FILENAME[0], fapl_id); - - /* Close the fapl */ - if(H5Pclose(fapl_id) < 0) - TEST_ERROR; -#endif - PASSED(); return 0; @@ -2053,10 +2012,9 @@ error: H5Fclose(fid); } H5E_END_TRY; return -1; +#endif /* H5_HAVE_ROS3_VFD */ } /* end test_ros3() */ - - /*------------------------------------------------------------------------- * Function: main * diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e140fff..47ce690 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -1129,17 +1129,13 @@ done: * Programmer: Jacob Smith * 2017-11-13 * - * Changes: None. - * *---------------------------------------------------------------------------- */ +#ifdef H5_HAVE_ROS3_VFD int h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values) { -#ifndef H5_HAVE_ROS3_VFD - return 0; -#else int show_progress = 0; /* set to 1 for debugging */ int ret_value = 1; /* 1 for success, 0 for failure */ /* e.g.? if (!populate()) { then failed } */ @@ -1159,7 +1155,7 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, if (show_progress) { HDprintf(" preset fapl with default values\n"); } - fa->version = H5FD__CURR_ROS3_FAPL_T_VERSION; + fa->version = H5FD_CURR_ROS3_FAPL_T_VERSION; fa->authenticate = FALSE; *(fa->aws_region) = '\0'; *(fa->secret_id) = '\0'; @@ -1196,7 +1192,7 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, if (*values[0] != '\0' && *values[1] != '\0') { - if (HDstrlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN) { + if (HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN) { if (show_progress) { HDprintf(" ERROR: aws_region value too long\n"); } @@ -1210,7 +1206,7 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, } - if (HDstrlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN) { + if (HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN) { if (show_progress) { HDprintf(" ERROR: secret_id value too long\n"); } @@ -1224,7 +1220,7 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, HDprintf(" secret_id set\n"); } - if (HDstrlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN) { + if (HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN) { if (show_progress) { HDprintf(" ERROR: secret_key value too long\n"); } @@ -1259,9 +1255,9 @@ h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, done: return ret_value; -#endif /* H5_HAVE_ROS3_VFD */ } /* h5tools_populate_ros3_fapl */ +#endif /* H5_HAVE_ROS3_VFD */ /*----------------------------------------------------------------------------- @@ -1329,5 +1325,3 @@ done: } /* h5tools_set_configured_fapl() */ - - diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 1c6ba2a..0fa5250 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -182,8 +182,11 @@ H5TOOLS_DLL int h5tools_getenv_update_hyperslab_bufsize(void); H5TOOLS_DLL int h5tools_set_configured_fapl(hid_t fapl_id, const char vfd_name[], void *fapl_t_ptr); +#ifdef H5_HAVE_ROS3_VFD H5TOOLS_DLL int h5tools_populate_ros3_fapl(H5FD_ros3_fapl_t *fa, const char **values); +#endif /* H5_HAVE_ROS3_VFD */ + #ifdef __cplusplus } #endif diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index 8d489e4..b4d66e0 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -653,7 +653,7 @@ test_populate_ros3_fa(void) show_progress = TRUE; #endif /* H5TOOLS_UTILS_TEST_DEBUG */ - HDassert(bad_version != H5FD__CURR_ROS3_FAPL_T_VERSION); + HDassert(bad_version != H5FD_CURR_ROS3_FAPL_T_VERSION); /********* * TESTS * @@ -679,7 +679,7 @@ test_populate_ros3_fa(void) JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, NULL), "NULL values pointer yields \"default\" fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -697,7 +697,7 @@ test_populate_ros3_fa(void) JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), "empty values yields \"default\" fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -715,7 +715,7 @@ test_populate_ros3_fa(void) JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), "four values" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( TRUE, fa.authenticate, NULL ) JSVERIFY_STR( "x", fa.aws_region, NULL ) JSVERIFY_STR( "y", fa.secret_id, NULL ) @@ -733,7 +733,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -751,7 +751,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -771,11 +771,11 @@ test_populate_ros3_fa(void) if (show_progress) { HDprintf("region overflow\n"); } - HDassert(HDstrlen(values[0]) > H5FD__ROS3_MAX_REGION_LEN); + HDassert(HDstrlen(values[0]) > H5FD_ROS3_MAX_REGION_LEN); JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -793,7 +793,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -811,7 +811,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -839,11 +839,11 @@ test_populate_ros3_fa(void) if (show_progress) { HDprintf("id overflow\n"); } - HDassert(HDstrlen(values[1]) > H5FD__ROS3_MAX_SECRET_ID_LEN); + HDassert(HDstrlen(values[1]) > H5FD_ROS3_MAX_SECRET_ID_LEN); JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "x", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -861,7 +861,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -879,7 +879,7 @@ test_populate_ros3_fa(void) JSVERIFY( 1, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( TRUE, fa.authenticate, NULL ) JSVERIFY_STR( "x", fa.aws_region, NULL ) JSVERIFY_STR( "y", fa.secret_id, NULL ) @@ -897,7 +897,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -915,7 +915,7 @@ test_populate_ros3_fa(void) JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "", fa.aws_region, NULL ) JSVERIFY_STR( "", fa.secret_id, NULL ) @@ -943,11 +943,11 @@ test_populate_ros3_fa(void) if (show_progress) { HDprintf("key overflow\n"); } - HDassert(HDstrlen(values[2]) > H5FD__ROS3_MAX_SECRET_KEY_LEN); + HDassert(HDstrlen(values[2]) > H5FD_ROS3_MAX_SECRET_KEY_LEN); JSVERIFY( 0, h5tools_populate_ros3_fapl(&fa, values), "could not fill fapl" ) - JSVERIFY( H5FD__CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) + JSVERIFY( H5FD_CURR_ROS3_FAPL_T_VERSION, fa.version, NULL ) JSVERIFY( FALSE, fa.authenticate, NULL ) JSVERIFY_STR( "x", fa.aws_region, NULL ) JSVERIFY_STR( "y", fa.secret_id, NULL ) -- cgit v0.12 From e747237a9c03e551eef017cf4a0de5d67ca4fd71 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 20 Aug 2019 13:16:20 -0700 Subject: Removed unnecessary H5S_FRIEND and dead code. --- testpar/t_span_tree.c | 80 +++++++++++++++------------------------------------ 1 file changed, 23 insertions(+), 57 deletions(-) diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 352a089..9a4ac4d 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -32,14 +32,7 @@ */ -#define H5S_FRIEND /*suppress error about including H5Spkg */ - -/* Define this macro to indicate that the testing APIs should be available */ -#define H5S_TESTING - -#include "hdf5.h" #include "H5private.h" -#include "H5Spkg.h" /* Dataspaces */ #include "testphdf5.h" @@ -51,7 +44,7 @@ static void coll_read_test(int chunk_factor); * Function: coll_irregular_cont_write * * Purpose: Wrapper to test the collectively irregular hyperslab write in - contiguous storage + * contiguous storage * * Return: Success: 0 * @@ -76,7 +69,7 @@ coll_irregular_cont_write(void) * Function: coll_irregular_cont_read * * Purpose: Wrapper to test the collectively irregular hyperslab read in - contiguous storage + * contiguous storage * * Return: Success: 0 * @@ -100,7 +93,7 @@ coll_irregular_cont_read(void) * Function: coll_irregular_simple_chunk_write * * Purpose: Wrapper to test the collectively irregular hyperslab write in - chunk storage(1 chunk) + * chunk storage(1 chunk) * * Return: Success: 0 * @@ -125,7 +118,7 @@ coll_irregular_simple_chunk_write(void) * Function: coll_irregular_simple_chunk_read * * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk - storage(1 chunk) + * storage(1 chunk) * * Return: Success: 0 * @@ -148,7 +141,7 @@ coll_irregular_simple_chunk_read(void) * Function: coll_irregular_complex_chunk_write * * Purpose: Wrapper to test the collectively irregular hyperslab write in chunk - storage(4 chunks) + * storage(4 chunks) * * Return: Success: 0 * @@ -173,7 +166,7 @@ coll_irregular_complex_chunk_write(void) * Function: coll_irregular_complex_chunk_read * * Purpose: Wrapper to test the collectively irregular hyperslab read in chunk - storage(1 chunk) + * storage(1 chunk) * * Return: Success: 0 * @@ -197,9 +190,9 @@ coll_irregular_complex_chunk_read(void) * Function: coll_write_test * * Purpose: To test the collectively irregular hyperslab write in chunk - storage + * storage * Input: number of chunks on each dimension - if number is equal to 0, contiguous storage + * if number is equal to 0, contiguous storage * Return: Success: 0 * * Failure: -1 @@ -217,19 +210,11 @@ void coll_write_test(int chunk_factor) hid_t file, datasetc,dataseti; /* File and dataset identifiers */ hid_t mspaceid1, mspaceid, fspaceid,fspaceid1; /* Dataspace identifiers */ - hsize_t mdim1[1],fsdim[2],mdim[2]; - -#if 0 - hsize_t mdim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset - (in memory) */ - hsize_t fsdim[] = {FSPACE_DIM1, FSPACE_DIM2}; /* Dimension sizes of the dataset - (on disk) */ - - hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the - dataset in memory when we - read selection from the - dataset on the disk */ -#endif + hsize_t mdim1[1]; /* Dimension size of the first dataset (in memory) */ + hsize_t fsdim[2]; /* Dimension sizes of the dataset (on disk) */ + hsize_t mdim[2]; /* Dimension sizes of the dataset in memory when we + * read selection from the dataset on the disk + */ hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ @@ -241,15 +226,9 @@ void coll_write_test(int chunk_factor) unsigned i; int fillvalue = 0; /* Fill value for the dataset */ -#if 0 - int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; - int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the - dataset */ - int vector[MSPACE1_DIM]; -#endif - - - int *matrix_out = NULL, *matrix_out1 = NULL, *vector = NULL; + int *matrix_out = NULL; + int *matrix_out1 = NULL; /* Buffer to read from the dataset */ + int *vector = NULL; int mpi_size,mpi_rank; @@ -670,9 +649,9 @@ void coll_write_test(int chunk_factor) * Function: coll_read_test * * Purpose: To test the collectively irregular hyperslab read in chunk - storage + * storage * Input: number of chunks on each dimension - if number is equal to 0, contiguous storage + * if number is equal to 0, contiguous storage * Return: Success: 0 * * Failure: -1 @@ -693,14 +672,10 @@ coll_read_test(int chunk_factor) /* Dimension sizes of the dataset (on disk) */ -#if 0 - hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the - dataset in memory when we - read selection from the - dataset on the disk */ + hsize_t mdim[2]; /* Dimension sizes of the dataset in memory when we + * read selection from the dataset on the disk + */ -#endif - hsize_t mdim[2]; hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ @@ -710,13 +685,8 @@ coll_read_test(int chunk_factor) unsigned i; int *matrix_out; - int *matrix_out1; -#if 0 - int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; - int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the - dataset */ + int *matrix_out1; /* Buffer to read from the dataset */ -#endif int mpi_size,mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; @@ -923,7 +893,7 @@ coll_read_test(int chunk_factor) ret = H5Fclose(file); VRFY((ret >= 0),""); - return ; + return; } @@ -2602,10 +2572,6 @@ lower_dim_size_comp_test(void) int chunk_edge_size = 0; int use_collective_io; -#if 0 - HDsleep(60); -#endif - HDcompile_assert(sizeof(uint32_t) == sizeof(unsigned)); for(use_collective_io = 0; use_collective_io <= 1; use_collective_io++) { chunk_edge_size = 0; -- cgit v0.12 From 25f982abbd5f0dddf0315f994171cd9c9f037cb9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 17:26:10 -0500 Subject: Finish converting H5PB_* routines to use shared file pointer, instead of top file pointer. --- src/H5Fint.c | 6 ++--- src/H5Fio.c | 4 +-- src/H5MF.c | 2 +- src/H5MFsection.c | 2 +- src/H5PB.c | 81 ++++++++++++++++++++++++++++--------------------------- src/H5PBprivate.h | 10 +++---- 6 files changed, 54 insertions(+), 51 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 1c67cea..4a0c397 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1325,7 +1325,7 @@ H5F__dest(H5F_t *f, hbool_t flush) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") /* Shutdown the page buffer cache */ - if(H5PB_dest(f) < 0) + if(H5PB_dest(f->shared) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache") @@ -1675,7 +1675,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if(page_buf_size) - if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) + if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") /* Initialize information about the superblock and allocate space for it */ @@ -1697,7 +1697,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if(page_buf_size) - if(H5PB_create(file, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) + if(H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") /* Open the root group */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 63b033f..a4a6e01 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -113,7 +113,7 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/* map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ - if(H5PB_read(f, map_type, addr, size, buf) < 0) + if(H5PB_read(f->shared, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") done: @@ -170,7 +170,7 @@ done: /*------------------------------------------------------------------------- * Function: H5F_flush_tagged_metadata * - * Purpose: Flushes metadata with specified tag in the metadata cache + * Purpose: Flushes metadata with specified tag in the metadata cache * to disk. * * Return: Non-negative on success/Negative on failure diff --git a/src/H5MF.c b/src/H5MF.c index e91fa14..b1467ff 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -982,7 +982,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Insert the new page into the Page Buffer list of new pages so we don't read an empty page from disk */ - if(f->shared->page_buf != NULL && H5PB_add_new_page(f, alloc_type, new_page) < 0) + if(f->shared->page_buf != NULL && H5PB_add_new_page(f->shared, alloc_type, new_page) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't add new page to Page Buffer new page list") ret_value = new_page; diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 3ebc5c8..f661ef9 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -776,7 +776,7 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 /* Note: Large metadata page bypasses the PB cache */ /* Note: Update of raw data page (large or small sized) is handled by the PB cache */ if(udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW) - if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0) + if(H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0) diff --git a/src/H5PB.c b/src/H5PB.c index 89f80dd..42c1cba 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -289,7 +289,7 @@ H5PB_print_stats(const H5PB_t *page_buf) *------------------------------------------------------------------------- */ herr_t -H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) +H5PB_create(H5F_file_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) { H5PB_t *page_buf = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -297,20 +297,19 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); /* Check args */ - if(f->shared->fs_strategy != H5F_FSPACE_STRATEGY_PAGE) + if(f_sh->fs_strategy != H5F_FSPACE_STRATEGY_PAGE) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "Enabling Page Buffering requires PAGE file space strategy") /* round down the size if it is larger than the page size */ - else if(size > f->shared->fs_page_size) { + else if(size > f_sh->fs_page_size) { hsize_t temp_size; - temp_size = (size / f->shared->fs_page_size) * f->shared->fs_page_size; + temp_size = (size / f_sh->fs_page_size) * f_sh->fs_page_size; H5_CHECKED_ASSIGN(size, size_t, temp_size, hsize_t); } /* end if */ - else if(0 != size % f->shared->fs_page_size) + else if(0 != size % f_sh->fs_page_size) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "Page Buffer size must be >= to the page size") /* Allocate the new page buffering structure */ @@ -318,15 +317,15 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed") page_buf->max_size = size; - H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f->shared->fs_page_size, hsize_t); + H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f_sh->fs_page_size, hsize_t); page_buf->min_meta_perc = page_buf_min_meta_perc; page_buf->min_raw_perc = page_buf_min_raw_perc; /* Calculate the minimum page count for metadata and raw data - * based on the fractions provided + * based on the fractions provided */ - page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f->shared->fs_page_size * 100)); - page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f->shared->fs_page_size * 100)); + page_buf->min_meta_count = (unsigned)((size * page_buf_min_meta_perc) / (f_sh->fs_page_size * 100)); + page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f_sh->fs_page_size * 100)); if(NULL == (page_buf->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list") @@ -336,7 +335,7 @@ H5PB_create(H5F_t *f, size_t size, unsigned page_buf_min_meta_perc, unsigned pag if(NULL == (page_buf->page_fac = H5FL_fac_init(page_buf->page_size))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "can't create page factory") - f->shared->page_buf = page_buf; + f_sh->page_buf = page_buf; done: if(ret_value < 0) { @@ -473,21 +472,21 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) *------------------------------------------------------------------------- */ herr_t -H5PB_dest(H5F_t *f) +H5PB_dest(H5F_file_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); /* flush and destroy the page buffer, if it exists */ - if(f->shared->page_buf) { - H5PB_t *page_buf = f->shared->page_buf; + if(f_sh->page_buf) { + H5PB_t *page_buf = f_sh->page_buf; H5PB_ud1_t op_data; /* Iteration context */ - if(H5PB_flush(f->shared) < 0) + if(H5PB_flush(f_sh) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer") /* Set up context info */ @@ -507,7 +506,7 @@ H5PB_dest(H5F_t *f) if(H5FL_fac_term(page_buf->page_fac) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTRELEASE, FAIL, "can't destroy page buffer page factory") - f->shared->page_buf = H5FL_FREE(H5PB_t, page_buf); + f_sh->page_buf = H5FL_FREE(H5PB_t, page_buf); } /* end if */ done: @@ -529,16 +528,18 @@ done: * *------------------------------------------------------------------------- */ -herr_t -H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr) +herr_t +H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr) { - H5PB_t *page_buf = f->shared->page_buf; - H5PB_entry_t *page_entry = NULL; /* pointer to the corresponding page entry */ - herr_t ret_value = SUCCEED; /* Return value */ + H5PB_t *page_buf; /* Page buffer to operate on */ + H5PB_entry_t *page_entry = NULL; /* Pointer to the corresponding page entry */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ + HDassert(f_sh); + page_buf = f_sh->page_buf; HDassert(page_buf); /* If there is an existing page, this means that at some point the @@ -624,7 +625,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) * Function: H5PB_remove_entry * * Purpose: Remove possible metadata entry with ADDR from the PB cache. - * This is in response to the data corruption bug from fheap.c + * This is in response to the data corruption bug from fheap.c * with page buffering + page strategy. * Note: Large metadata page bypasses the PB cache. * Note: Update of raw data page (large or small sized) is handled by the PB cache. @@ -636,15 +637,17 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) *------------------------------------------------------------------------- */ herr_t -H5PB_remove_entry(const H5F_t *f, haddr_t addr) +H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr) { - H5PB_t *page_buf = f->shared->page_buf; - H5PB_entry_t *page_entry = NULL; /* pointer to the page entry being searched */ - herr_t ret_value = SUCCEED; /* Return value */ + H5PB_t *page_buf; /* Page buffer to operate on */ + H5PB_entry_t *page_entry = NULL; /* Pointer to the page entry being searched */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ + HDassert(f_sh); + page_buf = f_sh->page_buf; HDassert(page_buf); /* Search for address in the skip list */ @@ -674,7 +677,7 @@ done: /*------------------------------------------------------------------------- * Function: H5PB_read * - * Purpose: Reads in the data from the page containing it if it exists + * Purpose: Reads in the data from the page containing it if it exists * in the PB cache; otherwise reads in the page through the VFD. * * Return: Non-negative on success/Negative on failure @@ -684,7 +687,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5PB_t *page_buf; /* Page buffering info for this file */ H5PB_entry_t *page_entry; /* Pointer to the corresponding page entry */ @@ -701,21 +704,21 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); + HDassert(f_sh); HDassert(type != H5FD_MEM_GHEAP); /* Get pointer to page buffer info for this file */ - page_buf = f->shared->page_buf; + page_buf = f_sh->page_buf; #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) { #if 1 bypass_pb = TRUE; #else /* MSC - why this stopped working ? */ int mpi_size; - if((mpi_size = H5F_mpi_get_size(f)) < 0) + if((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") if(1 != mpi_size) bypass_pb = TRUE; @@ -729,7 +732,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ */ if(NULL == page_buf || size >= page_buf->page_size || (bypass_pb && H5FD_MEM_DRAW == type)) { - if(H5F__accum_read(f->shared, type, addr, size, buf) < 0) + if(H5F__accum_read(f_sh, type, addr, size, buf) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed") /* Update statistics */ @@ -780,7 +783,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ } /* end else */ /* Translate to file driver I/O info object */ - file = f->shared->lf; + file = f_sh->lf; /* Copy raw data from dirty pages into the read buffer if the read request spans pages in the page buffer*/ @@ -884,7 +887,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ else page_buf->hits[0]++; } /* end if */ - /* if not found */ + /* if not found */ else { void *new_page_buf = NULL; size_t page_size = page_buf->page_size; @@ -895,7 +898,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ htri_t can_make_space; /* check if we can make space in page buffer */ - if((can_make_space = H5PB__make_space(f->shared, page_buf, type)) < 0) + if((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0) HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") /* if make_space returns 0, then we can't use the page @@ -920,7 +923,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ /* Read page through the VFD layer, but make sure we don't read past the EOA. */ /* Retrieve the 'eoa' for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + if(HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* If the entire page falls outside the EOA, then fail */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index efa9550..8bca219 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -85,13 +85,13 @@ typedef struct H5PB_t { /***************************************/ /* General routines */ -H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); +H5_DLL herr_t H5PB_create(H5F_file_t *f_sh, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); H5_DLL herr_t H5PB_flush(H5F_file_t *f_sh); -H5_DLL herr_t H5PB_dest(H5F_t *f); -H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr); +H5_DLL herr_t H5PB_dest(H5F_file_t *f_sh); +H5_DLL herr_t H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr); +H5_DLL herr_t H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ -- cgit v0.12 From 67d7d28c038fb027feed570d6e6b25fdab4865dc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 18:21:53 -0500 Subject: Begin converting dataset code to use shared file pointer instead of top file pointer. --- src/H5Dcontig.c | 60 +++++++++++++++++++------------------- src/H5Dio.c | 1 + src/H5Dpkg.h | 4 +++ src/H5Fio.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Fprivate.h | 2 ++ 5 files changed, 126 insertions(+), 30 deletions(-) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 8733633..8f7a7ca 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -58,7 +58,7 @@ /* Callback info for sieve buffer readvv operation */ typedef struct H5D_contig_readvv_sieve_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *rbuf; /* Pointer to buffer to fill */ @@ -66,14 +66,14 @@ typedef struct H5D_contig_readvv_sieve_ud_t { /* Callback info for [plain] readvv operation */ typedef struct H5D_contig_readvv_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ unsigned char *rbuf; /* Pointer to buffer to fill */ } H5D_contig_readvv_ud_t; /* Callback info for sieve buffer writevv operation */ typedef struct H5D_contig_writevv_sieve_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *wbuf; /* Pointer to buffer to write */ @@ -81,7 +81,7 @@ typedef struct H5D_contig_writevv_sieve_ud_t { /* Callback info for [plain] writevv operation */ typedef struct H5D_contig_writevv_ud_t { - H5F_t *file; /* File for dataset */ + H5F_file_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ const unsigned char *wbuf; /* Pointer to buffer to write */ } H5D_contig_writevv_ud_t; @@ -718,7 +718,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_t *file = udata->file; /* File for dataset */ + H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *buf; /* Pointer to buffer to fill */ @@ -750,7 +750,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == dset_contig->sieve_buf) { /* Check if we can actually hold the I/O request in the sieve buffer */ if(len > dset_contig->sieve_buf_size) { - if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ else { @@ -762,7 +762,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Set up the buffer parameters */ @@ -773,7 +773,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t); /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -804,7 +804,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer, if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -813,7 +813,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Read directly into the user's buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ /* Element size fits within the buffer size */ @@ -821,7 +821,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -832,7 +832,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Only need this when resizing sieve buffer */ @@ -847,7 +847,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, H5_CHECKED_ASSIGN(dset_contig->sieve_size, size_t, min, hsize_t); /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -885,7 +885,7 @@ H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata FUNC_ENTER_STATIC /* Write data */ - if(H5F_block_read(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), + if(H5F_shared_block_read(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->rbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") @@ -931,11 +931,11 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, HDassert(mem_off_arr); /* Check if data sieving is enabled */ - if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { + if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { H5D_contig_readvv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.rbuf = (unsigned char *)io_info->u.rbuf; @@ -950,7 +950,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_addr = io_info->store->contig.dset_addr; udata.rbuf = (unsigned char *)io_info->u.rbuf; @@ -983,7 +983,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_t *file = udata->file; /* File for dataset */ + H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *buf; /* Pointer to buffer to fill */ @@ -1015,7 +1015,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == dset_contig->sieve_buf) { /* Check if we can actually hold the I/O request in the sieve buffer */ if(len > dset_contig->sieve_buf_size) { - if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ else { @@ -1031,7 +1031,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Set up the buffer parameters */ @@ -1044,7 +1044,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Check if there is any point in reading the data from the file */ if(dset_contig->sieve_size > len) { /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ @@ -1084,7 +1084,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer, if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -1097,7 +1097,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Write directly from the user's buffer */ - if(H5F_block_write(file, H5FD_MEM_DRAW, addr, len, buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ /* Element size fits within the buffer size */ @@ -1132,7 +1132,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Flush the sieve buffer if it's dirty */ if(dset_contig->sieve_dirty) { /* Write to file */ - if(H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ @@ -1143,7 +1143,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ - if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(file, H5FD_MEM_DRAW))) + if(HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") /* Only need this when resizing sieve buffer */ @@ -1160,7 +1160,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Check if there is any point in reading the data from the file */ if(dset_contig->sieve_size > len) { /* Read the new sieve buffer */ - if(H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) + if(H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") } /* end if */ @@ -1200,7 +1200,7 @@ H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udat FUNC_ENTER_STATIC /* Write data */ - if(H5F_block_write(udata->file, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0) + if(H5F_shared_block_write(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") done: @@ -1245,11 +1245,11 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, HDassert(mem_off_arr); /* Check if data sieving is enabled */ - if(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_DATA_SIEVE)) { + if(H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { H5D_contig_writevv_sieve_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.wbuf = (const unsigned char *)io_info->u.wbuf; @@ -1264,7 +1264,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ - udata.file = io_info->dset->oloc.file; + udata.f_sh = io_info->f_sh; udata.dset_addr = io_info->store->contig.dset_addr; udata.wbuf = (const unsigned char *)io_info->u.wbuf; diff --git a/src/H5Dio.c b/src/H5Dio.c index cdb73e3..1e6e70d 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -857,6 +857,7 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, /* Set up "normal" I/O fields */ io_info->dset = dset; + io_info->f_sh = H5F_SHARED(dset->oloc.file); io_info->store = store; /* Set I/O operations to initial values */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 638c8a5..878fda3 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -47,11 +47,13 @@ /* [Simple] Macro to construct a H5D_io_info_t from it's components */ #define H5D_BUILD_IO_INFO_WRT(io_info, ds, str, buf) \ (io_info)->dset = ds; \ + (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_WRITE; \ (io_info)->u.wbuf = buf #define H5D_BUILD_IO_INFO_RD(io_info, ds, str, buf) \ (io_info)->dset = ds; \ + (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_READ; \ (io_info)->u.rbuf = buf @@ -207,6 +209,8 @@ typedef enum H5D_io_op_type_t { typedef struct H5D_io_info_t { const H5D_t *dset; /* Pointer to dataset being operated on */ +/* QAK: Delete the f_sh field when oloc has a shared file pointer? */ + H5F_file_t *f_sh; /* Pointer to shared file struct that dataset is within */ #ifdef H5_HAVE_PARALLEL MPI_Comm comm; /* MPI communicator for file */ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ diff --git a/src/H5Fio.c b/src/H5Fio.c index a4a6e01..d2d0dba 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -77,6 +77,50 @@ /*------------------------------------------------------------------------- + * Function: H5F_shared_block_read + * + * Purpose: Reads some data from a file/server/etc into a buffer. + * The data is contiguous. The address is relative to the base + * address for the file. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_read(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_read() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. @@ -122,6 +166,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_shared_block_write + * + * Purpose: Writes some data from memory to a file/server/etc. The + * data is contiguous. The address is relative to the base + * address. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * matzke@llnl.gov + * Jul 10 1997 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) +{ + H5FD_mem_t map_type; /* Mapped memory type */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(f_sh); + HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); + HDassert(buf); + HDassert(H5F_addr_defined(addr)); + + /* Check for attempting I/O on 'temporary' file address */ + if(H5F_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + + /* Pass through page buffer layer */ + if(H5PB_write(f_sh, map_type, addr, size, buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_shared_block_write() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_write * * Purpose: Writes some data from memory to a file/server/etc. The diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index cd38202..1b8d07c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -804,7 +804,9 @@ H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/); H5_DLL herr_t H5F_flush_mounts(H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ +H5_DLL herr_t H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Functions that flush or evict */ -- cgit v0.12 From 2ef7eb51b99a3e015efdecedd64c0be1ad77615c Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 20:38:10 -0500 Subject: Progress toward moving the dataset routines to using the 'shared' file pointer instead of the 'top' file pointer. --- src/H5Dchunk.c | 25 ++++++++++++++----------- src/H5Dint.c | 2 +- src/H5Dmpio.c | 6 +++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ec8ea4d..082aac3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -393,7 +393,6 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, H5D_chk_idx_info_t idx_info; /* Chunked index info */ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - H5D_io_info_t io_info; /* to hold the dset info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -401,13 +400,17 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, /* Sanity checks */ HDassert(layout->type == H5D_CHUNKED); - io_info.dset = dset; - /* Allocate dataspace and initialize it if it hasn't been. */ - if(!H5D__chunk_is_space_alloc(&layout->storage)) + if(!H5D__chunk_is_space_alloc(&layout->storage)) { + H5D_io_info_t io_info; /* to hold the dset info */ + + io_info.dset = dset; + io_info.f_sh = H5F_SHARED(dset->oloc.file); + /* Allocate storage */ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") + } /* end if */ /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); @@ -467,7 +470,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, } /* end if */ /* Write the data to the file */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -570,9 +573,9 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") /* Read the chunk data into the supplied buffer */ - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0) + if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") - + /* Return the filter mask */ *filters = udata.filter_mask; @@ -3332,7 +3335,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) /* Write the data to the file */ HDassert(H5F_addr_defined(udata.chunk_block.offset)); H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -3803,7 +3806,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, * size in memory, so allocate memory big enough. */ if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0) + if(H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") if(old_pline && old_pline->nused) { @@ -4533,7 +4536,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -4918,7 +4921,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") /* Low-level write (collective) */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0) + if(H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Barrier so processes don't race ahead */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 1e9c6ff..ada542e 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2932,7 +2932,7 @@ H5D__flush_sieve_buf(H5D_t *dataset) HDassert(dataset->shared->layout.type != H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ /* Write dirty data sieve buffer to file */ - if(H5F_block_write(dataset->oloc.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, + if(H5F_shared_block_write(H5F_SHARED(dataset->oloc.file), H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, dataset->shared->cache.contig.sieve_size, dataset->shared->cache.contig.sieve_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 467b1b7..0dbbe9f 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -457,7 +457,7 @@ H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATT FUNC_ENTER_PACKAGE H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.rbuf) < 0) + if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.rbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read") done: @@ -487,7 +487,7 @@ H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_AT /*OKAY: CAST DISCARDS CONST QUALIFIER*/ H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.wbuf) < 0) + if(H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->u.wbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write") done: @@ -3153,7 +3153,7 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk if(H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") - if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, chunk_entry->chunk_states.chunk_current.offset, + if(H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, chunk_entry->chunk_states.chunk_current.offset, chunk_entry->chunk_states.new_chunk.length, chunk_entry->buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data chunk") -- cgit v0.12 From 53eaeff26af649a1947f1b2889c3bf185b285112 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:07:13 -0500 Subject: Begin converting the H5MF interface to use shared file pointers instead of top file pointers. --- src/H5Fint.c | 2 +- src/H5Fprivate.h | 1 + src/H5MF.c | 104 ++++++++++++++++++++++++++++-------------------------- src/H5MFpkg.h | 17 ++++----- src/H5MFprivate.h | 2 +- test/mf.c | 39 ++++++++++---------- 6 files changed, 82 insertions(+), 83 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 4a0c397..f27a263 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1041,7 +1041,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ if(H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD") - if(H5MF_init_merge_flags(f) < 0) + if(H5MF_init_merge_flags(f->shared) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags") f->shared->tmp_addr = f->shared->maxaddr; /* Disable temp. space allocation for parallel I/O (for now) */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1b8d07c..f196ec0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -579,6 +579,7 @@ typedef struct H5F_t H5F_t; #define H5F_SDATA_BLOCK_SIZE_DEF 2048 /* Check for file using paged aggregation */ +#define H5F_SHARED_PAGED_AGGR(F_SH) ((F_SH)->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && (F_SH)->fs_page_size) #define H5F_PAGED_AGGR(F) (F->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE && F->shared->fs_page_size) /* Metadata read attempt values */ diff --git a/src/H5MF.c b/src/H5MF.c index b1467ff..626b0ec 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -55,6 +55,11 @@ if(!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ *CF = TRUE; +/* For non-paged aggregation: map allocation request type to tracked free-space type */ +/* F_SH -- pointer to H5F_file_t; T -- H5FD_mem_t */ +#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F_SH, T) \ + ((H5FD_MEM_DEFAULT == (F_SH)->fs_type_map[T]) ? (T) : (F_SH)->fs_type_map[T]) + /******************/ /* Local Typedefs */ /******************/ @@ -141,7 +146,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; *------------------------------------------------------------------------- */ herr_t -H5MF_init_merge_flags(H5F_t *f) +H5MF_init_merge_flags(H5F_file_t *f_sh) { H5MF_aggr_merge_t mapping_type; /* Type of free list mapping */ H5FD_mem_t type; /* Memory type for iteration */ @@ -151,9 +156,8 @@ H5MF_init_merge_flags(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + HDassert(f_sh); + HDassert(f_sh->lf); /* Iterate over all the free space types to determine if sections of that type * can merge with the metadata or small 'raw' data aggregator @@ -161,21 +165,21 @@ H5MF_init_merge_flags(H5F_t *f) all_same = TRUE; for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_DEFAULT]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; break; } /* end if */ /* Check for all allocation types mapping to the same free list type */ if(all_same) { - if(f->shared->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) + if(f_sh->fs_type_map[H5FD_MEM_DEFAULT] == H5FD_MEM_DEFAULT) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else mapping_type = H5MF_AGGR_MERGE_TOGETHER; } /* end if */ else { /* Check for raw data mapping into same list as metadata */ - if(f->shared->fs_type_map[H5FD_MEM_DRAW] == f->shared->fs_type_map[H5FD_MEM_SUPER]) + if(f_sh->fs_type_map[H5FD_MEM_DRAW] == f_sh->fs_type_map[H5FD_MEM_SUPER]) mapping_type = H5MF_AGGR_MERGE_SEPARATE; else { hbool_t all_metadata_same; /* Whether all metadata go in same free list */ @@ -188,7 +192,7 @@ H5MF_init_merge_flags(H5F_t *f) /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { /* Check for any different type mappings */ - if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_SUPER]) { + if(f_sh->fs_type_map[type] != f_sh->fs_type_map[H5FD_MEM_SUPER]) { all_metadata_same = FALSE; break; } /* end if */ @@ -206,30 +210,30 @@ H5MF_init_merge_flags(H5F_t *f) switch(mapping_type) { case H5MF_AGGR_MERGE_SEPARATE: /* Don't merge any metadata together */ - HDmemset(f->shared->fs_aggr_merge, 0, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, 0, sizeof(f_sh->fs_aggr_merge)); /* Check if merging raw data should be allowed */ /* (treat global heaps as raw data) */ - if(H5FD_MEM_DRAW == f->shared->fs_type_map[H5FD_MEM_DRAW] || - H5FD_MEM_DEFAULT == f->shared->fs_type_map[H5FD_MEM_DRAW]) { - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + if(H5FD_MEM_DRAW == f_sh->fs_type_map[H5FD_MEM_DRAW] || + H5FD_MEM_DEFAULT == f_sh->fs_type_map[H5FD_MEM_DRAW]) { + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; } /* end if */ break; case H5MF_AGGR_MERGE_DICHOTOMY: /* Merge all metadata together (but not raw data) */ - HDmemset(f->shared->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f_sh->fs_aggr_merge)); /* Allow merging raw data allocations together */ /* (treat global heaps as raw data) */ - f->shared->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; - f->shared->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_DRAW] = H5F_FS_MERGE_RAWDATA; + f_sh->fs_aggr_merge[H5FD_MEM_GHEAP] = H5F_FS_MERGE_RAWDATA; break; case H5MF_AGGR_MERGE_TOGETHER: /* Merge all allocation types together */ - HDmemset(f->shared->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f->shared->fs_aggr_merge)); + HDmemset(f_sh->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), sizeof(f_sh->fs_aggr_merge)); break; default: @@ -254,31 +258,32 @@ done: *------------------------------------------------------------------------- */ void -H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { FUNC_ENTER_PACKAGE_NOERR - HDassert(f); + /* Check arguments */ + HDassert(f_sh); HDassert(fs_type); - if(H5F_PAGED_AGGR(f)) { /* paged aggregation */ - if(size >= f->shared->fs_page_size) { - if(H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ + if(H5F_SHARED_PAGED_AGGR(f_sh)) { /* paged aggregation */ + if(size >= f_sh->fs_page_size) { + if(H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_PAGED_AGGR)) { /* multi or split driver */ /* For non-contiguous address space, map to large size free-space manager for each alloc_type */ - if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[alloc_type]) - *fs_type = (H5F_mem_page_t) (alloc_type + (H5FD_MEM_NTYPES - 1)); + if(H5FD_MEM_DEFAULT == f_sh->fs_type_map[alloc_type]) + *fs_type = (H5F_mem_page_t)(alloc_type + (H5FD_MEM_NTYPES - 1)); else - *fs_type = (H5F_mem_page_t) (f->shared->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); + *fs_type = (H5F_mem_page_t)(f_sh->fs_type_map[alloc_type] + (H5FD_MEM_NTYPES - 1)); } /* end if */ else /* For contiguous address space, map to generic large size free-space manager */ *fs_type = H5F_MEM_PAGE_GENERIC; /* H5F_MEM_PAGE_SUPER */ } /* end if */ else - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); } /* end if */ else /* non-paged aggregation */ - *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); + *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f_sh, alloc_type); FUNC_LEAVE_NOAPI_VOID } /* end H5MF__alloc_to_fs_type() */ @@ -620,7 +625,6 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__close_fstype() */ - /*------------------------------------------------------------------------- * Function: H5MF__add_sect @@ -649,7 +653,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio HDassert(fspace); HDassert(node); - H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, node->sect_info.size, &fs_type); /* Construct user data for callbacks */ udata.f = f; @@ -801,7 +805,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HDassert(f->shared->lf); HDassert(size > 0); - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.0\n", FUNC); @@ -907,10 +911,10 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); switch(ptype) { - case H5F_MEM_PAGE_GENERIC: + case H5F_MEM_PAGE_GENERIC: case H5F_MEM_PAGE_LARGE_BTREE: case H5F_MEM_PAGE_LARGE_DRAW: case H5F_MEM_PAGE_LARGE_GHEAP: @@ -1108,7 +1112,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_DONE(SUCCEED) HDassert(addr != 0); /* Can't deallocate the superblock :-) */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1325,7 +1329,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1476,7 +1480,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(sect_cls); /* Get free space type from allocation type */ - H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -2730,7 +2734,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2875,7 +2879,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -3119,8 +3123,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* should only be called if file is opened R/W */ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3136,8 +3140,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); @@ -3398,18 +3402,18 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); } /* end if */ else { - /* In principle, fsm_type should always be less than + /* In principle, fsm_type should always be less than * H5F_MEM_PAGE_LARGE_SUPER whenever paged aggregation * is not enabled. However, since there is code that does * not observe this principle, force the result to FALSE if @@ -3452,15 +3456,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) HDassert(f->shared); HDassert(fspace); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index ec4aab4..47ebc5c 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -55,11 +55,6 @@ #define H5MF_FSPACE_SECT_SMALL 1 /* For paged aggregation: "small" meta/raw data section which is < fsp_size) */ #define H5MF_FSPACE_SECT_LARGE 2 /* For paged aggregation: "large" Section which is >= fsp_size) */ -/* For non-paged aggregation: map allocation request type to tracked free-space type */ -/* F -- pointer to H5F_t; T -- H5FD_mem_t */ -#define H5MF_ALLOC_TO_FS_AGGR_TYPE(F, T) \ - ((H5FD_MEM_DEFAULT == (F)->shared->fs_type_map[T]) ? (T) : (F)->shared->fs_type_map[T]) - /* Get section class type based on size */ #define H5MF_SECT_CLASS_TYPE(F, S) \ ((H5F_PAGED_AGGR(F)) ? \ @@ -182,13 +177,10 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1]; /* Allocator routines */ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); - H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); - -H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); - -H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, + hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, @@ -206,6 +198,11 @@ H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); +/* Debugging routines */ +#ifdef H5MF_ALLOC_DEBUG_DUMP +H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); +#endif /* H5MF_ALLOC_DEBUG_DUMP */ + /* Testing routines */ #ifdef H5MF_TESTING #endif /* H5MF_TESTING */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index bd57f05..3569615 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -48,7 +48,7 @@ /***************************************/ /* File space manager routines */ -H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); +H5_DLL herr_t H5MF_init_merge_flags(H5F_file_t *f_sh); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f); H5_DLL herr_t H5MF_try_close(H5F_t *f); diff --git a/test/mf.c b/test/mf.c index fe98000..9317bd8 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6816,7 +6816,7 @@ test_mf_fs_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Verify that H5FD_MEM_SUPER free-space manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[tt])) @@ -6966,7 +6966,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE4))) FAIL_STACK_ERROR - + /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -6990,7 +6990,7 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE4, (H5F_mem_page_t *)&fs_type); /* Verify that the H5FD_MEM_SUPER free-space manager is not there */ if(H5F_addr_defined(f->shared->fs_addr[fs_type])) @@ -7163,7 +7163,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for FAIL_STACK_ERROR if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - + /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr1, (hsize_t)TBLOCK_SIZE1) < 0) FAIL_STACK_ERROR @@ -7185,7 +7185,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for if(NULL == (f = (H5F_t *)H5VL_object(file))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(file))) @@ -7195,7 +7195,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for hssize_t nsects; /* # of free-space sections */ int i; /* local index variable */ H5F_sect_info_t *sect_info; /* array to hold the free-space information */ - + /* Get the # of free-space sections in the file */ if((nsects = H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)0, NULL)) < 0) FAIL_STACK_ERROR @@ -7210,7 +7210,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for sect_info = (H5F_sect_info_t *)HDcalloc((size_t)nsects, sizeof(H5F_sect_info_t)); H5Fget_free_sections(file, H5FD_MEM_DEFAULT, (size_t)nsects, sect_info); - + /* Verify the size of free-space sections */ for(i = 0; i < nsects; i++) if(sect_info[i].size < fs_threshold) @@ -7336,13 +7336,12 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, (hsize_t)TBLOCK_SIZE6))) FAIL_STACK_ERROR - H5MF__alloc_to_fs_type(f, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); + H5MF__alloc_to_fs_type(f->shared, type, TBLOCK_SIZE6, (H5F_mem_page_t *)&tt); /* For paged aggregation, the section in the page at EOF for small meta fs is not shrunk away */ - if(fs_type == H5F_FSPACE_STRATEGY_PAGE) { + if(fs_type == H5F_FSPACE_STRATEGY_PAGE) if(H5FS_stat_info(f, f->shared->fs_man[tt], &fs_state) < 0) FAIL_STACK_ERROR - } /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */ if(H5MF_xfree(f, type, addr3, (hsize_t)TBLOCK_SIZE3) < 0) @@ -7637,7 +7636,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR - + /* Allocate 3 small metadata blocks: addr1, addr2, addr3 */ H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE30); addr2 = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034); @@ -7647,8 +7646,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_OHDR, addr2, (hsize_t)TBLOCK_SIZE1034); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, TBLOCK_SIZE1034, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with addr2 is found from the small metadata manager */ if(H5MF__find_sect(f, H5FD_MEM_OHDR, (hsize_t)TBLOCK_SIZE1034, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7680,8 +7678,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) H5MF_xfree(f, H5FD_MEM_DRAW, gaddr1, (hsize_t)TBLOCK_SIZE5000); if(!fs_persist) { - - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); /* Verify that the freed block with gaddr1 is found from the large data manager */ if(H5MF__find_sect(f, H5FD_MEM_DRAW, (hsize_t)TBLOCK_SIZE8192, f->shared->fs_man[fs_type], &found_addr) < 0) @@ -7702,18 +7699,18 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Re-open the file */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0) TEST_ERROR - + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5VL_object(fid))) TEST_ERROR /* Verify that the large generic manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR /* Verify that the small metadata manager is there */ - H5MF__alloc_to_fs_type(f, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_OHDR, f->shared->fs_page_size - 1, (H5F_mem_page_t *)&fs_type); if(!H5F_addr_defined(f->shared->fs_addr[fs_type])) TEST_ERROR @@ -7732,7 +7729,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) /* Verify that the small raw data manager is there */ if(!H5F_addr_defined(f->shared->fs_addr[H5F_MEM_PAGE_DRAW])) TEST_ERROR - + /* Set up to use the small raw data manager */ if(!(f->shared->fs_man[H5F_MEM_PAGE_DRAW])) if(H5MF__open_fstype(f, H5F_MEM_PAGE_DRAW) < 0) @@ -7744,7 +7741,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) if(found_addr != saddr1) TEST_ERROR - H5MF__alloc_to_fs_type(f, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); + H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type); if(!(f->shared->fs_man[fs_type])) /* Set up to use the large data manager */ @@ -7756,7 +7753,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl) TEST_ERROR if(found_addr != gaddr1) TEST_ERROR - + /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR -- cgit v0.12 From 901c42640ffc3439af2cfd3ed756216f967f8a67 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:32:13 -0500 Subject: Progress on moving the H5MF* interface to using shared file pointers instead of top file pointers. --- src/H5MF.c | 77 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index 626b0ec..40e954a 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -98,7 +98,7 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); -static hbool_t H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type); +static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); static hbool_t H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace); static herr_t H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); @@ -345,7 +345,7 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) } /* end else */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -433,7 +433,7 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) } /* end else */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -549,7 +549,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) f->shared->fs_state[type] = H5F_FS_STATE_DELETING; /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, type)) + if(H5MF__fsm_type_is_self_referential(f->shared, type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -812,7 +812,7 @@ HDfprintf(stderr, "%s: Check 1.0\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1115,7 +1115,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1332,7 +1332,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1483,7 +1483,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); /* Set the ring type in the API context */ - if(H5MF__fsm_type_is_self_referential(f, fs_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fs_type)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -1666,10 +1666,10 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * * The situation is further complicated if a cache image exists * and had not yet been loaded into the metadata cache. In this - * case, call H5AC_force_cache_image_load() instead of + * case, call H5AC_force_cache_image_load() instead of * H5MF_tidy_self_referential_fsm_hack(). H5AC_force_cache_image_load() - * will load the cache image, and then call - * H5MF_tidy_self_referential_fsm_hack() to discard the cache image + * will load the cache image, and then call + * H5MF_tidy_self_referential_fsm_hack() to discard the cache image * block. */ @@ -1683,12 +1683,12 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t ptype; /* Memory type for iteration */ - /* Iterate over all the free space types that have managers and - * get each free list's space + /* Iterate over all the free space types that have managers and + * get each free list's space */ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -1705,12 +1705,12 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); else { H5FD_mem_t type; /* Memory type for iteration */ - /* Iterate over all the free space types that have managers and - * get each free list's space + /* Iterate over all the free space types that have managers and + * get each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -1827,9 +1827,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; - else + else needed_ring = H5AC_RING_RDFSM; if(needed_ring != curr_ring) { @@ -1977,7 +1977,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* gather data for the free space manager superblock extension message. * Only need addresses of FSMs and eoa prior to allocation of - * file space for the self referential free space managers. Other + * file space for the self referential free space managers. Other * data was gathered above. */ for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) @@ -1993,7 +1993,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2128,7 +2128,7 @@ H5MF__close_shrink_eoa(H5F_t *f) for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ptype)) + if(H5MF__fsm_type_is_self_referential(f->shared, ptype)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2152,7 +2152,7 @@ H5MF__close_shrink_eoa(H5F_t *f) for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2272,7 +2272,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end if */ /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2302,7 +2302,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Close the free-space managers if they were opened earlier in this routine */ for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) + if(H5MF__fsm_type_is_self_referential(f->shared, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2408,7 +2408,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t size_t nums = 0; /* The number of free-space sections */ /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, ty)) + if(H5MF__fsm_type_is_self_referential(f->shared, ty)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2767,7 +2767,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) if(f->shared->fs_man[fsm_type]) { /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, fsm_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2893,7 +2893,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) HDassert(FALSE); /* Test to see if we need to switch rings -- do so if required */ - if(H5MF__fsm_type_is_self_referential(f, fsm_type)) + if(H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; @@ -2916,7 +2916,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * that this is also the deciding factor as to whether a FSM * in in the raw data FSM ring. */ - if(!H5MF__fsm_type_is_self_referential(f, fsm_type)) { + if(!H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) { /* The current ring should be H5AC_RING_RDFSM */ HDassert(curr_ring == H5AC_RING_RDFSM); @@ -3385,8 +3385,8 @@ H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspac * *------------------------------------------------------------------------- */ -hbool_t -H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) +static hbool_t +H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3394,20 +3394,19 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) H5F_mem_page_t lg_fssinfo_fsm; hbool_t result = FALSE; - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); - if(H5F_PAGED_AGGR(f)) { - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + if(H5F_SHARED_PAGED_AGGR(f_sh)) { + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, f_sh->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, f_sh->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); -- cgit v0.12 From d3545afbc5dc1c81616ff87d6667a45bbb6ce7a8 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 20 Aug 2019 21:55:16 -0500 Subject: Progress toward movig H5MF* API to use shared file pointers instead of top file pointers. --- src/H5MF.c | 71 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index 40e954a..a197979 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -99,8 +99,8 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); -static hbool_t H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace); -static herr_t H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +static hbool_t H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace); +static herr_t H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); /* Free-space type manager routines */ @@ -662,7 +662,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio udata.allow_eoa_shrink_only = FALSE; /* Set the ring type in the API context */ - if(H5MF__fsm_is_self_referential(f, fspace)) + if(H5MF__fsm_is_self_referential(f->shared, fspace)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -712,7 +712,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, HDassert(fspace); /* Set the ring type in the API context */ - if(H5MF__fsm_is_self_referential(f, fspace)) + if(H5MF__fsm_is_self_referential(f->shared, fspace)) fsm_ring = H5AC_RING_MDFSM; else fsm_ring = H5AC_RING_RDFSM; @@ -914,12 +914,12 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); switch(ptype) { - case H5F_MEM_PAGE_GENERIC: - case H5F_MEM_PAGE_LARGE_BTREE: - case H5F_MEM_PAGE_LARGE_DRAW: - case H5F_MEM_PAGE_LARGE_GHEAP: - case H5F_MEM_PAGE_LARGE_LHEAP: - case H5F_MEM_PAGE_LARGE_OHDR: + case H5F_MEM_PAGE_GENERIC: + case H5F_MEM_PAGE_LARGE_BTREE: + case H5F_MEM_PAGE_LARGE_DRAW: + case H5F_MEM_PAGE_LARGE_GHEAP: + case H5F_MEM_PAGE_LARGE_LHEAP: + case H5F_MEM_PAGE_LARGE_OHDR: { haddr_t eoa; /* EOA for the file */ hsize_t frag_size = 0; /* Fragment size */ @@ -956,7 +956,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ } break; - case H5F_MEM_PAGE_META: + case H5F_MEM_PAGE_META: case H5F_MEM_PAGE_DRAW: case H5F_MEM_PAGE_BTREE: case H5F_MEM_PAGE_GHEAP: @@ -984,13 +984,13 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ node = NULL; - /* Insert the new page into the Page Buffer list of new pages so + /* Insert the new page into the Page Buffer list of new pages so we don't read an empty page from disk */ if(f->shared->page_buf != NULL && H5PB_add_new_page(f->shared, alloc_type, new_page) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't add new page to Page Buffer new page list") ret_value = new_page; - } + } break; case H5F_MEM_PAGE_NTYPES: @@ -1556,11 +1556,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") - } + } /* end if */ else { if((ret_value = H5MF__close_aggrfs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") - } + } /* end else */ done: #ifdef H5MF_ALLOC_DEBUG @@ -3281,14 +3281,13 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) lg_sinfo_fspace = f->shared->fs_man[lg_fssinfo_fs_type]; } - if(H5MF__continue_alloc_fsm(f, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) + if(H5MF__continue_alloc_fsm(f->shared, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") - } while(continue_alloc_fsm); /* All free space managers should have file space allocated for them - * now, and should see no further allocations / deallocations. + * now, and should see no further allocations / deallocations. * For backward compatibility, store the eoa in f->shared->eoa_fsm_fsalloc * which will be set to fsinfo.eoa_pre_fsm_fsalloc when we actually write * the free-space info message to the superblock extension. @@ -3296,7 +3295,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * the new solution. */ /* Get the eoa after allocation of file space for the self referential - * free space managers. Assuming no cache image, this should be the + * free space managers. Assuming no cache image, this should be the * final EOA of the file. */ if(HADDR_UNDEF == (eoa_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) @@ -3331,14 +3330,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(continue_alloc_fsm); /* Check sm_hdr_fspace */ @@ -3353,7 +3351,7 @@ H5MF__continue_alloc_fsm(H5F_t *f, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspac } } - if(H5F_PAGED_AGGR(f) && !(*continue_alloc_fsm)) { + if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); @@ -3442,7 +3440,7 @@ H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) +H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3451,28 +3449,27 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + HDassert(f_sh); HDassert(fspace); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); - if(H5F_PAGED_AGGR(f)) { + if(H5F_SHARED_PAGED_AGGR(f_sh)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, f_sh->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, f_sh->fs_page_size + 1, &lg_fssinfo_fsm); - result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || - (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || - (fspace == f->shared->fs_man[lg_fshdr_fsm]) || - (fspace == f->shared->fs_man[lg_fssinfo_fsm]); + result = (fspace == f_sh->fs_man[sm_fshdr_fsm]) || + (fspace == f_sh->fs_man[sm_fssinfo_fsm]) || + (fspace == f_sh->fs_man[lg_fshdr_fsm]) || + (fspace == f_sh->fs_man[lg_fssinfo_fsm]); } /* end if */ else - result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || - (fspace == f->shared->fs_man[sm_fssinfo_fsm]); + result = (fspace == f_sh->fs_man[sm_fshdr_fsm]) || + (fspace == f_sh->fs_man[sm_fssinfo_fsm]); FUNC_LEAVE_NOAPI(result) } /* H5MF__fsm_is_self_referential() */ -- cgit v0.12 From 0de0965c61823186ac61c0d6876d4d77578e5bcc Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Tue, 20 Aug 2019 22:02:12 -0500 Subject: Fix issue in H5Lcreate_hard and H5Olink where entire H5VL_loc_params_t structure was passed via varargs --- src/H5L.c | 2 +- src/H5O.c | 2 +- src/H5VLnative_link.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/H5L.c b/src/H5L.c index 98976a6..24836d2 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -578,7 +578,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (vol_obj1 ? vol_obj1->data : NULL), loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (vol_obj1 ? vol_obj1->data : NULL), &loc_params1) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") done: diff --git a/src/H5O.c b/src/H5O.c index e7351fc..bf2d799 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -367,7 +367,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector); /* Create a link to the object */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") done: diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c index 4709eb3..5d5935d 100644 --- a/src/H5VLnative_link.c +++ b/src/H5VLnative_link.c @@ -58,15 +58,15 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, H5G_loc_t cur_loc; H5G_loc_t link_loc; void *cur_obj = HDva_arg(arguments, void *); - H5VL_loc_params_t cur_params = HDva_arg(arguments, H5VL_loc_params_t); + H5VL_loc_params_t *cur_params = HDva_arg(arguments, H5VL_loc_params_t *); - if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params.obj_type, &cur_loc) < 0) + if(NULL != cur_obj && H5G_loc_real(cur_obj, cur_params->obj_type, &cur_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") if(NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* H5Lcreate_hard */ - if(H5VL_OBJECT_BY_NAME == cur_params.type) { + if(H5VL_OBJECT_BY_NAME == cur_params->type) { H5G_loc_t *cur_loc_p, *link_loc_p; /* Set up current & new location pointers */ @@ -80,7 +80,7 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") /* Create the link */ - if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, + if((ret_value = H5L_create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ -- cgit v0.12 From 0b85fa6004cb96d222329614fa446b98cfcc06ea Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 21 Aug 2019 15:34:43 -0500 Subject: Small tidy up. --- src/H5MF.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/H5MF.c b/src/H5MF.c index a197979..0ee26c1 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -3342,29 +3342,27 @@ H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sin /* Check sm_hdr_fspace */ if(sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) { H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } + } /* end if */ - if(!(*continue_alloc_fsm)) { + if(!(*continue_alloc_fsm)) if(sm_sinfo_fspace && sm_sinfo_fspace != sm_hdr_fspace && sm_sinfo_fspace->serial_sect_count > 0 && sm_sinfo_fspace->sinfo) { H5MF_CHECK_FSM(sm_hdr_fspace, continue_alloc_fsm); - } - } + } /* end if */ if(H5F_SHARED_PAGED_AGGR(f_sh) && !(*continue_alloc_fsm)) { /* Check lg_hdr_fspace */ if(lg_hdr_fspace && lg_hdr_fspace->serial_sect_count > 0 && lg_hdr_fspace->sinfo) { H5MF_CHECK_FSM(lg_hdr_fspace, continue_alloc_fsm); - } + } /* end if */ /* Check lg_sinfo_fspace */ - if(!(*continue_alloc_fsm)) { + if(!(*continue_alloc_fsm)) if(lg_sinfo_fspace && lg_sinfo_fspace != lg_hdr_fspace && - lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { + lg_sinfo_fspace->serial_sect_count > 0 && lg_sinfo_fspace->sinfo) { H5MF_CHECK_FSM(lg_sinfo_fspace, continue_alloc_fsm); - } - } - } + } /* end if */ + } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5MF__continue_alloc_fsm() */ -- cgit v0.12 From c36d2eeae7eac6012b2061e308040ea260f4f392 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Aug 2019 13:28:20 -0500 Subject: Switch shared file struct name from 'H5F_file_t' to 'H5F_shared_t', to match naming convention for shared structs in rest of library data structures. --- src/.indent.pro | 2 +- src/H5Dcontig.c | 12 ++++++------ src/H5Dpkg.h | 2 +- src/H5Faccum.c | 10 +++++----- src/H5Fcwfs.c | 2 +- src/H5Fefc.c | 24 ++++++++++++------------ src/H5Ffake.c | 4 ++-- src/H5Fint.c | 20 ++++++++++---------- src/H5Fio.c | 4 ++-- src/H5Fmpi.c | 2 +- src/H5Fpkg.h | 36 ++++++++++++++++++------------------ src/H5Fprivate.h | 18 +++++++++--------- src/H5Fquery.c | 10 +++++----- src/H5Fsfile.c | 12 ++++++------ src/H5HGpkg.h | 4 ++-- src/H5MF.c | 18 +++++++++--------- src/H5MFpkg.h | 2 +- src/H5MFprivate.h | 2 +- src/H5PB.c | 24 ++++++++++++------------ src/H5PBprivate.h | 14 +++++++------- 20 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/.indent.pro b/src/.indent.pro index e0fda85..fa375f0 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -68,7 +68,7 @@ -T H5E_minor_t -T H5E_t -T H5F_create_t --T H5F_file_t +-T H5F_shared_t -T H5F_isop_t -T H5F_istore_key_t -T H5F_istore_ud1_t diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 8f7a7ca..c9f9fc2 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -58,7 +58,7 @@ /* Callback info for sieve buffer readvv operation */ typedef struct H5D_contig_readvv_sieve_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *rbuf; /* Pointer to buffer to fill */ @@ -66,14 +66,14 @@ typedef struct H5D_contig_readvv_sieve_ud_t { /* Callback info for [plain] readvv operation */ typedef struct H5D_contig_readvv_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ unsigned char *rbuf; /* Pointer to buffer to fill */ } H5D_contig_readvv_ud_t; /* Callback info for sieve buffer writevv operation */ typedef struct H5D_contig_writevv_sieve_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *wbuf; /* Pointer to buffer to write */ @@ -81,7 +81,7 @@ typedef struct H5D_contig_writevv_sieve_ud_t { /* Callback info for [plain] writevv operation */ typedef struct H5D_contig_writevv_ud_t { - H5F_file_t *f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh; /* Shared file for dataset */ haddr_t dset_addr; /* Address of dataset */ const unsigned char *wbuf; /* Pointer to buffer to write */ } H5D_contig_writevv_ud_t; @@ -718,7 +718,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_readvv_sieve_ud_t *udata = (H5D_contig_readvv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ unsigned char *buf; /* Pointer to buffer to fill */ @@ -983,7 +983,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) { H5D_contig_writevv_sieve_ud_t *udata = (H5D_contig_writevv_sieve_ud_t *)_udata; /* User data for H5VM_opvv() operator */ - H5F_file_t *f_sh = udata->f_sh; /* Shared file for dataset */ + H5F_shared_t *f_sh = udata->f_sh; /* Shared file for dataset */ H5D_rdcdc_t *dset_contig = udata->dset_contig; /* Cached information about contiguous data */ const H5D_contig_storage_t *store_contig = udata->store_contig; /* Contiguous storage info for this I/O operation */ const unsigned char *buf; /* Pointer to buffer to fill */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 878fda3..ed3bc12 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -210,7 +210,7 @@ typedef enum H5D_io_op_type_t { typedef struct H5D_io_info_t { const H5D_t *dset; /* Pointer to dataset being operated on */ /* QAK: Delete the f_sh field when oloc has a shared file pointer? */ - H5F_file_t *f_sh; /* Pointer to shared file struct that dataset is within */ + H5F_shared_t *f_sh; /* Pointer to shared file struct that dataset is within */ #ifdef H5_HAVE_PARALLEL MPI_Comm comm; /* MPI communicator for file */ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index c2724b1..74a170b 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -111,7 +111,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); *------------------------------------------------------------------------- */ herr_t -H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_t *file; /* File driver pointer */ @@ -419,7 +419,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t map_type, haddr_t addr, +H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t size, const void *buf) { H5FD_t *file; /* File driver pointer */ @@ -847,7 +847,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_free(H5F_file_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, +H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr, hsize_t size) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ @@ -1013,7 +1013,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_flush(H5F_file_t *f_sh) +H5F__accum_flush(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1056,7 +1056,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush) +H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c index aa5f8ab..26452b6 100644 --- a/src/H5Fcwfs.c +++ b/src/H5Fcwfs.c @@ -299,7 +299,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_cwfs_remove_heap(H5F_file_t *shared, H5HG_heap_t *heap) +H5F_cwfs_remove_heap(H5F_shared_t *shared, H5HG_heap_t *heap) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fefc.c b/src/H5Fefc.c index f3881d4..66d68b2 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -60,14 +60,14 @@ struct H5F_efc_t { unsigned max_nfiles; /* Maximum size of the external file cache */ unsigned nrefs; /* Number of times this file appears in another file's EFC */ int tag; /* Temporary variable used by H5F__efc_try_close() */ - H5F_file_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */ + H5F_shared_t *tmp_next; /* Next file in temporary list used by H5F__efc_try_close() */ }; /* Private prototypes */ static herr_t H5F__efc_release_real(H5F_efc_t *efc); static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent); -static void H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail); -static void H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail); +static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail); +static void H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail); /* Free lists */ H5FL_DEFINE_STATIC(H5F_efc_ent_t); @@ -644,10 +644,10 @@ done: *------------------------------------------------------------------------- */ static void -H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail) +H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) { H5F_efc_ent_t *ent = NULL; /* EFC entry */ - H5F_file_t *esf; /* Convenience pointer to ent->file->shared */ + H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */ FUNC_ENTER_STATIC_NOERR @@ -718,10 +718,10 @@ H5F__efc_try_close_tag1(H5F_file_t *sf, H5F_file_t **tail) *------------------------------------------------------------------------- */ static void -H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail) +H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail) { H5F_efc_ent_t *ent = NULL; /* EFC entry */ - H5F_file_t *esf; /* Convenience pointer to ent->file->shared */ + H5F_shared_t *esf; /* Convenience pointer to ent->file->shared */ FUNC_ENTER_STATIC_NOERR @@ -827,11 +827,11 @@ H5F__efc_try_close_tag2(H5F_file_t *sf, H5F_file_t **tail) herr_t H5F__efc_try_close(H5F_t *f) { - H5F_file_t *tail; /* Tail of linked list of found files. Head will be f->shared. */ - H5F_file_t *uncloseable_head = NULL; /* Head of linked list of files found to be uncloseable by the first pass */ - H5F_file_t *uncloseable_tail = NULL; /* Tail of linked list of files found to be uncloseable by the first pass */ - H5F_file_t *sf; /* Temporary file pointer */ - H5F_file_t *next; /* Temporary file pointer */ + H5F_shared_t *tail; /* Tail of linked list of found files. Head will be f->shared. */ + H5F_shared_t *uncloseable_head = NULL; /* Head of linked list of files found to be uncloseable by the first pass */ + H5F_shared_t *uncloseable_tail = NULL; /* Tail of linked list of files found to be uncloseable by the first pass */ + H5F_shared_t *sf; /* Temporary file pointer */ + H5F_shared_t *next; /* Temporary file pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 6072f2e..67bd180 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -50,7 +50,7 @@ H5F_fake_alloc(uint8_t sizeof_size) /* Allocate faked file struct */ if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t))) + if(NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") /* Only set fields necessary for clients */ @@ -93,7 +93,7 @@ H5F_fake_free(H5F_t *f) if(f) { /* Destroy shared file struct */ if(f->shared) - f->shared = H5FL_FREE(H5F_file_t, f->shared); + f->shared = H5FL_FREE(H5F_shared_t, f->shared); f = H5FL_FREE(H5F_t, f); } /* end if */ diff --git a/src/H5Fint.c b/src/H5Fint.c index f27a263..9b31d7e 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -58,7 +58,7 @@ typedef struct H5F_olist_t { struct { hbool_t local; /* Set flag for "local" file searches */ union { - H5F_file_t *shared; /* Pointer to shared file to look inside */ + H5F_shared_t *shared; /* Pointer to shared file to look inside */ const H5F_t *file; /* Pointer to file to look inside */ } ptr; } file_info; @@ -81,7 +81,7 @@ static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); -static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); +static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -104,8 +104,8 @@ static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); /* Declare a free list to manage the H5F_t struct */ H5FL_DEFINE(H5F_t); -/* Declare a free list to manage the H5F_file_t struct */ -H5FL_DEFINE(H5F_file_t); +/* Declare a free list to manage the H5F_shared_t struct */ +H5FL_DEFINE(H5F_shared_t); @@ -901,7 +901,7 @@ done: *------------------------------------------------------------------------- */ static H5F_t * -H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) +H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { H5F_t *f = NULL; H5F_t *ret_value = NULL; @@ -922,7 +922,7 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ size_t u; /* Local index variable */ HDassert(lf != NULL); - if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t))) + if(NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") f->shared->flags = flags; @@ -1141,7 +1141,7 @@ done: if(H5I_dec_ref(f->shared->fcpl_id) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list") - f->shared = H5FL_FREE(H5F_file_t, f->shared); + f->shared = H5FL_FREE(H5F_shared_t, f->shared); } f = H5FL_FREE(H5F_t, f); } @@ -1390,7 +1390,7 @@ H5F__dest(H5F_t *f, hbool_t flush) f->shared->retries[actype] = (uint32_t *)H5MM_xfree(f->shared->retries[actype]); /* Destroy shared file struct */ - f->shared = (H5F_file_t *)H5FL_FREE(H5F_file_t, f->shared); + f->shared = (H5F_shared_t *)H5FL_FREE(H5F_shared_t, f->shared); } else if(f->shared->nrefs > 0) { @@ -1491,7 +1491,7 @@ H5F_t * H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *file = NULL; /*the success return value */ - H5F_file_t *shared = NULL; /*shared part of `file' */ + H5F_shared_t *shared = NULL; /*shared part of `file' */ H5FD_t *lf = NULL; /*file driver part of `shared' */ unsigned tent_flags; /*tentative flags */ H5FD_class_t *drvr; /*file driver class info */ @@ -2181,7 +2181,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) */ /* Destroy the H5F_t struct and decrement the reference count for the - * shared H5F_file_t struct. If the reference count for the H5F_file_t + * shared H5F_shared_t struct. If the reference count for the H5F_shared_t * struct reaches zero then destroy it also. */ if(H5F__dest(f, TRUE) < 0) diff --git a/src/H5Fio.c b/src/H5Fio.c index d2d0dba..34dd0d6 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -92,7 +92,7 @@ *------------------------------------------------------------------------- */ herr_t -H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ @@ -181,7 +181,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) +H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 56f9547..4c0104a 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -184,7 +184,7 @@ done: *------------------------------------------------------------------------- */ int -H5F_shared_mpi_get_size(const H5F_file_t *f_sh) +H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) { int ret_value = -1; diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e7eca3..42c9a828 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -217,7 +217,7 @@ typedef struct H5F_mtab_t { } H5F_mtab_t; /* Structure specifically to store superblock. This was originally - * maintained entirely within H5F_file_t, but is now extracted + * maintained entirely within H5F_shared_t, but is now extracted * here because the superblock is now handled by the cache */ typedef struct H5F_super_t { H5AC_info_t cache_info; /* Cache entry information structure */ @@ -238,11 +238,11 @@ typedef struct H5F_super_t { /* * Define the structure to store the file information for HDF5 files. One of * these structures is allocated per file, not per H5Fopen(). That is, set of - * H5F_t structs can all point to the same H5F_file_t struct. The `nrefs' + * H5F_t structs can all point to the same H5F_shared_t struct. The `nrefs' * count in this struct indicates the number of H5F_t structs which are * pointing to this struct. */ -struct H5F_file_t { +struct H5F_shared_t { H5FD_t *lf; /* Lower level file handle for I/O */ H5F_super_t *sblock; /* Pointer to (pinned) superblock for file */ H5O_drvinfo_t *drvinfo; /* Pointer to the (pinned) driver info @@ -362,14 +362,14 @@ struct H5F_file_t { /* * This is the top-level file descriptor. One of these structures is * allocated every time H5Fopen() is called although they may contain pointers - * to shared H5F_file_t structs. + * to shared H5F_shared_t structs. */ struct H5F_t { - char *open_name; /* Name used to open file */ - char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ + char *open_name; /* Name used to open file */ + char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ char *extpath; /* Path for searching target external link file */ - H5F_file_t *shared; /* The shared file info */ - unsigned nopen_objs; /* Number of open object headers */ + H5F_shared_t *shared; /* The shared file info */ + unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ hbool_t id_exists; /* Whether an ID for this struct exists */ hbool_t closing; /* File is in the process of being closed */ @@ -388,8 +388,8 @@ struct H5F_t { /* Declare a free list to manage the H5F_t struct */ H5FL_EXTERN(H5F_t); -/* Declare a free list to manage the H5F_file_t struct */ -H5FL_EXTERN(H5F_file_t); +/* Declare a free list to manage the H5F_shared_t struct */ +H5FL_EXTERN(H5F_shared_t); /******************************/ @@ -429,16 +429,16 @@ H5_DLL herr_t H5F__super_ext_remove_msg(H5F_t *f, unsigned id); H5_DLL herr_t H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created); /* Metadata accumulator routines */ -H5_DLL herr_t H5F__accum_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); -H5_DLL herr_t H5F__accum_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5F__accum_free(H5F_file_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); -H5_DLL herr_t H5F__accum_flush(H5F_file_t *f_sh); -H5_DLL herr_t H5F__accum_reset(H5F_file_t *f_sh, hbool_t flush); +H5_DLL herr_t H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf); +H5_DLL herr_t H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F__accum_free(H5F_shared_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size); +H5_DLL herr_t H5F__accum_flush(H5F_shared_t *f_sh); +H5_DLL herr_t H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush); /* Shared file list related routines */ -H5_DLL herr_t H5F__sfile_add(H5F_file_t *shared); -H5_DLL H5F_file_t *H5F__sfile_search(H5FD_t *lf); -H5_DLL herr_t H5F__sfile_remove(H5F_file_t *shared); +H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared); +H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf); +H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index f196ec0..867db84 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -656,7 +656,7 @@ struct H5P_genplist_t; /* Forward declarations for anonymous H5F objects */ /* Main file structures */ -typedef struct H5F_file_t H5F_file_t; +typedef struct H5F_shared_t H5F_shared_t; /* Block aggregation structure */ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; @@ -728,12 +728,12 @@ H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type, hbool_t app_ref); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f); -H5_DLL unsigned H5F_shared_get_intent(const H5F_file_t *f); +H5_DLL unsigned H5F_shared_get_intent(const H5F_shared_t *f); H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL char *H5F_get_open_name(const H5F_t *f); H5_DLL char *H5F_get_actual_name(const H5F_t *f); H5_DLL char *H5F_get_extpath(const H5F_t *f); -H5_DLL H5F_file_t *H5F_get_shared(const H5F_t *f); +H5_DLL H5F_shared_t *H5F_get_shared(const H5F_t *f); H5_DLL hbool_t H5F_same_shared(const H5F_t *f1, const H5F_t *f2); H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); @@ -792,9 +792,9 @@ H5_DLL char *H5F_mdc_log_location(const H5F_t *f); /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); -H5_DLL hbool_t H5F_shared_has_feature(const H5F_file_t *f, unsigned feature); +H5_DLL hbool_t H5F_shared_has_feature(const H5F_shared_t *f, unsigned feature); H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); -H5_DLL haddr_t H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type); +H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); @@ -805,9 +805,9 @@ H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc/*in,out*/); H5_DLL herr_t H5F_flush_mounts(H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ -H5_DLL herr_t H5F_shared_block_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); -H5_DLL herr_t H5F_shared_block_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); H5_DLL herr_t H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Functions that flush or evict */ @@ -847,7 +847,7 @@ H5_DLL herr_t H5F_eoa_dirty(H5F_t *f); H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); -H5_DLL int H5F_shared_mpi_get_size(const H5F_file_t *f_sh); +H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); @@ -864,7 +864,7 @@ H5_DLL H5F_t *H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix H5_DLL herr_t H5F_cwfs_add(H5F_t *f, struct H5HG_heap_t *heap); H5_DLL herr_t H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr); H5_DLL herr_t H5F_cwfs_advance_heap(H5F_t *f, struct H5HG_heap_t *heap, hbool_t add_heap); -H5_DLL herr_t H5F_cwfs_remove_heap(H5F_file_t *shared, struct H5HG_heap_t *heap); +H5_DLL herr_t H5F_cwfs_remove_heap(H5F_shared_t *shared, struct H5HG_heap_t *heap); /* Debugging functions */ H5_DLL herr_t H5F_debug(H5F_t *f, FILE * stream, int indent, int fwidth); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 5b5f748..c885561 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -79,13 +79,13 @@ * * Purpose: Quick and dirty routine to retrieve the file's 'intent' flags * (Mainly added to stop non-file routines from poking about in the - * H5F_file_t data structure) + * H5F_shared_t data structure) * * Return: 'intent' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ unsigned -H5F_shared_get_intent(const H5F_file_t *f_sh) +H5F_shared_get_intent(const H5F_shared_t *f_sh) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -243,7 +243,7 @@ H5F_get_extpath(const H5F_t *f) * Return: 'shared' on success/abort on failure (shouldn't fail) *------------------------------------------------------------------------- */ -H5F_file_t * +H5F_shared_t * H5F_get_shared(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ @@ -858,7 +858,7 @@ H5F_store_msg_crt_idx(const H5F_t *f) *------------------------------------------------------------------------- */ hbool_t -H5F_shared_has_feature(const H5F_file_t *f_sh, unsigned feature) +H5F_shared_has_feature(const H5F_shared_t *f_sh, unsigned feature) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -955,7 +955,7 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5F_shared_get_eoa(const H5F_file_t *f_sh, H5FD_mem_t type) +H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type) { haddr_t ret_value = HADDR_UNDEF; /* Return value */ diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index ebc2ab2..9a9bbab 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -24,7 +24,7 @@ /* Struct for tracking "shared" file structs */ typedef struct H5F_sfile_node_t { - H5F_file_t *shared; /* Pointer to "shared" file struct */ + H5F_shared_t *shared; /* Pointer to "shared" file struct */ struct H5F_sfile_node_t *next; /* Pointer to next node */ } H5F_sfile_node_t; @@ -96,9 +96,9 @@ H5F_sfile_assert_num(unsigned n) *------------------------------------------------------------------------- */ herr_t -H5F__sfile_add(H5F_file_t *shared) +H5F__sfile_add(H5F_shared_t *shared) { - H5F_sfile_node_t *new_shared; /* New shared file node */ + H5F_sfile_node_t *new_shared; /* New shared file node */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -135,11 +135,11 @@ done: * *------------------------------------------------------------------------- */ -H5F_file_t * +H5F_shared_t * H5F__sfile_search(H5FD_t *lf) { H5F_sfile_node_t *curr; /* Current shared file node */ - H5F_file_t *ret_value = NULL; /* Return value */ + H5F_shared_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE_NOERR @@ -175,7 +175,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__sfile_remove(H5F_file_t *shared) +H5F__sfile_remove(H5F_shared_t *shared) { H5F_sfile_node_t *curr; /* Current shared file node */ H5F_sfile_node_t *last; /* Last shared file node */ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 4ed9b10..3119de4 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -117,7 +117,7 @@ typedef struct H5HG_obj_t { } H5HG_obj_t; /* Forward declarations for fields */ -struct H5F_file_t; +struct H5F_shared_t; struct H5HG_heap_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ @@ -130,7 +130,7 @@ struct H5HG_heap_t { /* If this value is >65535 then all indices */ /* have been used at some time and the */ /* correct new index should be searched for */ - struct H5F_file_t *shared; /* shared file */ + struct H5F_shared_t *shared; /* shared file */ H5HG_obj_t *obj; /*array of object descriptions */ }; diff --git a/src/H5MF.c b/src/H5MF.c index 0ee26c1..14be37a 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -56,7 +56,7 @@ *CF = TRUE; /* For non-paged aggregation: map allocation request type to tracked free-space type */ -/* F_SH -- pointer to H5F_file_t; T -- H5FD_mem_t */ +/* F_SH -- pointer to H5F_shared_t; T -- H5FD_mem_t */ #define H5MF_ALLOC_TO_FS_AGGR_TYPE(F_SH, T) \ ((H5FD_MEM_DEFAULT == (F_SH)->fs_type_map[T]) ? (T) : (F_SH)->fs_type_map[T]) @@ -98,9 +98,9 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f); /* General routines */ static herr_t H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, size_t *nums); -static hbool_t H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type); -static hbool_t H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace); -static herr_t H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +static hbool_t H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type); +static hbool_t H5MF__fsm_is_self_referential(H5F_shared_t *f_sh, H5FS_t *fspace); +static herr_t H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm); /* Free-space type manager routines */ @@ -146,7 +146,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; *------------------------------------------------------------------------- */ herr_t -H5MF_init_merge_flags(H5F_file_t *f_sh) +H5MF_init_merge_flags(H5F_shared_t *f_sh) { H5MF_aggr_merge_t mapping_type; /* Type of free list mapping */ H5FD_mem_t type; /* Memory type for iteration */ @@ -258,7 +258,7 @@ done: *------------------------------------------------------------------------- */ void -H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { FUNC_ENTER_PACKAGE_NOERR @@ -3330,7 +3330,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, +H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sinfo_fspace, H5FS_t *lg_hdr_fspace, H5FS_t *lg_sinfo_fspace, hbool_t *continue_alloc_fsm) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -3382,7 +3382,7 @@ H5MF__continue_alloc_fsm(H5F_file_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_sin *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) +H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; @@ -3438,7 +3438,7 @@ H5MF__fsm_type_is_self_referential(H5F_file_t *f_sh, H5F_mem_page_t fsm_type) *------------------------------------------------------------------------- */ static hbool_t -H5MF__fsm_is_self_referential(H5F_file_t *f_sh, H5FS_t *fspace) +H5MF__fsm_is_self_referential(H5F_shared_t *f_sh, H5FS_t *fspace) { H5F_mem_page_t sm_fshdr_fsm; H5F_mem_page_t sm_fssinfo_fsm; diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 47ebc5c..fc398db 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -179,7 +179,7 @@ H5_DLL herr_t H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); -H5_DLL void H5MF__alloc_to_fs_type(H5F_file_t *f_sh, H5FD_mem_t alloc_type, +H5_DLL void H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 3569615..de1bdfb 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -48,7 +48,7 @@ /***************************************/ /* File space manager routines */ -H5_DLL herr_t H5MF_init_merge_flags(H5F_file_t *f_sh); +H5_DLL herr_t H5MF_init_merge_flags(H5F_shared_t *f_sh); H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f); H5_DLL herr_t H5MF_try_close(H5F_t *f); diff --git a/src/H5PB.c b/src/H5PB.c index 42c1cba..6c83217 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -124,8 +124,8 @@ typedef struct { /* Local Prototypes */ /********************/ static herr_t H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry); -static htri_t H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); -static herr_t H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry); +static htri_t H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type); +static herr_t H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry); /*********************/ @@ -289,7 +289,7 @@ H5PB_print_stats(const H5PB_t *page_buf) *------------------------------------------------------------------------- */ herr_t -H5PB_create(H5F_file_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) +H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc) { H5PB_t *page_buf = NULL; herr_t ret_value = SUCCEED; /* Return value */ @@ -369,7 +369,7 @@ static herr_t H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) { H5PB_entry_t *page_entry = (H5PB_entry_t *)item; /* Pointer to page entry node */ - H5F_file_t *f_sh = (H5F_file_t *)_op_data; + H5F_shared_t *f_sh = (H5F_shared_t *)_op_data; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -400,7 +400,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_flush(H5F_file_t *f_sh) +H5PB_flush(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -472,7 +472,7 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) *------------------------------------------------------------------------- */ herr_t -H5PB_dest(H5F_file_t *f_sh) +H5PB_dest(H5F_shared_t *f_sh) { herr_t ret_value = SUCCEED; /* Return value */ @@ -529,7 +529,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr) +H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) { H5PB_t *page_buf; /* Page buffer to operate on */ H5PB_entry_t *page_entry = NULL; /* Pointer to the corresponding page entry */ @@ -637,7 +637,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) *------------------------------------------------------------------------- */ herr_t -H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr) +H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr) { H5PB_t *page_buf; /* Page buffer to operate on */ H5PB_entry_t *page_entry = NULL; /* Pointer to the page entry being searched */ @@ -687,7 +687,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) +H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/) { H5PB_t *page_buf; /* Page buffering info for this file */ H5PB_entry_t *page_entry; /* Pointer to the corresponding page entry */ @@ -984,7 +984,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, +H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf) { H5PB_t *page_buf; /* Page buffering info for this file */ @@ -1375,7 +1375,7 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5PB__make_space(H5F_file_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) +H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) { H5PB_entry_t *page_entry; /* Pointer to page eviction candidate */ htri_t ret_value = TRUE; /* Return value */ @@ -1474,7 +1474,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5PB__write_entry(H5F_file_t *f_sh, H5PB_entry_t *page_entry) +H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry) { haddr_t eoa; /* Current EOA for the file */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h index 8bca219..82d010d 100644 --- a/src/H5PBprivate.h +++ b/src/H5PBprivate.h @@ -85,14 +85,14 @@ typedef struct H5PB_t { /***************************************/ /* General routines */ -H5_DLL herr_t H5PB_create(H5F_file_t *f_sh, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); -H5_DLL herr_t H5PB_flush(H5F_file_t *f_sh); -H5_DLL herr_t H5PB_dest(H5F_file_t *f_sh); -H5_DLL herr_t H5PB_add_new_page(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t page_addr); +H5_DLL herr_t H5PB_create(H5F_shared_t *f_sh, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc); +H5_DLL herr_t H5PB_flush(H5F_shared_t *f_sh); +H5_DLL herr_t H5PB_dest(H5F_shared_t *f_sh); +H5_DLL herr_t H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr); H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5PB_remove_entry(const H5F_file_t *f_sh, haddr_t addr); -H5_DLL herr_t H5PB_read(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); -H5_DLL herr_t H5PB_write(H5F_file_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); +H5_DLL herr_t H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr); +H5_DLL herr_t H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/); +H5_DLL herr_t H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); /* Statistics routines */ H5_DLL herr_t H5PB_reset_stats(H5PB_t *page_buf); -- cgit v0.12 From f42c7cc0d85cc5b232afd621711fdbd64f6e19d9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 22 Aug 2019 17:06:00 -0500 Subject: Fix major error codes --- src/H5Fmpi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 4c0104a..470241b 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -130,7 +130,7 @@ H5F_mpi_get_rank(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_rank request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_rank request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -162,7 +162,7 @@ H5F_mpi_get_comm(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_comm(f->shared->lf)) == MPI_COMM_NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -194,7 +194,7 @@ H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) /* Dispatch to driver */ if((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -226,7 +226,7 @@ H5F_mpi_get_size(const H5F_t *f) /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") done: FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12 From 021919206df7764f951037ae76ccae006b2eea99 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 23 Aug 2019 15:06:19 -0500 Subject: Fixed the assertion failure for HDFFV-10873. --- release_docs/RELEASE.txt | 14 ++++++++++++++ src/H5Ochunk.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b940095..202d39d 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -326,6 +326,20 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Fixed a bug caused by bad tag value when condensing object header + messages + + There was an assertion failure when moving meessages from running a + user test program with library release hdf5.1.10.4. It was because + the tag value (object header's address) was not set up when entering + the library routine H5O__chunk_update_idx(), which will eventually + verifies the metadata tag value when protecting the object header. + + The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() + with FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) to set up the metadata tag. + + (VC - 2019/08/23, HDFFV-10873) + - Fixed the test failure from test_metadata_read_retry_info() in test/swmr.c diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 94301b3..9ce5a46 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -331,7 +331,7 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx) H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* check args */ HDassert(f); -- cgit v0.12 From ba974c031deb709b6d4241da95485b48d747afdd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sat, 24 Aug 2019 14:07:19 -0500 Subject: OESS-29 Update HD prefix mostly --- config/cmake_ext_mod/runTest.cmake | 23 +- hl/test/gen_test_ds.c | 12 +- hl/test/test_ds.c | 36 +- hl/test/test_file_image.c | 6 +- hl/test/test_image.c | 34 +- hl/test/test_packet_vlen.c | 78 +-- test/atomic_reader.c | 30 +- test/atomic_writer.c | 10 +- test/cmpd_dset.c | 2 +- test/istore.c | 2 +- test/tattr.c | 29 +- test/testframe.c | 202 ++++---- test/testhdf5.h | 90 ++-- test/testmeta.c | 110 ++--- test/tfile.c | 5 +- test/th5s.c | 36 +- test/trefer.c | 4 +- test/tsohm.c | 12 +- testpar/t_bigio.c | 528 ++++++++++---------- testpar/t_cache.c | 38 +- testpar/t_cache_image.c | 70 +-- testpar/t_coll_chunk.c | 30 +- testpar/t_file.c | 101 ++-- testpar/t_filter_read.c | 66 +-- testpar/t_mdset.c | 976 ++++++++++++++++++------------------- testpar/t_mpi.c | 192 ++++---- testpar/t_ph5basic.c | 12 +- testpar/t_prestart.c | 2 +- testpar/t_prop.c | 2 +- testpar/t_shapesame.c | 54 +- testpar/testpar.h | 24 +- testpar/testphdf5.h | 58 +-- tools/src/h5import/h5import.c | 2 +- tools/test/h5repack/h5repacktst.c | 2 +- tools/test/misc/h5perf_gentest.c | 666 ++++++++++++------------- tools/test/misc/talign.c | 16 +- 36 files changed, 1777 insertions(+), 1783 deletions(-) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index a904855..21c8c18 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -125,12 +125,31 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # remove special output file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) -string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}") -if (TEST_FIND_RESULT GREATER 0) +string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT) +if (TEST_FIND_RESULT GREATER -1) string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM}) endif () +# remove special error output +if (NOT TEST_ERRREF) + # the error stack has been appended to the output file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) +else () + # the error stack remains in the .err file + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) +endif () +string (FIND "${TEST_STREAM}" "no version information available" TEST_FIND_RESULT) +if (TEST_FIND_RESULT GREATER -1) + string (REGEX REPLACE "^.*no version information available[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}") + # write back the changes to the original files + if (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else () + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif () +endif () + # if the output file needs Storage text removed if (TEST_MASK) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) diff --git a/hl/test/gen_test_ds.c b/hl/test/gen_test_ds.c index 273e393..285ab77 100644 --- a/hl/test/gen_test_ds.c +++ b/hl/test/gen_test_ds.c @@ -79,12 +79,12 @@ int main(int argc , char **argv) if (argc < 2) { - printf("Usage: gen_test [le | be]\n"); + HDprintf("Usage: gen_test [le | be]\n"); return 1; } if ( argv[1] && (strcmp("le",argv[1])!=0) && (strcmp("be",argv[1])!=0) ) { - printf("Usage: gen_test [le | be]\n"); + HDprintf("Usage: gen_test [le | be]\n"); return 1; } @@ -103,11 +103,11 @@ int main(int argc , char **argv) nerrors += test_long_scalenames(filename) < 0 ? 1 : 0; if(nerrors) goto error; - printf("Dimension scales file generation passed.\n"); + HDprintf("Dimension scales file generation passed.\n"); return 0; error: - printf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors); + HDprintf("***** %d DIMENSION SCALES FILE GENERATION FAILED! *****\n",nerrors); return 1; } @@ -188,11 +188,11 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id if(H5DSis_attached(did, dsid, idx) == 0) { if(H5DSattach_scale(did, dsid, idx) >= 0) { if(H5DSis_attached(did, dsid, idx) > 0) { - /* printf(" scale attached "); */ + /* HDprintf(" scale attached "); */ ret_value = SUCCEED; } else if(H5DSis_attached(did, dsid, idx) == 0) { - printf(" scale not attached "); + HDprintf(" scale not attached "); } } } diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 9389a0d..79e6f45 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1049,7 +1049,7 @@ herr_t test_attach_scale(hid_t fid, hid_t did, const char *name, unsigned int id ret_value = SUCCEED; } else if(H5DSis_attached(did, dsid, idx) == 0) { - printf(" scale not attached "); + HDprintf(" scale not attached "); } } } @@ -1153,14 +1153,14 @@ static int test_detachscales(void) /* make datasets; they are three dimensional*/ for (i=0; i < 2; i++) { - sprintf(dname,"D%d", i); + HDsprintf(dname,"D%d", i); if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0) goto out; } /* create datasets and make them dim. scales */ for (i=0; i < 4; i++) { - sprintf(dname, "DS%d", i); + HDsprintf(dname, "DS%d", i); if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0) goto out; } @@ -2255,7 +2255,7 @@ static int test_simple(void) char snames[3]; int i, j; - printf("Testing API functions\n"); + HDprintf("Testing API functions\n"); /*------------------------------------------------------------------------- * create a file for the test @@ -2919,7 +2919,7 @@ static int test_simple(void) if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) goto out; for(j = 0; j < 5; j++) { - sprintf(sname, "ds_%d", j); + HDsprintf(sname, "ds_%d", j); if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did, dsid, DIM0) < 0) @@ -2942,7 +2942,7 @@ static int test_simple(void) if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; for(j=0; j<5; j++) { - sprintf(sname,"ds_%d",j); + HDsprintf(sname,"ds_%d",j); if((dsid = H5Dopen2(gid,sname, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did,dsid,DIM0) < 0) @@ -3740,7 +3740,7 @@ static int test_errors(void) hid_t sidds = -1; /* space ID */ hsize_t pal_dims[] = {9,3}; - printf("Testing error conditions\n"); + HDprintf("Testing error conditions\n"); /*------------------------------------------------------------------------- * create a file, spaces, dataset and group ids @@ -4119,7 +4119,7 @@ static int test_iterators(void) char dname[30]; /* dataset name */ int i; - printf("Testing iterators\n"); + HDprintf("Testing iterators\n"); /*------------------------------------------------------------------------- * create a file, spaces, dataset and group ids @@ -4198,7 +4198,7 @@ static int test_iterators(void) for(i=0; i<100; i++) { /* make a DS */ - sprintf(dname,"ds_%d",i); + HDsprintf(dname,"ds_%d",i); if(H5LTmake_dataset_int(fid,dname,rankds,s1_dim,NULL) < 0) goto out; /* open */ @@ -4311,7 +4311,7 @@ static int test_rank(void) float buff[1]={1}; int i; - printf("Testing ranks\n"); + HDprintf("Testing ranks\n"); /*------------------------------------------------------------------------- * create a file, a dataset, scales @@ -4349,7 +4349,7 @@ static int test_rank(void) goto out; for(i=0; i<3; i++) { - sprintf(name,"ds_a_%d",i); + HDsprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; if(H5DSattach_scale(did,dsid,(unsigned)i) < 0) @@ -4377,7 +4377,7 @@ static int test_rank(void) goto out; for(i=0; i<3; i++) { - sprintf(name,"ds_a_%d",i); + HDsprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0) @@ -4403,7 +4403,7 @@ static int test_rank(void) goto out; for(i=0; i<3; i++) { - sprintf(name,"ds_a_%d",i); + HDsprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,name) < 0) @@ -4517,7 +4517,7 @@ static int test_types(void) const char *s1_str = "ABC"; const char *s2_str = "ABCD"; - printf("Testing scales with several datatypes\n"); + HDprintf("Testing scales with several datatypes\n"); /*------------------------------------------------------------------------- * create a file for the test @@ -4694,7 +4694,7 @@ static int test_data(void) float fill=-99; /* fill value */ - printf("Testing reading ASCII data and generate HDF5 data with scales\n"); + HDprintf("Testing reading ASCII data and generate HDF5 data with scales\n"); /*------------------------------------------------------------------------- * create a file for the test @@ -4870,7 +4870,7 @@ static int read_data( const char* fname, /* read first data file */ f = HDfopen(data_file, "r"); if( f == NULL ) { - printf( "Could not open file %s\n", data_file ); + HDprintf( "Could not open file %s\n", data_file ); return -1; } @@ -4892,7 +4892,7 @@ static int read_data( const char* fname, *buf = (float*) HDmalloc (nelms * sizeof( float )); if ( *buf == NULL ) { - printf( "memory allocation failed\n" ); + HDprintf( "memory allocation failed\n" ); HDfclose(f); return -1; } @@ -4930,7 +4930,7 @@ static int test_errors2(void) int nscales; /* number of scales in DIM */ int count; /* visitor data */ - printf("Testing parameter errors\n"); + HDprintf("Testing parameter errors\n"); /*------------------------------------------------------------------------- * create a file, a dataset, scales diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c index 6cf39e8..fd2d0d2 100644 --- a/hl/test/test_file_image.c +++ b/hl/test/test_file_image.c @@ -112,7 +112,7 @@ test_file_image(size_t open_images, size_t nflags, unsigned *flags) filename[i] = (char *)HDmalloc(sizeof(char) * 32); /* create file name */ - sprintf(filename[i], "image_file%d.h5", (int)i); + HDsprintf(filename[i], "image_file%d.h5", (int)i); /* create file */ if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -536,11 +536,11 @@ int main( void ) nerrors += test_file_image(open_images, nflags, flags) < 0? 1 : 0; if (nerrors) goto error; - printf("File image tests passed.\n"); + HDprintf("File image tests passed.\n"); return 0; error: - printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } diff --git a/hl/test/test_image.c b/hl/test/test_image.c index e350533..6d13419 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -75,11 +75,11 @@ int main(void) nerrors += test_generate()<0 ?1:0; if (nerrors) goto error; - printf("All image tests passed.\n"); + HDprintf("All image tests passed.\n"); return 0; error: - printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -344,7 +344,7 @@ static int test_data(void) if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; - printf("Testing read ascii image data and generate images\n"); + HDprintf("Testing read ascii image data and generate images\n"); /*------------------------------------------------------------------------- * read 8bit image data @@ -551,7 +551,7 @@ static int test_generate(void) if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; - printf("Testing read and process data and make indexed images\n"); + HDprintf("Testing read and process data and make indexed images\n"); /*------------------------------------------------------------------------- * read data; the file data format is described below @@ -561,7 +561,7 @@ static int test_generate(void) f = HDfopen( data_file, "r" ) ; if ( f == NULL ) { - printf( "Could not find file %s. Try set $srcdir \n", data_file ); + HDprintf( "Could not find file %s. Try set $srcdir \n", data_file ); goto out; } @@ -602,11 +602,11 @@ static int test_generate(void) if(fscanf( f, "%d %d %d", &imax, &jmax, &kmax ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf( f, "%f %f %f", &valex, &xmin, &xmax ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ @@ -638,7 +638,7 @@ static int test_generate(void) for ( i = 0; i < n_elements; i++ ) { if(fscanf( f, "%f ", &value ) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ data[i] = value; @@ -797,37 +797,37 @@ static int read_data(const char* fname, /*IN*/ */ if(NULL == (f = HDfopen(data_file, "r"))) { - printf( "Could not open file %s. Try set $srcdir \n", data_file ); + HDprintf( "Could not open file %s. Try set $srcdir \n", data_file ); goto out; } if(fscanf(f, "%s", str) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf(f, "%s", str) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf(f, "%d", &h) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf(f, "%s", str) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ if(fscanf(f, "%d", &w) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ @@ -861,7 +861,7 @@ static int read_data(const char* fname, /*IN*/ /* Read data elements */ for(i = 0; i < n_elements; i++) { if(fscanf(f, "%d", &n) < 0 && HDferror(f)) { - printf( "fscanf error in file %s.\n", data_file ); + HDprintf( "fscanf error in file %s.\n", data_file ); goto out; } /* end if */ image_data[i] = (unsigned char)n; @@ -917,7 +917,7 @@ static int read_palette(const char* fname, /* open the input file */ if (!(file = HDfopen(data_file, "r"))) { - printf( "Could not open file %s. Try set $srcdir \n", data_file ); + HDprintf( "Could not open file %s. Try set $srcdir \n", data_file ); return -1; } diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 4d83ae6..b41e73d 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -69,7 +69,7 @@ static int test_VLof_atomic(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int)); if (writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -108,7 +108,7 @@ static int test_VLof_atomic(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -120,8 +120,8 @@ static int test_VLof_atomic(void) for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + HDprintf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + HDprintf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); } } @@ -186,7 +186,7 @@ static int test_VLof_comptype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t)); if(writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -242,7 +242,7 @@ static int test_VLof_comptype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -253,13 +253,13 @@ static int test_VLof_comptype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { - fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); + HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); continue; } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { - fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]); + HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]); continue; } /* write value != read value */ } @@ -334,7 +334,7 @@ static int test_compound_VL_VLtype(void) writeBuf[uu].f = (float)(uu * 20) / 3.0F; writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t)); if (writeBuf[uu].v.p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].v.len = uu + L1_INCM; @@ -342,7 +342,7 @@ static int test_compound_VL_VLtype(void) { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + L2_INCM; @@ -407,7 +407,7 @@ static int test_compound_VL_VLtype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -418,27 +418,27 @@ static int test_compound_VL_VLtype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].u != readBuf[uu].u) { - fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u); + HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u); continue; } /* end if */ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f,readBuf[uu].f)) { - fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); + HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); continue; } /* end if */ if (writeBuf[uu].v.len != readBuf[uu].v.len) { - fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); + HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); continue; } /* end if */ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) { if (t1->len != t2->len) { - fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len); + HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len); continue; } /* end if */ for (ww = 0; (size_t)ww < t2->len; ww++) { if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) { - fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); + HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); continue; } /* end if */ } /* end for */ @@ -505,7 +505,7 @@ static int test_VLof_VLtype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t)); if (writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } /* end if */ writeBuf[uu].len = uu + 1; @@ -513,7 +513,7 @@ static int test_VLof_VLtype(void) { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv * 1; @@ -559,7 +559,7 @@ static int test_VLof_VLtype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -628,7 +628,7 @@ static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expecte HDstrcpy(lenthtype, "fixed-length"); if (expected_value == 1) HDstrcpy(lenthtype, "variable-length"); - fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); + HDfprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); ret = FAIL; } @@ -1062,7 +1062,7 @@ static int testfl_VLof_atomic(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int)); if (writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -1101,7 +1101,7 @@ static int testfl_VLof_atomic(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -1113,8 +1113,8 @@ static int testfl_VLof_atomic(void) for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + HDprintf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + HDprintf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); } } @@ -1179,7 +1179,7 @@ static int testfl_VLof_comptype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t)); if(writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -1235,7 +1235,7 @@ static int testfl_VLof_comptype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -1246,13 +1246,13 @@ static int testfl_VLof_comptype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { - fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); + HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n",__LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); continue; } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv] ) { - fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); + HDfprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); continue; } /* write value != read value */ } @@ -1327,7 +1327,7 @@ static int testfl_compound_VL_VLtype(void) writeBuf[uu].f = (float)(uu * 20) / 3.0F; writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t)); if (writeBuf[uu].v.p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].v.len = uu + L1_INCM; @@ -1335,7 +1335,7 @@ static int testfl_compound_VL_VLtype(void) { t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + L2_INCM; @@ -1400,7 +1400,7 @@ static int testfl_compound_VL_VLtype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ @@ -1411,27 +1411,27 @@ static int testfl_compound_VL_VLtype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].u != readBuf[uu].u) { - fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u); + HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, writeBuf[uu].u, uu, readBuf[uu].u); continue; } /* end if */ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) { - fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); + HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); continue; } /* end if */ if (writeBuf[uu].v.len != readBuf[uu].v.len) { - fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); + HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); continue; } /* end if */ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) { if (t1->len != t2->len) { - fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len); + HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", __LINE__, uu, vv, t1->len, t2->len); continue; } /* end if */ for (ww = 0; (size_t)ww < t2->len; ww++) { if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww] ) { - fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); + HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); continue; } /* end if */ } /* end for */ @@ -1498,7 +1498,7 @@ static int testfl_VLof_VLtype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t)); if (writeBuf[uu].p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } /* end if */ writeBuf[uu].len = uu + 1; @@ -1506,7 +1506,7 @@ static int testfl_VLof_VLtype(void) { t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); if (t1->p == NULL) { - fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + 1; @@ -1552,7 +1552,7 @@ static int testfl_VLof_VLtype(void) if (ret < 0) goto error; - sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); VERIFY(count == NRECORDS, msg); /* Read all five packets back */ diff --git a/test/atomic_reader.c b/test/atomic_reader.c index 3e3a20a..5c1241f 100644 --- a/test/atomic_reader.c +++ b/test/atomic_reader.c @@ -55,7 +55,7 @@ int verify(int fd, unsigned int k); void print_info(int *info, unsigned int lastr, unsigned iteration); - + /*------------------------------------------------------------------------- * Function: usage * @@ -63,7 +63,7 @@ void print_info(int *info, unsigned int lastr, unsigned iteration); * * Parameters: None * - * Return: void + * Return: void * *------------------------------------------------------------------------- */ @@ -78,13 +78,13 @@ usage(void) printf("\n"); } /* usage() */ - + /*------------------------------------------------------------------------- * Function: verify * * Purpose: To verify that the data read is the pattern expected. * Each integer read should be the same as the index. - * When a difference is encountered, the remaining integers + * When a difference is encountered, the remaining integers * read should be the same as the previous index. * For example, the pattern expected should be either: * a) 01234567....n-1 @@ -93,11 +93,11 @@ usage(void) * the remaining integers should be all "3"s as: * 012333333333333 * - * Parameters: + * Parameters: * fd -- the file descriptor * k -- the number of integers to read * - * Return: + * Return: * positive on success * negative on failure * @@ -106,9 +106,9 @@ usage(void) int verify(int fd, unsigned int k) { - unsigned int i; /* local index variable */ - ssize_t bytes_read; /* the number of bytes read */ - unsigned int *buf = NULL; /* buffer to hold data read */ + unsigned int i; /* local index variable */ + ssize_t bytes_read; /* the number of bytes read */ + unsigned int *buf = NULL; /* buffer to hold data read */ /* Allocate buffer for data read */ if((buf = (unsigned int *)malloc(k * sizeof(unsigned int))) == NULL) { @@ -165,13 +165,13 @@ error: } /* end verify() */ - + /*------------------------------------------------------------------------- * Function: print_info * * Purpose: To print the statistics gathered for re-reads * - * Parameters: + * Parameters: * info -- the array storing the statistics for re-reads * lastr -- the last read completed * iteration -- the current iteration @@ -183,7 +183,7 @@ error: void print_info(int *info, unsigned int lastr, unsigned iteration) { - unsigned j; /* local index variable */ + unsigned j; /* local index variable */ printf("--------statistics for %u reads (iteration %u)--------\n", lastr, iteration); @@ -193,13 +193,13 @@ print_info(int *info, unsigned int lastr, unsigned iteration) printf("--------end statistics for %u reads (iteration %u)--------\n", lastr, iteration); } /* print_info() */ - + /*------------------------------------------------------------------------- * Function: main * * Purpose: To verify that the data read is the pattern expected. - * (1) Make sure the file opens successfully and the # of bytes read is as expected - * (2) Iterate the reader with i iterations + * (1) Make sure the file opens successfully and the # of bytes read is as expected + * (2) Iterate the reader with i iterations * (3) Read and verify n integers for each iteration * (4) On verification error, re-read the data at most READ_TRIES * times to see if correct data can be obtained diff --git a/test/atomic_writer.c b/test/atomic_writer.c index 218d4da..b9ea03a 100644 --- a/test/atomic_writer.c +++ b/test/atomic_writer.c @@ -14,7 +14,7 @@ * * Created: atomic_writer.c * - * Purpose: This is the "writer" part of the standalone test to check + * Purpose: This is the "writer" part of the standalone test to check * atomic read-write operation on a system. * a) atomic_writer.c--the writer (this file) * b) atomic_reader.c--the reader @@ -53,7 +53,7 @@ static void usage(void); - + /*------------------------------------------------------------------------- * Function: usage * @@ -77,12 +77,12 @@ usage(void) } /* usage() */ - + /*------------------------------------------------------------------------- * Function: main * * Purpose: To write a series of integers to a file for the reader to verify the data. - * A write is atomic if the whole amount written in one operation is not interleaved + * A write is atomic if the whole amount written in one operation is not interleaved * with data from any other process. * (1) Iterate with i iterations * (2) Write a series of integers (0 to n-1) to the file with this pattern: @@ -196,7 +196,7 @@ main(int argc, char *argv[]) printf("WRITER: error from lseek\n"); goto error; } /* end if */ - + /* Write the data */ if((bytes_wrote = write(fd, buf, ((num-n) * sizeof(unsigned int)))) < 0) { printf("WRITER: error from write\n"); diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index eef2070..ff3767c 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2217,7 +2217,7 @@ main (int argc, char *argv[]) if (argc>1) { if (argc>2 || strcmp("--noopt", argv[1])) { HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } H5Tunregister(H5T_PERS_DONTCARE, NULL, (hid_t)-1, (hid_t)-1, (H5T_conv_t)((void (*) (void))H5T__conv_struct_opt)); } diff --git a/test/istore.c b/test/istore.c index 7489b7e..8759be3 100644 --- a/test/istore.c +++ b/test/istore.c @@ -338,7 +338,7 @@ test_extend(hid_t f, const char *prefix, HDfprintf(stderr,",%lu", (unsigned long)size[1]); if (ndims > 2) HDfprintf(stderr,",%lu", (unsigned long)size[2]); - HD fprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); + HDfprintf(stderr,"), %lu element%s", (unsigned long)nelmts, 1 == nelmts ? "" : "s"); if (0 == nelmts) HDfprintf(stderr," *SKIPPED*"); HDfprintf(stderr,"\n"); diff --git a/test/tattr.c b/test/tattr.c index 50704c6..7c2b5ce 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -11163,17 +11163,18 @@ test_attr(void) { hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */ hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */ - hid_t dcpl = -1; - unsigned new_format; /* Whether to use the new format or not */ - unsigned use_shared; /* Whether to use shared attributes or not */ - unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ - herr_t ret; /* Generic return value */ + hid_t dcpl = -1; /* Dataset creation property list */ + unsigned new_format; /* Whether to use the new format or not */ + unsigned use_shared; /* Whether to use shared attributes or not */ + unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */ + herr_t ret; /* Generic return value */ MESSAGE(5, ("Testing Attributes\n")); fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); + /* fapl2 uses "latest version of the format" for creating objects in the file */ fapl2 = H5Pcopy(fapl); CHECK(fapl2, FAIL, "H5Pcopy"); ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); @@ -11207,6 +11208,7 @@ test_attr(void) for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; + /* Set the FAPL for the type of format */ if(new_format) { MESSAGE(7, ("testing with new file format\n")); my_fapl = fapl2; @@ -11262,8 +11264,7 @@ test_attr(void) test_attr_rename_invalid_name(my_fcpl, my_fapl); /* Test passing a NULL or empty attribute name to H5Arename(_by_name) */ test_attr_get_name_invalid_buf(my_fcpl, my_fapl); /* Test passing NULL buffer to H5Aget_name(_by_idx) */ - /* New attribute API routine tests - */ + /* New attribute API routine tests */ test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */ test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */ test_attr_iterate2(new_format, my_fcpl, my_fapl); /* Test iterating over attributes by index */ @@ -11271,8 +11272,7 @@ test_attr(void) test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */ test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */ - /* Tests that address specific bugs - */ + /* Tests that address specific bugs */ test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */ test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */ test_attr_bug3(my_fcpl, my_fapl); /* Test "self referential" attributes */ @@ -11285,8 +11285,7 @@ test_attr(void) test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */ test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */ - /* tests specific to the "new format" - */ + /* tests specific to the "new format" */ if (new_format == TRUE) { /* General attribute tests */ test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */ @@ -11297,8 +11296,7 @@ test_attr(void) test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */ test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */ - /* Attribute creation order tests - */ + /* Attribute creation order tests */ test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */ test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */ test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */ @@ -11306,8 +11304,7 @@ test_attr(void) test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */ test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */ - /* More complex tests with exclusively both "new format" and "shared" attributes - */ + /* More complex tests with exclusively both "new format" and "shared" attributes */ if(use_shared == TRUE) { test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */ test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */ @@ -11365,6 +11362,6 @@ test_attr(void) void cleanup_attr(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/testframe.c b/test/testframe.c index a096f36..68c66ec 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -42,10 +42,10 @@ typedef struct TestStruct { * Variables used by testing framework. */ static int enable_error_stack = 0; /* enable error stack; disable=0 enable=1 */ -static int num_errs = 0; /* Total number of errors during testing */ +static int num_errs = 0; /* Total number of errors during testing */ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ -static int Summary = 0; /* Show test summary. Default is no. */ -static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ +static int Summary = 0; /* Show test summary. Default is no. */ +static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ static TestStruct *Test = NULL; /* Array of tests */ static unsigned TestAlloc = 0; /* Size of the Test array */ @@ -74,14 +74,12 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con { /* Sanity checking */ if (HDstrlen(TheDescr) >= MAXTESTDESC) { - HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", - TheDescr, MAXTESTDESC); - exit(EXIT_FAILURE); + HDprintf("Test description ('%s') too long, increase MAXTESTDESC(%d).\n", TheDescr, MAXTESTDESC); + HDexit(EXIT_FAILURE); } /* end if */ if (HDstrlen(TheName) >= MAXTESTNAME) { - HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", - MAXTESTNAME); - exit(EXIT_FAILURE); + HDprintf("Test name too long, increase MAXTESTNAME(%d).\n", MAXTESTNAME); + HDexit(EXIT_FAILURE); } /* end if */ /* Check for increasing the Test array size */ @@ -167,7 +165,7 @@ void TestUsage(void) unsigned i; print_func("Usage: %s [-v[erbose] (l[ow]|m[edium]|h[igh]|0-9)] %s\n", - TestProgName, (TestPrivateUsage ? "" : "")); + TestProgName, (TestPrivateUsage ? "" : "")); print_func(" [-[e]x[clude] name]+ \n"); print_func(" [-o[nly] name]+ \n"); print_func(" [-b[egin] name] \n"); @@ -228,78 +226,80 @@ void TestParseCmdLine(int argc, char *argv[]) int ret_code; while (argv++, --argc > 0){ - if ((HDstrcmp(*argv, "-verbose") == 0) || - (HDstrcmp(*argv, "-v") == 0)) { - if (argc > 0){ - --argc; ++argv; - ParseTestVerbosity(*argv); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + if ((HDstrcmp(*argv, "-verbose") == 0) || (HDstrcmp(*argv, "-v") == 0)) { + if (argc > 0){ + --argc; ++argv; + ParseTestVerbosity(*argv); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-exclude") == 0) || - (HDstrcmp(*argv, "-x") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, SKIPTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + else if (((HDstrcmp(*argv, "-exclude") == 0) || + (HDstrcmp(*argv, "-x") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, SKIPTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-begin") == 0) || - (HDstrcmp(*argv, "-b") == 0))) { - if (argc > 0){ - --argc; ++argv; - SetTest(*argv, BEGINTEST); - }else{ - TestUsage(); - exit(EXIT_FAILURE); + else if (((HDstrcmp(*argv, "-begin") == 0) || + (HDstrcmp(*argv, "-b") == 0))) { + if (argc > 0){ + --argc; ++argv; + SetTest(*argv, BEGINTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } } - } - else if (((HDstrcmp(*argv, "-only") == 0) || - (HDstrcmp(*argv, "-o") == 0))) { - if(argc > 0) { - unsigned Loop; + else if (((HDstrcmp(*argv, "-only") == 0) || + (HDstrcmp(*argv, "-o") == 0))) { + if(argc > 0) { + unsigned Loop; - --argc; ++argv; + --argc; ++argv; - /* Skip all tests, then activate only one. */ + /* Skip all tests, then activate only one. */ if(!skipped_all) { for(Loop = 0; Loop < Index; Loop++) Test[Loop].SkipFlag = 1; skipped_all = TRUE; } /* end if */ - SetTest(*argv, ONLYTEST); - } /* end if */ - else { - TestUsage(); - exit(EXIT_FAILURE); + SetTest(*argv, ONLYTEST); + } + else{ + TestUsage(); + HDexit(EXIT_FAILURE); + } + } + else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) + Summary = 1; + else if (HDstrcmp(*argv, "-enable-error-stack") == 0) + enable_error_stack = 1; + else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { + TestUsage(); + HDexit(EXIT_SUCCESS); + } + else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) + SetTestNoCleanup(); + else { + /* non-standard option. Break out. */ + break; } - } - else if ((HDstrcmp(*argv, "-summary") == 0) || (HDstrcmp(*argv, "-s") == 0)) - Summary = 1; - else if (HDstrcmp(*argv, "-enable-error-stack") == 0) - enable_error_stack = 1; - else if ((HDstrcmp(*argv, "-help") == 0) || (HDstrcmp(*argv, "-h") == 0)) { - TestUsage(); - exit(EXIT_SUCCESS); - } - else if ((HDstrcmp(*argv, "-cleanoff") == 0) || (HDstrcmp(*argv, "-c") == 0)) - SetTestNoCleanup(); - else { - /* non-standard option. Break out. */ - break; - } } /* Call extra parsing function if provided. */ if (NULL != TestPrivateParser){ - ret_code=TestPrivateParser(argc+1, argv-1); - if (ret_code != 0) - exit(EXIT_FAILURE); + ret_code=TestPrivateParser(argc+1, argv-1); + if (ret_code != 0) + HDexit(EXIT_FAILURE); } } @@ -318,10 +318,10 @@ void PerformTests(void) MESSAGE(2, ("Testing -- %s (%s) \n", Test[Loop].Description, Test[Loop].Name)); MESSAGE(5, ("===============================================\n")); Test[Loop].NumErrors = num_errs; - Test_parameters = Test[Loop].Parameters; - ALARM_ON; + Test_parameters = Test[Loop].Parameters; + ALARM_ON; Test[Loop].Call(); - ALARM_OFF; + ALARM_OFF; Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors; MESSAGE(5, ("===============================================\n")); MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors)); @@ -440,18 +440,18 @@ int GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if(TestExpress==-1) { - env_val = getenv("HDF5TestExpress"); - - if(env_val == NULL) - SetTestExpress(1); - else if(strcmp(env_val, "0") == 0) - SetTestExpress(0); - else if(strcmp(env_val, "1") == 0) - SetTestExpress(1); - else if(strcmp(env_val, "2") == 0) - SetTestExpress(2); - else - SetTestExpress(3); + env_val = getenv("HDF5TestExpress"); + + if(env_val == NULL) + SetTestExpress(1); + else if(strcmp(env_val, "0") == 0) + SetTestExpress(0); + else if(strcmp(env_val, "1") == 0) + SetTestExpress(1); + else if(strcmp(env_val, "2") == 0) + SetTestExpress(2); + else + SetTestExpress(3); } return(TestExpress); @@ -508,13 +508,13 @@ int SetTestNoCleanup(void) void ParseTestVerbosity(char *argv) { if (*argv == 'l') - SetTestVerbosity(VERBO_LO); + SetTestVerbosity(VERBO_LO); else if (*argv == 'm') - SetTestVerbosity(VERBO_MED); + SetTestVerbosity(VERBO_MED); else if (*argv == 'h') - SetTestVerbosity(VERBO_HI); + SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(atoi(argv)); } @@ -582,29 +582,29 @@ void SetTest(const char *testname, int action) switch (action){ case SKIPTEST: for (Loop = 0; Loop < Index; Loop++) - if (HDstrcmp(testname, Test[Loop].Name) == 0){ - Test[Loop].SkipFlag = 1; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) == 0){ + Test[Loop].SkipFlag = 1; + break; + } break; case BEGINTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) != 0) - Test[Loop].SkipFlag = 1; - else{ - /* Found it. Set it to run. Done. */ - Test[Loop].SkipFlag = 0; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) != 0) + Test[Loop].SkipFlag = 1; + else{ + /* Found it. Set it to run. Done. */ + Test[Loop].SkipFlag = 0; + break; + } } break; case ONLYTEST: for (Loop = 0; Loop < Index; Loop++) { - if (HDstrcmp(testname, Test[Loop].Name) == 0) { - /* Found it. Set it to run. Break to skip the rest. */ - Test[Loop].SkipFlag = 0; - break; - } + if (HDstrcmp(testname, Test[Loop].Name) == 0) { + /* Found it. Set it to run. Break to skip the rest. */ + Test[Loop].SkipFlag = 0; + break; + } } break; default: diff --git a/test/testhdf5.h b/test/testhdf5.h index 1f3f6a0..ef3b784 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -177,53 +177,53 @@ extern "C" { #endif /* Prototypes for the test routines */ -void test_metadata(void); -void test_checksum(void); -void test_tst(void); -void test_heap(void); -void test_refstr(void); -void test_file(void); -void test_h5o(void); -void test_h5t(void); -void test_h5s(void); -void test_coords(void); -void test_h5d(void); -void test_attr(void); -void test_select(void); -void test_time(void); -void test_reference(void); -void test_vltypes(void); -void test_vlstrings(void); -void test_iterate(void); -void test_array(void); -void test_genprop(void); -void test_configure(void); -void test_misc(void); -void test_ids(void); -void test_skiplist(void); -void test_sohm(void); -void test_unicode(void); +void test_metadata(void); +void test_checksum(void); +void test_tst(void); +void test_heap(void); +void test_refstr(void); +void test_file(void); +void test_h5o(void); +void test_h5t(void); +void test_h5s(void); +void test_coords(void); +void test_h5d(void); +void test_attr(void); +void test_select(void); +void test_time(void); +void test_reference(void); +void test_vltypes(void); +void test_vlstrings(void); +void test_iterate(void); +void test_array(void); +void test_genprop(void); +void test_configure(void); +void test_misc(void); +void test_ids(void); +void test_skiplist(void); +void test_sohm(void); +void test_unicode(void); /* Prototypes for the cleanup routines */ -void cleanup_metadata(void); -void cleanup_checksum(void); -void cleanup_file(void); -void cleanup_h5o(void); -void cleanup_h5s(void); -void cleanup_coords(void); -void cleanup_attr(void); -void cleanup_select(void); -void cleanup_time(void); -void cleanup_reference(void); -void cleanup_vltypes(void); -void cleanup_vlstrings(void); -void cleanup_iterate(void); -void cleanup_array(void); -void cleanup_genprop(void); -void cleanup_configure(void); -void cleanup_sohm(void); -void cleanup_misc(void); -void cleanup_unicode(void); +void cleanup_metadata(void); +void cleanup_checksum(void); +void cleanup_file(void); +void cleanup_h5o(void); +void cleanup_h5s(void); +void cleanup_coords(void); +void cleanup_attr(void); +void cleanup_select(void); +void cleanup_time(void); +void cleanup_reference(void); +void cleanup_vltypes(void); +void cleanup_vlstrings(void); +void cleanup_iterate(void); +void cleanup_array(void); +void cleanup_genprop(void); +void cleanup_configure(void); +void cleanup_sohm(void); +void cleanup_misc(void); +void cleanup_unicode(void); #ifdef __cplusplus } diff --git a/test/testmeta.c b/test/testmeta.c index b97eb68..9a40e6f 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -23,34 +23,34 @@ */ -#include "hdf5.h" +#include "h5test.h" -#define FILEN "testmeta.h5" +#define FILEN "testmeta.h5" -#define CHUNK_SIZE 512 +#define CHUNK_SIZE 512 -#define NDATAARRAYS 3 -/*#define NPOINTS 2048*/ -#define NPOINTS 20 -#define NEXTARRAYS 10 -#define NDATAOBJECTS 100000 +#define NDATAARRAYS 3 +/*#define NPOINTS 2048*/ +#define NPOINTS 20 +#define NEXTARRAYS 10 +#define NDATAOBJECTS 100000 int main(void) { - hid_t file_id, prop_id, memspace_id, type_id; - hid_t group_id; - hid_t dataset_id, dataspace_id; - herr_t status; - hsize_t dims[1]; - hsize_t maxdims[1]; - float data[NPOINTS]; - float floatval; - unsigned numdataobj = 0; - unsigned i, j; - char name[80]; - hsize_t start[1] = {0}; - hsize_t stride[1] = {1}; - hsize_t count[1] = {1}; + hid_t file_id, prop_id, memspace_id, type_id; + hid_t group_id; + hid_t dataset_id, dataspace_id; + herr_t status; + hsize_t dims[1]; + hsize_t maxdims[1]; + float data[NPOINTS]; + float floatval; + unsigned numdataobj = 0; + unsigned i, j; + char name[80]; + hsize_t start[1] = {0}; + hsize_t stride[1] = {1}; + hsize_t count[1] = {1}; /* Create a file */ file_id = H5Fcreate(FILEN, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -64,8 +64,7 @@ int main(void) H5T_NATIVE_UINT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* Write value to NumDataObj dataset */ - status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, - H5S_ALL, H5P_DEFAULT, &numdataobj); + status = H5Dwrite(dataset_id, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &numdataobj); /* Close the identifiers */ status = H5Dclose(dataset_id); @@ -78,16 +77,14 @@ int main(void) status = H5Pset_chunk(prop_id, 1, dims); /* Create dataspace */ - dims[0]=1; - maxdims[0]=H5S_UNLIMITED; + dims[0] = 1; + maxdims[0] = H5S_UNLIMITED; dataspace_id = H5Screate_simple(1, dims, maxdims); - for(i=0; i MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(vrfyerrs) - printf("%d errors found in verify_data\n", vrfyerrs); + HDprintf("%d errors found in verify_data\n", vrfyerrs); return(vrfyerrs); } /* Set up the selection */ static void ccslab_set(int mpi_rank, - int mpi_size, - hsize_t start[], - hsize_t count[], - hsize_t stride[], - hsize_t block[], - int mode) + int mpi_size, + hsize_t start[], + hsize_t count[], + hsize_t stride[], + hsize_t block[], + int mode) { switch (mode){ case BYROW_CONT: - /* Each process takes a slabs of rows. */ - block[0] = 1; - block[1] = 1; - stride[0] = 1; - stride[1] = 1; - count[0] = space_dim1; - count[1] = space_dim2; - start[0] = mpi_rank*count[0]; - start[1] = 0; - - break; + /* Each process takes a slabs of rows. */ + block[0] = 1; + block[1] = 1; + stride[0] = 1; + stride[1] = 1; + count[0] = space_dim1; + count[1] = space_dim2; + start[0] = mpi_rank*count[0]; + start[1] = 0; + + break; case BYROW_DISCONT: - /* Each process takes several disjoint blocks. */ - block[0] = 1; - block[1] = 1; + /* Each process takes several disjoint blocks. */ + block[0] = 1; + block[1] = 1; stride[0] = 3; stride[1] = 3; count[0] = space_dim1/(stride[0]*block[0]); count[1] = (space_dim2)/(stride[1]*block[1]); - start[0] = space_dim1*mpi_rank; - start[1] = 0; + start[0] = space_dim1*mpi_rank; + start[1] = 0; - break; + break; case BYROW_SELECTNONE: - /* Each process takes a slabs of rows, there are + /* Each process takes a slabs of rows, there are no selections for the last process. */ - block[0] = 1; - block[1] = 1; - stride[0] = 1; - stride[1] = 1; - count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:space_dim1); - count[1] = space_dim2; - start[0] = mpi_rank*count[0]; - start[1] = 0; + block[0] = 1; + block[1] = 1; + stride[0] = 1; + stride[1] = 1; + count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:space_dim1); + count[1] = space_dim2; + start[0] = mpi_rank*count[0]; + start[1] = 0; - break; + break; case BYROW_SELECTUNBALANCE: /* The first one-third of the number of processes only @@ -284,14 +284,14 @@ ccslab_set(int mpi_rank, half of the domain. */ block[0] = 1; - count[0] = 2; + count[0] = 2; stride[0] = space_dim1*mpi_size/4+1; block[1] = space_dim2; count[1] = 1; start[1] = 0; stride[1] = 1; - if((mpi_rank *3)<(mpi_size*2)) start[0] = mpi_rank; - else start[0] = 1 + space_dim1*mpi_size/2 + (mpi_rank-2*mpi_size/3); + if((mpi_rank *3)<(mpi_size*2)) start[0] = mpi_rank; + else start[0] = 1 + space_dim1*mpi_size/2 + (mpi_rank-2*mpi_size/3); break; case BYROW_SELECTINCHUNK: @@ -299,33 +299,33 @@ ccslab_set(int mpi_rank, block[0] = 1; count[0] = 1; - start[0] = mpi_rank*space_dim1; + start[0] = mpi_rank*space_dim1; stride[0]= 1; - block[1] = space_dim2; - count[1] = 1; - stride[1]= 1; - start[1] = 0; + block[1] = space_dim2; + count[1] = 1; + stride[1]= 1; + start[1] = 0; break; default: - /* Unknown mode. Set it to cover the whole dataset. */ - block[0] = space_dim1*mpi_size; - block[1] = space_dim2; - stride[0] = block[0]; - stride[1] = block[1]; - count[0] = 1; - count[1] = 1; - start[0] = 0; - start[1] = 0; - - break; + /* Unknown mode. Set it to cover the whole dataset. */ + block[0] = space_dim1*mpi_size; + block[1] = space_dim2; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = 0; + + break; } if (VERBOSE_MED){ - printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0]*block[1]*count[0]*count[1])); + HDprintf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0]*block[1]*count[0]*count[1])); } } @@ -336,10 +336,10 @@ ccslab_set(int mpi_rank, */ static void ccdataset_fill(hsize_t start[], - hsize_t stride[], - hsize_t count[], - hsize_t block[], - DATATYPE * dataset, + hsize_t stride[], + hsize_t count[], + hsize_t block[], + DATATYPE * dataset, int mem_selection) { DATATYPE *dataptr = dataset; @@ -377,28 +377,28 @@ ccdataset_fill(hsize_t start[], */ static void ccdataset_print(hsize_t start[], - hsize_t block[], - DATATYPE * dataset) + hsize_t block[], + DATATYPE * dataset) { DATATYPE *dataptr = dataset; hsize_t i, j; /* print the column heading */ - printf("Print only the first block of the dataset\n"); - printf("%-8s", "Cols:"); + HDprintf("Print only the first block of the dataset\n"); + HDprintf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3lu ", (unsigned long)(start[1]+j)); + HDprintf("%3lu ", (unsigned long)(start[1]+j)); } - printf("\n"); + HDprintf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2lu: ", (unsigned long)(i+start[0])); - for (j=0; j < block[1]; j++){ - printf("%03d ", *dataptr++); - } - printf("\n"); + HDprintf("Row %2lu: ", (unsigned long)(i+start[0])); + for (j=0; j < block[1]; j++){ + HDprintf("%03d ", *dataptr++); + } + HDprintf("\n"); } } @@ -407,11 +407,11 @@ ccdataset_print(hsize_t start[], */ static int ccdataset_vrfy(hsize_t start[], - hsize_t count[], - hsize_t stride[], - hsize_t block[], - DATATYPE *dataset, - DATATYPE *original, + hsize_t count[], + hsize_t stride[], + hsize_t block[], + DATATYPE *dataset, + DATATYPE *original, int mem_selection) { hsize_t i, j,k1,k2,k=0; @@ -420,14 +420,14 @@ ccdataset_vrfy(hsize_t start[], /* print it if VERBOSE_MED */ if (VERBOSE_MED) { - printf("dataset_vrfy dumping:::\n"); - printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); - printf("original values:\n"); - ccdataset_print(start, block, original); - printf("compared values:\n"); - ccdataset_print(start, block, dataset); + HDprintf("dataset_vrfy dumping:::\n"); + HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); + HDprintf("original values:\n"); + ccdataset_print(start, block, original); + HDprintf("compared values:\n"); + ccdataset_print(start, block, dataset); } vrfyerrs = 0; @@ -449,7 +449,7 @@ ccdataset_vrfy(hsize_t start[], } if (*dataptr != *oriptr){ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", + HDprintf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", (unsigned long)i, (unsigned long)j, *(oriptr), *(dataptr)); } @@ -459,9 +459,9 @@ ccdataset_vrfy(hsize_t start[], } } if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if (vrfyerrs) - printf("%d errors found in ccdataset_vrfy\n", vrfyerrs); + HDprintf("%d errors found in ccdataset_vrfy\n", vrfyerrs); return(vrfyerrs); } @@ -478,28 +478,28 @@ static void dataset_big_write(void) { - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t sid; /* Dataspace ID */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t sid; /* Dataspace ID */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset; - hid_t datatype; /* Datatype ID */ - hsize_t dims[RANK]; /* dataset dim sizes */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + hid_t datatype; /* Datatype ID */ + hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ hsize_t *coords = NULL; int i; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ + hid_t acc_tpl; /* File access templates */ hsize_t h; size_t num_points; B_DATATYPE * wdata; /* allocate memory for data buffer */ - wdata = (B_DATATYPE *)malloc(bigcount*sizeof(B_DATATYPE)); + wdata = (B_DATATYPE *)HDmalloc(bigcount*sizeof(B_DATATYPE)); VRFY((wdata != NULL), "wdata malloc succeeded"); /* setup file access template */ @@ -552,8 +552,8 @@ dataset_big_write(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, wdata); + MESG("data_array created"); + dataset_print(start, block, wdata); } /* set up the collective transfer properties list */ @@ -580,7 +580,7 @@ dataset_big_write(void) /* Each process takes a slabs of cols. */ - if (mpi_rank == 0) + if (mpi_rank == 0) HDprintf("\nTesting Dataset2 write by COL\n"); /* Create a large dataset */ dims[0] = bigcount; @@ -615,8 +615,8 @@ dataset_big_write(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, wdata); + MESG("data_array created"); + dataset_print(start, block, wdata); } /* set up the collective transfer properties list */ @@ -690,7 +690,7 @@ dataset_big_write(void) fill_datasets(start, dims, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); + MESG("data_array created"); } ret = H5Dwrite(dataset, H5T_NATIVE_LLONG, mem_dataspace, file_dataspace, @@ -729,7 +729,7 @@ dataset_big_write(void) num_points = bigcount; - coords = (hsize_t *)malloc(num_points * RANK * sizeof(hsize_t)); + coords = (hsize_t *)HDmalloc(num_points * RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); set_coords (start, count, stride, block, num_points, coords, IN_ORDER); @@ -744,8 +744,8 @@ dataset_big_write(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, wdata); + MESG("data_array created"); + dataset_print(start, block, wdata); } /* create a memory dataspace */ @@ -778,7 +778,7 @@ dataset_big_write(void) ret = H5Dclose(dataset); VRFY((ret >= 0), "H5Dclose1 succeeded"); - free(wdata); + HDfree(wdata); H5Fclose(fid); } @@ -795,30 +795,30 @@ static void dataset_big_read(void) { hid_t fid; /* HDF5 file ID */ - hid_t acc_tpl; /* File access templates */ - hid_t xfer_plist; /* Dataset transfer properties list */ - hid_t file_dataspace; /* File dataspace ID */ - hid_t mem_dataspace; /* memory dataspace ID */ + hid_t acc_tpl; /* File access templates */ + hid_t xfer_plist; /* Dataset transfer properties list */ + hid_t file_dataspace; /* File dataspace ID */ + hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset; - B_DATATYPE *rdata = NULL; /* data buffer */ - B_DATATYPE *wdata = NULL; /* expected data buffer */ - hsize_t dims[RANK]; /* dataset dim sizes */ - hsize_t start[RANK]; /* for hyperslab setting */ - hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ - hsize_t block[RANK]; /* for hyperslab setting */ + B_DATATYPE *rdata = NULL; /* data buffer */ + B_DATATYPE *wdata = NULL; /* expected data buffer */ + hsize_t dims[RANK]; /* dataset dim sizes */ + hsize_t start[RANK]; /* for hyperslab setting */ + hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ + hsize_t block[RANK]; /* for hyperslab setting */ int i,j,k; hsize_t h; size_t num_points; hsize_t *coords = NULL; - herr_t ret; /* Generic return value */ + herr_t ret; /* Generic return value */ /* allocate memory for data buffer */ - rdata = (B_DATATYPE *)malloc(bigcount*sizeof(B_DATATYPE)); + rdata = (B_DATATYPE *)HDmalloc(bigcount*sizeof(B_DATATYPE)); VRFY((rdata != NULL), "rdata malloc succeeded"); - wdata = (B_DATATYPE *)malloc(bigcount*sizeof(B_DATATYPE)); + wdata = (B_DATATYPE *)HDmalloc(bigcount*sizeof(B_DATATYPE)); VRFY((wdata != NULL), "wdata malloc succeeded"); - memset(rdata, 0, bigcount*sizeof(B_DATATYPE)); + HDmemset(rdata, 0, bigcount*sizeof(B_DATATYPE)); /* setup file access template */ acc_tpl = H5Pcreate (H5P_FILE_ACCESS); @@ -865,7 +865,7 @@ dataset_big_read(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); + MESG("data_array created"); } /* set up the collective transfer properties list */ @@ -885,7 +885,7 @@ dataset_big_read(void) /* verify the read data with original expected data */ ret = verify_data(start, count, stride, block, rdata, wdata); - if(ret) {fprintf(stderr, "verify failed\n"); exit(1);} + if(ret) {HDfprintf(stderr, "verify failed\n"); exit(1);} /* release all temporary handles. */ H5Sclose(file_dataspace); @@ -897,7 +897,7 @@ dataset_big_read(void) if (mpi_rank == 0) HDprintf("\nRead Testing Dataset2 by ROW\n"); - memset(rdata, 0, bigcount*sizeof(B_DATATYPE)); + HDmemset(rdata, 0, bigcount*sizeof(B_DATATYPE)); dataset = H5Dopen2(fid, DATASET2, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dopen2 succeeded"); @@ -927,7 +927,7 @@ dataset_big_read(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); + MESG("data_array created"); } /* set up the collective transfer properties list */ @@ -947,7 +947,7 @@ dataset_big_read(void) /* verify the read data with original expected data */ ret = verify_data(start, count, stride, block, rdata, wdata); - if(ret) {fprintf(stderr, "verify failed\n"); exit(1);} + if(ret) {HDfprintf(stderr, "verify failed\n"); exit(1);} /* release all temporary handles. */ H5Sclose(file_dataspace); @@ -958,7 +958,7 @@ dataset_big_read(void) if (mpi_rank == 0) HDprintf("\nRead Testing Dataset3 read select ALL proc 0, NONE others\n"); - memset(rdata, 0, bigcount*sizeof(B_DATATYPE)); + HDmemset(rdata, 0, bigcount*sizeof(B_DATATYPE)); dataset = H5Dopen2(fid, DATASET3, H5P_DEFAULT); VRFY((dataset >= 0), "H5Dopen2 succeeded"); @@ -989,7 +989,7 @@ dataset_big_read(void) fill_datasets(start, dims, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); + MESG("data_array created"); } /* set up the collective transfer properties list */ @@ -1010,7 +1010,7 @@ dataset_big_read(void) if(mpi_rank == 0) { /* verify the read data with original expected data */ ret = verify_data(start, count, stride, block, rdata, wdata); - if(ret) {fprintf(stderr, "verify failed\n"); exit(1);} + if(ret) {HDfprintf(stderr, "verify failed\n"); exit(1);} } /* release all temporary handles. */ @@ -1040,13 +1040,13 @@ dataset_big_read(void) fill_datasets(start, block, wdata); MESG("data_array initialized"); if(VERBOSE_MED){ - MESG("data_array created"); - dataset_print(start, block, wdata); + MESG("data_array created"); + dataset_print(start, block, wdata); } num_points = bigcount; - coords = (hsize_t *)malloc(num_points * RANK * sizeof(hsize_t)); + coords = (hsize_t *)HDmalloc(num_points * RANK * sizeof(hsize_t)); VRFY((coords != NULL), "coords malloc succeeded"); set_coords (start, count, stride, block, num_points, coords, IN_ORDER); @@ -1056,7 +1056,7 @@ dataset_big_read(void) ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); VRFY((ret >= 0), "H5Sselect_elements succeeded"); - if(coords) free(coords); + if(coords) HDfree(coords); /* create a memory dataspace */ /* Warning: H5Screate_simple requires an array of hsize_t elements @@ -1082,7 +1082,7 @@ dataset_big_read(void) VRFY((ret >= 0), "H5Dread dataset1 succeeded"); ret = verify_data(start, count, stride, block, rdata, wdata); - if(ret) {fprintf(stderr, "verify failed\n"); exit(1);} + if(ret) {HDfprintf(stderr, "verify failed\n"); exit(1);} /* release all temporary handles. */ H5Sclose(file_dataspace); @@ -1091,8 +1091,8 @@ dataset_big_read(void) ret = H5Dclose(dataset); VRFY((ret >= 0), "H5Dclose1 succeeded"); - free(wdata); - free(rdata); + HDfree(wdata); + HDfree(rdata); wdata = NULL; rdata = NULL; @@ -1115,8 +1115,8 @@ dataset_big_read(void) H5Fclose(fid); /* release data buffers */ - if(rdata) free(rdata); - if(wdata) free(wdata); + if(rdata) HDfree(rdata); + if(wdata) HDfree(wdata); } /* dataset_large_readAll */ @@ -1129,7 +1129,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) { hid_t ret_pl = -1; herr_t ret; /* generic return value */ - int mpi_rank; /* mpi variables */ + int mpi_rank; /* mpi variables */ /* need the rank for error checking macros */ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1138,36 +1138,36 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); if (l_facc_type == FACC_DEFAULT) - return (ret_pl); + return (ret_pl); if (l_facc_type == FACC_MPIO){ - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(ret_pl, comm, info); - VRFY((ret >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); - VRFY((ret >= 0), ""); + VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); - VRFY((ret >= 0), ""); - return(ret_pl); + VRFY((ret >= 0), ""); + return(ret_pl); } if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ - hid_t mpio_pl; - - mpio_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((mpio_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(mpio_pl, comm, info); - VRFY((ret >= 0), ""); - - /* setup file access template */ - ret_pl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((ret_pl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); - VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); - H5Pclose(mpio_pl); - return(ret_pl); + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); } /* unknown file access types */ @@ -1176,17 +1176,17 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /*------------------------------------------------------------------------- - * Function: coll_chunk1 + * Function: coll_chunk1 * - * Purpose: Wrapper to test the collective chunk IO for regular JOINT + * Purpose: Wrapper to test the collective chunk IO for regular JOINT selection with a single chunk * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Unknown - * July 12th, 2004 + * Programmer: Unknown + * July 12th, 2004 * * Modifications: * @@ -1215,7 +1215,7 @@ coll_chunk1(void) { const char *filename = FILENAME[0]; if (mpi_rank == 0) - printf("coll_chunk1\n"); + HDprintf("coll_chunk1\n"); coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1230,17 +1230,17 @@ coll_chunk1(void) /*------------------------------------------------------------------------- - * Function: coll_chunk2 + * Function: coll_chunk2 * - * Purpose: Wrapper to test the collective chunk IO for regular DISJOINT + * Purpose: Wrapper to test the collective chunk IO for regular DISJOINT selection with a single chunk * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Unknown - * July 12th, 2004 + * Programmer: Unknown + * July 12th, 2004 * * Modifications: * @@ -1269,7 +1269,7 @@ coll_chunk2(void) { const char *filename = FILENAME[0]; if (mpi_rank == 0) - printf("coll_chunk2\n"); + HDprintf("coll_chunk2\n"); coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1284,17 +1284,17 @@ coll_chunk2(void) /*------------------------------------------------------------------------- - * Function: coll_chunk3 + * Function: coll_chunk3 * - * Purpose: Wrapper to test the collective chunk IO for regular JOINT + * Purpose: Wrapper to test the collective chunk IO for regular JOINT selection with at least number of 2*mpi_size chunks * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Unknown - * July 12th, 2004 + * Programmer: Unknown + * July 12th, 2004 * * Modifications: * @@ -1324,7 +1324,7 @@ coll_chunk3(void) { const char *filename = FILENAME[0]; if (mpi_rank == 0) - printf("coll_chunk3\n"); + HDprintf("coll_chunk3\n"); coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); @@ -1341,17 +1341,17 @@ coll_chunk3(void) //------------------------------------------------------------------------- // Borrowed/Modified (slightly) from t_coll_chunk.c /*------------------------------------------------------------------------- - * Function: coll_chunktest + * Function: coll_chunktest * * Purpose: The real testing routine for regular selection of collective chunking storage testing both write and read, - If anything fails, it may be read or write. There is no - separation test between read and write. + If anything fails, it may be read or write. There is no + separation test between read and write. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Modifications: * Remove invalid temporary property checkings for API_LINK_HARD and @@ -1359,8 +1359,8 @@ coll_chunk3(void) * Programmer: Jonathan Kim * Date: 2012-10-10 * - * Programmer: Unknown - * July 12th, 2004 + * Programmer: Unknown + * July 12th, 2004 * * Modifications: * @@ -1369,14 +1369,14 @@ coll_chunk3(void) static void coll_chunktest(const char* filename, - int chunk_factor, - int select_factor, + int chunk_factor, + int select_factor, int api_option, int file_selection, int mem_selection, int mode) { - hid_t file, dataset, file_dataspace, mem_dataspace; + hid_t file, dataset, file_dataspace, mem_dataspace; hid_t acc_plist,xfer_plist,crp_plist; hsize_t dims[RANK], chunk_dims[RANK]; @@ -1524,41 +1524,41 @@ coll_chunktest(const char* filename, } switch(api_option){ - case API_LINK_HARD: - status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_ONE_IO); + case API_LINK_HARD: + status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_ONE_IO); VRFY((status>= 0),"collective chunk optimization succeeded"); break; - case API_MULTI_HARD: - status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_MULTI_IO); - VRFY((status>= 0),"collective chunk optimization succeeded "); + case API_MULTI_HARD: + status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_MULTI_IO); + VRFY((status>= 0),"collective chunk optimization succeeded "); break; - case API_LINK_TRUE: + case API_LINK_TRUE: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,2); - VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); + VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); break; - case API_LINK_FALSE: + case API_LINK_FALSE: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,6); VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); break; - case API_MULTI_COLL: + case API_MULTI_COLL: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */ VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); - status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,50); + status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,50); VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded"); break; - case API_MULTI_IND: + case API_MULTI_IND: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */ VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); - status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,100); + status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,100); VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded"); break; - default: + default: ; } @@ -1615,7 +1615,7 @@ coll_chunktest(const char* filename, /* write data collectively */ status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace, - xfer_plist, data_array1); + xfer_plist, data_array1); VRFY((status >= 0),"dataset write succeeded"); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY @@ -1820,22 +1820,22 @@ coll_chunktest(const char* filename, /***************************************************************************** * - * Function: do_express_test() + * Function: do_express_test() * - * Purpose: Do an MPI_Allreduce to obtain the maximum value returned - * by GetTestExpress() across all processes. Return this - * value. + * Purpose: Do an MPI_Allreduce to obtain the maximum value returned + * by GetTestExpress() across all processes. Return this + * value. * - * Envirmoment variables can be different across different - * processes. This function ensures that all processes agree - * on whether to do an express test. + * Envirmoment variables can be different across different + * processes. This function ensures that all processes agree + * on whether to do an express test. * - * Return: Success: Maximum of the values returned by - * GetTestExpress() across all processes. + * Return: Success: Maximum of the values returned by + * GetTestExpress() across all processes. * - * Failure: -1 + * Failure: -1 * - * Programmer: JRM -- 4/25/06 + * Programmer: JRM -- 4/25/06 * *****************************************************************************/ static int @@ -1868,7 +1868,7 @@ do_express_test(int world_mpi_rank) } /* do_express_test() */ -int main(int argc, char **argv) +int main(int argc, char **argv) { int ExpressMode = 0; hsize_t newsize = 1048576; @@ -1894,12 +1894,12 @@ int main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - HDprintf("Failed to turn off atexit processing. Continue.\n"); + HDprintf("Failed to turn off atexit processing. Continue.\n"); }; /* set alarm. */ ALARM_ON; - + ExpressMode = do_express_test(mpi_rank); dataset_big_write(); @@ -1923,7 +1923,7 @@ int main(int argc, char **argv) /* turn off alarm */ ALARM_OFF; - if (mpi_rank == 0) + if (mpi_rank == 0) HDremove(FILENAME[0]); /* close HDF5 library */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 50e6d50..cde19fe 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -622,7 +622,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: MPI_Comm_group() failed with error %d.\n", world_mpi_rank, FUNC, mpi_result); } @@ -641,7 +641,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: MPI_Group_excl() failed with error %d.\n", world_mpi_rank, FUNC, mpi_result); } @@ -658,7 +658,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: MPI_Comm_create() failed with error %d.\n", world_mpi_rank, FUNC, mpi_result); } @@ -672,7 +672,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: file_mpi_comm == MPI_COMM_NULL.\n", world_mpi_rank, FUNC); } @@ -686,7 +686,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: file_mpi_comm != MPI_COMM_NULL.\n", world_mpi_rank, FUNC); } @@ -704,7 +704,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: MPI_Comm_size() failed with error %d.\n", world_mpi_rank, FUNC, mpi_result); } @@ -720,7 +720,7 @@ set_up_file_communicator(void) nerrors++; success = FALSE; if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "%d:%s: MPI_Comm_rank() failed with error %d.\n", world_mpi_rank, FUNC, mpi_result); } @@ -7457,7 +7457,7 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("%d:Failed to turn off atexit processing. Continue.\n", + HDprintf("%d:Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); @@ -7476,24 +7476,24 @@ main(int argc, char **argv) } #ifdef H5_HAVE_MPE - if ( MAINPROCESS ) { printf(" Tests compiled for MPE.\n"); } + if ( MAINPROCESS ) { HDprintf(" Tests compiled for MPE.\n"); } virt_num_data_entries = MPE_VIRT_NUM_DATA_ENTIES; #endif /* H5_HAVE_MPE */ if (MAINPROCESS){ - printf("===================================\n"); - printf("Parallel metadata cache tests\n"); - printf(" mpi_size = %d\n", mpi_size); - printf(" express_test = %d\n", express_test); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("Parallel metadata cache tests\n"); + HDprintf(" mpi_size = %d\n", mpi_size); + HDprintf(" express_test = %d\n", express_test); + HDprintf("===================================\n"); } if ( mpi_size < 3 ) { if ( MAINPROCESS ) { - printf(" Need at least 3 processes. Exiting.\n"); + HDprintf(" Need at least 3 processes. Exiting.\n"); } goto finish; } @@ -7639,15 +7639,15 @@ finish: */ MPI_Barrier(MPI_COMM_WORLD); if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); + HDprintf("===================================\n"); if (failures){ - printf("***metadata cache tests detected %d failures***\n", + HDprintf("***metadata cache tests detected %d failures***\n", failures); } else{ - printf("metadata cache tests finished with no failures\n"); + HDprintf("metadata cache tests finished with no failures\n"); } - printf("===================================\n"); + HDprintf("===================================\n"); } takedown_derived_types(); diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index e158d69..08d455d 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -519,7 +519,7 @@ create_data_sets(hid_t file_id, int min_dset, int max_dset) /* create the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dcreate2(file_id, dset_name, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, properties, H5P_DEFAULT); @@ -713,7 +713,7 @@ create_data_sets(hid_t file_id, int min_dset, int max_dset) if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); } @@ -830,7 +830,7 @@ delete_data_sets(hid_t file_id, int min_dset, int max_dset) while ( ( pass ) && ( i <= max_dset ) ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); if ( H5Ldelete(file_id, dset_name, H5P_DEFAULT) < 0) { @@ -1187,7 +1187,7 @@ open_hdf5_file(const hbool_t create_file, } else { - file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { @@ -1446,7 +1446,7 @@ par_create_dataset(int dset_num, show_progress = (show_progress && (mpi_rank == 0)); verbose = (verbose && (mpi_rank == 0)); - sprintf(dset_name, "/dset%03d", dset_num); + HDsprintf(dset_name, "/dset%03d", dset_num); if ( show_progress ) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -1750,7 +1750,7 @@ par_create_dataset(int dset_num, if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, dset_num); } @@ -1848,7 +1848,7 @@ par_delete_dataset(int dset_num, show_progress = (show_progress && (mpi_rank == 0)); - sprintf(dset_name, "/dset%03d", dset_num); + HDsprintf(dset_name, "/dset%03d", dset_num); if ( show_progress ) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -1932,8 +1932,8 @@ par_insert_cache_image(int file_name_idx, int mpi_rank, int mpi_size ) int child_status; pid_t child_pid; - sprintf(file_name_idx_str, "%d", file_name_idx); - sprintf(mpi_size_str, "%d", mpi_size); + HDsprintf(file_name_idx_str, "%d", file_name_idx); + HDsprintf(mpi_size_str, "%d", mpi_size); child_pid = fork(); @@ -1954,7 +1954,7 @@ par_insert_cache_image(int file_name_idx, int mpi_rank, int mpi_size ) HDfprintf(stdout, "execl() of ici process failed. errno = %d(%s)\n", errno, strerror(errno)); - exit(1); + HDexit(1); } } else if ( child_pid != -1 ) { @@ -2056,7 +2056,7 @@ par_verify_dataset(int dset_num, show_progress = (show_progress && (mpi_rank == 0)); verbose = (verbose && (mpi_rank == 0)); - sprintf(dset_name, "/dset%03d", dset_num); + HDsprintf(dset_name, "/dset%03d", dset_num); if ( show_progress ) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -2233,7 +2233,7 @@ par_verify_dataset(int dset_num, if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, dset_num); } @@ -2448,7 +2448,7 @@ serial_verify_dataset(int dset_num, hid_t dset_id = -1; hid_t filespace_id = -1; - sprintf(dset_name, "/dset%03d", dset_num); + HDsprintf(dset_name, "/dset%03d", dset_num); if ( show_progress ) { HDfprintf(stdout, "%s: dset name = \"%s\".\n", fcn_name, dset_name); @@ -2603,7 +2603,7 @@ serial_verify_dataset(int dset_num, if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", j, k, dset_num); } @@ -2801,7 +2801,7 @@ usage(void) int i = 0; while(s[i] != NULL) { - fprintf(stdout, "%s", s[i]); + HDfprintf(stdout, "%s", s[i]); i++; } @@ -2876,7 +2876,7 @@ verify_data_sets(hid_t file_id, int min_dset, int max_dset) /* open the dataset */ if ( pass ) { - sprintf(dset_name, "/dset%03d", i); + HDsprintf(dset_name, "/dset%03d", i); dataset_ids[i] = H5Dopen2(file_id, dset_name, H5P_DEFAULT); if ( dataset_ids[i] < 0 ) { @@ -3016,7 +3016,7 @@ verify_data_sets(hid_t file_id, int min_dset, int max_dset) if ( verbose ) { - fprintf(stdout, + HDfprintf(stdout, "Chunk (%0d, %0d) in /dset%03d is invalid.\n", i, j, m); } @@ -4137,31 +4137,31 @@ main(int argc, char **argv) if ( pass ) { - printf("done.\n"); + HDprintf("done.\n"); HDfflush(stdout); } else { - printf("failed.\n"); - exit(1); + HDprintf("failed.\n"); + HDexit(1); } i++; } HDfprintf(stdout, "Test file construction complete.\n"); - exit(0); + HDexit(0); } else if ( ici ) { if ( serial_insert_cache_image(file_idx, mpi_size) ) { - exit(0); + HD exit(0); } else { HDfprintf(stderr, "\n\nCache image insertion failed.\n"); HDfprintf(stderr, " failure mssg = \"%s\"\n", failure_mssg); - exit(1); + HDexit(1); } } @@ -4178,24 +4178,24 @@ main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("%d:Failed to turn off atexit processing. Continue.\n", + HDprintf("%d:Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); if ( mpi_rank == 0 ) { - printf("===================================\n"); - printf("Parallel metadata cache image tests\n"); - printf(" mpi_size = %d\n", mpi_size); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("Parallel metadata cache image tests\n"); + HDprintf(" mpi_size = %d\n", mpi_size); + HDprintf("===================================\n"); } if ( mpi_size < 2 ) { if ( mpi_rank == 0 ) { - printf(" Need at least 2 processes. Exiting.\n"); + HDprintf(" Need at least 2 processes. Exiting.\n"); } goto finish; } @@ -4220,7 +4220,7 @@ main(int argc, char **argv) HDfprintf(stdout, "execl() of setup process failed. errno = %d(%s)\n", errno, strerror(errno)); - exit(1); + HDexit(1); } } else if ( child_pid != -1 ) { @@ -4271,16 +4271,16 @@ finish: MPI_Barrier(MPI_COMM_WORLD); if ( mpi_rank == 0 ) { /* only process 0 reports */ - sleep(10); - printf("===================================\n"); + HDsleep(10); + HDprintf("===================================\n"); if ( nerrs > 0 ) { - printf("***metadata cache image tests detected %d failures***\n", + HDprintf("***metadata cache image tests detected %d failures***\n", nerrs); } else { - printf("metadata cache image tests finished with no failures\n"); + HDprintf("metadata cache image tests finished with no failures\n"); } - printf("===================================\n"); + HDprintf("===================================\n"); } /* takedown_derived_types(); */ diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index c6fa3d4..40cc1ca 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -1134,7 +1134,7 @@ ccslab_set(int mpi_rank, break; } if (VERBOSE_MED){ - printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + HDprintf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], (unsigned long)(block[0]*block[1]*count[0]*count[1])); @@ -1197,20 +1197,20 @@ ccdataset_print(hsize_t start[], hsize_t i, j; /* print the column heading */ - printf("Print only the first block of the dataset\n"); - printf("%-8s", "Cols:"); + HDprintf("Print only the first block of the dataset\n"); + HDprintf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3lu ", (unsigned long)(start[1]+j)); + HDprintf("%3lu ", (unsigned long)(start[1]+j)); } - printf("\n"); + HDprintf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2lu: ", (unsigned long)(i+start[0])); + HDprintf("Row %2lu: ", (unsigned long)(i+start[0])); for (j=0; j < block[1]; j++){ - printf("%03d ", *dataptr++); + HDprintf("%03d ", *dataptr++); } - printf("\n"); + HDprintf("\n"); } } @@ -1233,13 +1233,13 @@ ccdataset_vrfy(hsize_t start[], /* print it if VERBOSE_MED */ if (VERBOSE_MED) { - printf("dataset_vrfy dumping:::\n"); - printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + HDprintf("dataset_vrfy dumping:::\n"); + HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); - printf("original values:\n"); + HDprintf("original values:\n"); ccdataset_print(start, block, original); - printf("compared values:\n"); + HDprintf("compared values:\n"); ccdataset_print(start, block, dataset); } @@ -1262,7 +1262,7 @@ ccdataset_vrfy(hsize_t start[], } if (*dataptr != *oriptr){ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", + HDprintf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", (unsigned long)i, (unsigned long)j, *(oriptr), *(dataptr)); } @@ -1272,8 +1272,8 @@ ccdataset_vrfy(hsize_t start[], } } if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if (vrfyerrs) - printf("%d errors found in ccdataset_vrfy\n", vrfyerrs); + HDprintf("%d errors found in ccdataset_vrfy\n", vrfyerrs); return(vrfyerrs); } diff --git a/testpar/t_file.c b/testpar/t_file.c index a3c007d..e3ce346 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -24,14 +24,14 @@ /* * This file needs to access private information from the H5F package. */ -#define H5AC_FRIEND /*suppress error about including H5ACpkg */ +#define H5AC_FRIEND /*suppress error about including H5ACpkg */ #include "H5ACpkg.h" -#define H5C_FRIEND /*suppress error about including H5Cpkg */ +#define H5C_FRIEND /*suppress error about including H5Cpkg */ #include "H5Cpkg.h" -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING #include "H5Fpkg.h" -#define H5MF_FRIEND /*suppress error about including H5MFpkg */ +#define H5MF_FRIEND /*suppress error about including H5MFpkg */ #include "H5MFpkg.h" #define NUM_DSETS 5 @@ -39,7 +39,7 @@ int mpi_size, mpi_rank; static int create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_strategy); -static int open_file(const char *filename, hid_t fapl, int metadata_write_strategy, +static int open_file(const char *filename, hid_t fapl, int metadata_write_strategy, hsize_t page_size, size_t page_buffer_size); /* @@ -60,15 +60,15 @@ test_split_comm_access(void) MPI_Info info = MPI_INFO_NULL; int is_old, mrc; int newrank, newprocs; - hid_t fid; /* file IDs */ - hid_t acc_tpl; /* File access properties */ - herr_t ret; /* generic return value */ + hid_t fid; /* file IDs */ + hid_t acc_tpl; /* File access properties */ + herr_t ret; /* generic return value */ const char *filename; filename = (const char *)GetTestParameters(); if (VERBOSE_MED) - printf("Split Communicator access test on file %s\n", - filename); + HDprintf("Split Communicator access test on file %s\n", + filename); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); @@ -80,35 +80,35 @@ test_split_comm_access(void) MPI_Comm_rank(comm,&newrank); if (is_old){ - /* odd-rank processes */ - mrc = MPI_Barrier(comm); - VRFY((mrc==MPI_SUCCESS), ""); + /* odd-rank processes */ + mrc = MPI_Barrier(comm); + VRFY((mrc==MPI_SUCCESS), ""); }else{ - /* even-rank processes */ - int sub_mpi_rank; /* rank in the sub-comm */ - MPI_Comm_rank(comm,&sub_mpi_rank); - - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); - - /* create the file collectively */ - fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); - VRFY((fid >= 0), "H5Fcreate succeeded"); - - /* Release file-access template */ - ret=H5Pclose(acc_tpl); - VRFY((ret >= 0), ""); - - /* close the file */ - ret=H5Fclose(fid); - VRFY((ret >= 0), ""); - - /* delete the test file */ - if (sub_mpi_rank == 0){ - mrc = MPI_File_delete((char *)filename, info); - /*VRFY((mrc==MPI_SUCCESS), ""); */ - } + /* even-rank processes */ + int sub_mpi_rank; /* rank in the sub-comm */ + MPI_Comm_rank(comm,&sub_mpi_rank); + + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); + + /* create the file collectively */ + fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); + VRFY((fid >= 0), "H5Fcreate succeeded"); + + /* Release file-access template */ + ret=H5Pclose(acc_tpl); + VRFY((ret >= 0), ""); + + /* close the file */ + ret=H5Fclose(fid); + VRFY((ret >= 0), ""); + + /* delete the test file */ + if (sub_mpi_rank == 0){ + mrc = MPI_File_delete((char *)filename, info); + /*VRFY((mrc==MPI_SUCCESS), ""); */ + } } mrc = MPI_Comm_free(&comm); VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free succeeded"); @@ -126,7 +126,7 @@ test_page_buffer_access(void) haddr_t raw_addr, meta_addr; int *data; H5F_t *f = NULL; - herr_t ret; /* generic return value */ + herr_t ret; /* generic return value */ const char *filename; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ @@ -136,7 +136,7 @@ test_page_buffer_access(void) filename = (const char *)GetTestParameters(); if (VERBOSE_MED) - printf("Page Buffer Usage in Parallel %s\n", filename); + HDprintf("Page Buffer Usage in Parallel %s\n", filename); fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); VRFY((fapl >= 0), "create_faccess_plist succeeded"); @@ -178,7 +178,6 @@ test_page_buffer_access(void) /* intialize all the elements to have a value of -1 */ for(i=0 ; ishared->page_buf->slist_ptr) == page_count), "Wrong number of pages in PB"); - for (i=0; i < 50; i++) + for (i=0; i < 50; i++) VRFY((data[i] == -1), "Read different values than written"); /* close the file */ @@ -504,28 +503,28 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str VRFY((mem_dataspace >= 0), ""); for(k=0 ; k= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - sprintf(dset_name, "D2dset%d", k); + HDsprintf(dset_name, "D2dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - sprintf(dset_name, "D3dset%d", k); + HDsprintf(dset_name, "D3dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); ret = H5Dclose(dset_id); VRFY((ret == 0), ""); - sprintf(dset_name, "dset%d", k); + HDsprintf(dset_name, "dset%d", k); dset_id = H5Dcreate2(grp_id, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dset_id >= 0), ""); @@ -549,13 +548,13 @@ create_file(const char *filename, hid_t fcpl, hid_t fapl, int metadata_write_str for (i=0; i < num_elements; i++) VRFY((data_array[i] == mpi_rank+1), "Dataset Verify failed"); - sprintf(dset_name, "D1dset%d", k); + HDsprintf(dset_name, "D1dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); - sprintf(dset_name, "D2dset%d", k); + HDsprintf(dset_name, "D2dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); - sprintf(dset_name, "D3dset%d", k); + HDsprintf(dset_name, "D3dset%d", k); ret = H5Ldelete(grp_id, dset_name, H5P_DEFAULT); VRFY((ret == 0), ""); } @@ -657,7 +656,7 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, VRFY((mem_dataspace >= 0), ""); for(k=0 ; k= 0), ""); @@ -741,7 +740,7 @@ void test_file_properties(void) { hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access plist */ + hid_t fapl_id; /* File access plist */ hbool_t is_coll; const char *filename; MPI_Comm comm = MPI_COMM_WORLD; diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index 4556b01..28baed5 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -37,9 +37,9 @@ static int mpi_size, mpi_rank; #define HS_DIM1 200 #define HS_DIM2 100 - + /*------------------------------------------------------------------------- - * Function: filter_read_internal + * Function: filter_read_internal * * Purpose: Tests parallel reading of a 2D dataset written serially using * filters. During the parallel reading phase, the dataset is @@ -54,13 +54,13 @@ static void filter_read_internal(const char *filename, hid_t dcpl, hsize_t *dset_size) { - hid_t file, dataset; /* HDF5 IDs */ - hid_t access_plist; /* Access property list ID */ - hid_t sid, memspace; /* Dataspace IDs */ - hsize_t size[2]; /* Dataspace dimensions */ - hsize_t hs_offset[2]; /* Hyperslab offset */ - hsize_t hs_size[2]; /* Hyperslab size */ - size_t i, j; /* Local index variables */ + hid_t file, dataset; /* HDF5 IDs */ + hid_t access_plist; /* Access property list ID */ + hid_t sid, memspace; /* Dataspace IDs */ + hsize_t size[2]; /* Dataspace dimensions */ + hsize_t hs_offset[2]; /* Hyperslab offset */ + hsize_t hs_size[2]; /* Hyperslab size */ + size_t i, j; /* Local index variables */ char name[32] = "dataset"; herr_t hrc; /* Error status */ int *points = NULL; /* Writing buffer for entire dataset */ @@ -151,17 +151,17 @@ filter_read_internal(const char *filename, hid_t dcpl, for (j=0; j=0, "H5Pset_szip"); - filter_read_internal(filename,dc,&combo_size); + filter_read_internal(filename,dc,&combo_size); } /* Clean up objects used for this test */ @@ -461,25 +461,25 @@ test_filter_read(void) /* Testing shuffle+szip(with encoder)+checksum filters(checksum last) */ /* Make sure encoding is enabled */ if(h5_szip_can_encode() == 1) { - dc = H5Pcreate(H5P_DATASET_CREATE); + dc = H5Pcreate(H5P_DATASET_CREATE); VRFY(dc>=0, "H5Pcreate"); - hrc = H5Pset_chunk (dc, 2, chunk_size); + hrc = H5Pset_chunk (dc, 2, chunk_size); VRFY(hrc>=0, "H5Pset_chunk"); - hrc = H5Pset_shuffle (dc); + hrc = H5Pset_shuffle (dc); VRFY(hrc>=0, "H5Pset_shuffle"); - hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block); + hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block); VRFY(hrc>=0, "H5Pset_szip"); - hrc = H5Pset_fletcher32 (dc); + hrc = H5Pset_fletcher32 (dc); VRFY(hrc>=0, "H5Pset_fletcher32"); - filter_read_internal(filename,dc,&combo_size); + filter_read_internal(filename,dc,&combo_size); - /* Clean up objects used for this test */ - hrc = H5Pclose (dc); + /* Clean up objects used for this test */ + hrc = H5Pclose (dc); VRFY(hrc>=0, "H5Pclose"); } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 7f75d20..e9f4101 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -21,7 +21,7 @@ enum obj_type { is_group, is_dset }; -static int get_size(void); +static int get_size(void); static void write_dataset(hid_t, hid_t, hid_t); static int read_dataset(hid_t, hid_t, hid_t); static void create_group_recursive(hid_t, hid_t, hid_t, int); @@ -54,13 +54,9 @@ get_size(void) MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); if(mpi_size > size ) { - if((mpi_size % 2) == 0 ) { - size = mpi_size; - } else { - size = mpi_size + 1; } } @@ -79,7 +75,7 @@ get_size(void) void zero_dim_dset(void) { int mpi_size, mpi_rank; - const char *filename; + const char *filename; hid_t fid, plist, dcpl, dsid, sid; hsize_t dim, chunk_dim; herr_t ret; @@ -133,27 +129,27 @@ void zero_dim_dset(void) * Example of using PHDF5 to create ndatasets datasets. Each process write * a slab of array to the file. * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. + * Changes: Updated function to use a dynamically calculated size, + * instead of the old SIZE #define. This should allow it + * to function with an arbitrary number of processors. * - * JRM - 8/11/04 + * JRM - 8/11/04 */ void multiple_dset_write(void) { - int i, j, n, mpi_size, mpi_rank, size; + int i, j, n, mpi_size, mpi_rank, size; hid_t iof, plist, dataset, memspace, filespace; hid_t dcpl; /* Dataset creation property list */ hsize_t chunk_origin [DIM]; hsize_t chunk_dims [DIM], file_dims [DIM]; hsize_t count[DIM]={1,1}; - double * outme = NULL; + double *outme = NULL; double fill=1.0; /* Fill value */ - char dname [100]; + char dname [100]; herr_t ret; - const H5Ptest_param_t *pt; - char *filename; - int ndatasets; + const H5Ptest_param_t *pt; + char *filename; + int ndatasets; pt = GetTestParameters(); filename = pt->name; @@ -190,23 +186,23 @@ void multiple_dset_write(void) VRFY((ret>=0), "set fill-value succeeded"); for(n = 0; n < ndatasets; n++) { - sprintf(dname, "dataset %d", n); - dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset > 0), dname); + HDsprintf(dname, "dataset %d", n); + dataset = H5Dcreate2(iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + VRFY((dataset > 0), dname); - /* calculate data to write */ - for(i = 0; i < size; i++) - for(j = 0; j < size; j++) - outme [(i * size) + j] = n*1000 + mpi_rank; + /* calculate data to write */ + for(i = 0; i < size; i++) + for(j = 0; j < size; j++) + outme [(i * size) + j] = n*1000 + mpi_rank; - H5Dwrite(dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme); + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme); - H5Dclose(dataset); + H5Dclose(dataset); #ifdef BARRIER_CHECKS - if(!((n+1) % 10)) { - printf("created %d datasets\n", n+1); - MPI_Barrier(MPI_COMM_WORLD); - } + if(!((n+1) % 10)) { + HDprintf("created %d datasets\n", n+1); + MPI_Barrier(MPI_COMM_WORLD); + } #endif /* BARRIER_CHECKS */ } @@ -221,21 +217,21 @@ void multiple_dset_write(void) /* Example of using PHDF5 to create, write, and read compact dataset. * - * Changes: Updated function to use a dynamically calculated size, - * instead of the old SIZE #define. This should allow it - * to function with an arbitrary number of processors. + * Changes: Updated function to use a dynamically calculated size, + * instead of the old SIZE #define. This should allow it + * to function with an arbitrary number of processors. * - * JRM - 8/11/04 + * JRM - 8/11/04 */ void compact_dataset(void) { - int i, j, mpi_size, mpi_rank, size, err_num=0; - hid_t iof, plist, dcpl, dxpl, dataset, filespace; + int i, j, mpi_size, mpi_rank, size, err_num=0; + hid_t iof, plist, dcpl, dxpl, dataset, filespace; hsize_t file_dims [DIM]; - double * outme; - double * inme; - char dname[]="dataset"; - herr_t ret; + double *outme; + double *inme; + char dname[]="dataset"; + herr_t ret; const char *filename; size = get_size(); @@ -278,15 +274,15 @@ void compact_dataset(void) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pcreate xfer succeeded"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0),"set independent IO collectively succeeded"); + ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); } /* Recalculate data to write. Each process writes the same data. */ for(i = 0; i < size; i++) for(j = 0; j < size; j++) - outme[(i * size) + j] =(i + j) * 1000; + outme[(i * size) + j] =(i + j) * 1000; ret = H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, dxpl, outme); VRFY((ret >= 0), "H5Dwrite succeeded"); @@ -308,8 +304,8 @@ void compact_dataset(void) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pcreate xfer succeeded"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0),"set independent IO collectively succeeded"); + ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); } dataset = H5Dopen2(iof, dname, H5P_DEFAULT); @@ -338,7 +334,7 @@ void compact_dataset(void) for(j = 0; j < size; j++) if(inme[(i * size) + j] != outme[(i * size) + j]) if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j, outme[(i * size) + j], inme[(i * size) + j]); + HDprintf("Dataset Verify failed at [%d][%d]: expect %f, got %f\n", i, j, outme[(i * size) + j], inme[(i * size) + j]); H5Pclose(plist); H5Pclose(dxpl); @@ -352,24 +348,24 @@ void compact_dataset(void) * Example of using PHDF5 to create, write, and read dataset and attribute * of Null dataspace. * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. + * Changes: Removed the assert that mpi_size <= the SIZE #define. + * As best I can tell, this assert isn't needed here, + * and in any case, the SIZE #define is being removed + * in an update of the functions in this file to run + * with an arbitrary number of processes. * * JRM - 8/24/04 */ void null_dataset(void) { - int mpi_size, mpi_rank; - hid_t iof, plist, dxpl, dataset, attr, sid; + int mpi_size, mpi_rank; + hid_t iof, plist, dxpl, dataset, attr, sid; unsigned uval=2; /* Buffer for writing to dataset */ - int val=1; /* Buffer for writing to attribute */ - int nelem; - char dname[]="dataset"; - char attr_name[]="attribute"; - herr_t ret; + int val=1; /* Buffer for writing to attribute */ + int nelem; + char dname[]="dataset"; + char attr_name[]="attribute"; + herr_t ret; const char *filename; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -397,8 +393,8 @@ void null_dataset(void) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pcreate xfer succeeded"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0),"set independent IO collectively succeeded"); + ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); } @@ -431,8 +427,8 @@ void null_dataset(void) ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pcreate xfer succeeded"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0),"set independent IO collectively succeeded"); + ret = H5Pset_dxpl_mpio_collective_opt(dxpl,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); } @@ -464,11 +460,11 @@ void null_dataset(void) * sizes(2GB, 4GB, etc.), but the metadata for the file pushes the file over * the boundary of interest. * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. + * Changes: Removed the assert that mpi_size <= the SIZE #define. + * As best I can tell, this assert isn't needed here, + * and in any case, the SIZE #define is being removed + * in an update of the functions in this file to run + * with an arbitrary number of processes. * * JRM - 8/11/04 */ @@ -592,13 +588,13 @@ void big_dataset(void) * not have actual data written to the entire raw data area and relies on the * default fill value of zeros to work correctly. * - * Changes: Removed the assert that mpi_size <= the SIZE #define. - * As best I can tell, this assert isn't needed here, - * and in any case, the SIZE #define is being removed - * in an update of the functions in this file to run - * with an arbitrary number of processes. + * Changes: Removed the assert that mpi_size <= the SIZE #define. + * As best I can tell, this assert isn't needed here, + * and in any case, the SIZE #define is being removed + * in an update of the functions in this file to run + * with an arbitrary number of processes. * - * Also added code to free dynamically allocated buffers. + * Also added code to free dynamically allocated buffers. * * JRM - 8/11/04 */ @@ -619,7 +615,7 @@ void dataset_fillvalue(void) hsize_t dset_size; /* Dataset size */ int *rdata, *wdata; /* Buffers for data to read and write */ int *twdata, *trdata; /* Temporary pointer into buffer */ - int acc, i, j, k, l, ii; /* Local index variables */ + int acc, i, ii, j, k, l; /* Local index variables */ herr_t ret; /* Generic return value */ const char *filename; @@ -707,11 +703,11 @@ void dataset_fillvalue(void) for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++) if(*trdata != 0) if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata); + HDprintf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata); if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(err_num) { - printf("%d errors found in check_value\n", err_num); + HDprintf("%d errors found in check_value\n", err_num); nerrors++; } } @@ -798,21 +794,21 @@ void dataset_fillvalue(void) if(i MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(err_num){ - printf("%d errors found in check_value\n", err_num); + HDprintf("%d errors found in check_value\n", err_num); nerrors++; } } - + /* Close all file objects */ ret = H5Dclose(dataset); VRFY((ret >= 0), "H5Dclose succeeded"); @@ -866,8 +862,8 @@ void collective_group_write(void) hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */ herr_t ret1, ret2; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -912,11 +908,11 @@ void collective_group_write(void) /* creates ngroups groups under the root group, writes chunked * datasets in parallel. */ for(m = 0; m < ngroups; m++) { - sprintf(gname, "group%d", m); + HDsprintf(gname, "group%d", m); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((gid > 0), gname); - sprintf(dname, "dataset%d", m); + HDsprintf(dname, "dataset%d", m); did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, dcpl, H5P_DEFAULT); VRFY((did > 0), dname); @@ -932,7 +928,7 @@ void collective_group_write(void) #ifdef BARRIER_CHECKS if(!((m+1) % 10)) { - printf("created %d groups\n", m+1); + HDprintf("created %d groups\n", m+1); MPI_Barrier(MPI_COMM_WORLD); } #endif /* BARRIER_CHECKS */ @@ -954,8 +950,8 @@ void independent_group_read(void) int mpi_rank, m; hid_t plist, fid; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -989,9 +985,9 @@ void independent_group_read(void) * instead of the old SIZE #define. This should allow it * to function with an arbitrary number of processors. * - * Also added code to verify the results of dynamic memory - * allocations, and to free dynamically allocated memeory - * when we are done with it. + * Also added code to verify the results of dynamic memory + * allocations, and to free dynamically allocated memeory + * when we are done with it. * * JRM - 8/16/04 */ @@ -1013,12 +1009,12 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); /* open every group under root group. */ - sprintf(gname, "group%d", m); + HDsprintf(gname, "group%d", m); gid = H5Gopen2(fid, gname, H5P_DEFAULT); VRFY((gid > 0), gname); /* check the data. */ - sprintf(dname, "dataset%d", m); + HDsprintf(dname, "dataset%d", m); did = H5Dopen2(gid, dname, H5P_DEFAULT); VRFY((did>0), dname); @@ -1083,8 +1079,8 @@ void multiple_group_write(void) hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; herr_t ret; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -1119,23 +1115,23 @@ void multiple_group_write(void) /* creates ngroups groups under the root group, writes datasets in * parallel. */ for(m = 0; m < ngroups; m++) { - sprintf(gname, "group%d", m); + HDsprintf(gname, "group%d", m); gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((gid > 0), gname); /* create attribute for these groups. */ - write_attribute(gid, is_group, m); + write_attribute(gid, is_group, m); if(m != 0) - write_dataset(memspace, filespace, gid); + write_dataset(memspace, filespace, gid); H5Gclose(gid); #ifdef BARRIER_CHECKS if(!((m+1) % 10)) { - printf("created %d groups\n", m+1); + HDprintf("created %d groups\n", m+1); MPI_Barrier(MPI_COMM_WORLD); - } + } #endif /* BARRIER_CHECKS */ } @@ -1181,13 +1177,13 @@ write_dataset(hid_t memspace, hid_t filespace, hid_t gid) VRFY((outme != NULL), "HDmalloc succeeded for outme"); for(n = 0; n < NDATASET; n++) { - sprintf(dname, "dataset%d", n); + HDsprintf(dname, "dataset%d", n); did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((did > 0), dname); for(i = 0; i < size; i++) for(j = 0; j < size; j++) - outme[(i * size) + j] = n * 1000 + mpi_rank; + outme[(i * size) + j] = n * 1000 + mpi_rank; H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme); @@ -1214,12 +1210,12 @@ create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, int counter) #ifdef BARRIER_CHECKS if(!((counter+1) % 10)) { - printf("created %dth child groups\n", counter+1); + HDprintf("created %dth child groups\n", counter+1); MPI_Barrier(MPI_COMM_WORLD); } #endif /* BARRIER_CHECKS */ - sprintf(gname, "%dth_child_group", counter+1); + HDsprintf(gname, "%dth_child_group", counter+1); child_gid = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((child_gid > 0), gname); @@ -1251,8 +1247,8 @@ void multiple_group_read(void) hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -1280,19 +1276,19 @@ void multiple_group_read(void) /* open every group under root group. */ for(m=0; m 0), gname); /* check the data. */ if(m != 0) if((error_num = read_dataset(memspace, filespace, gid))>0) - nerrors += error_num; + nerrors += error_num; /* check attribute.*/ error_num = 0; if((error_num = read_attribute(gid, is_group, m))>0 ) - nerrors += error_num; + nerrors += error_num; H5Gclose(gid); @@ -1344,7 +1340,7 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid) VRFY((outdata != NULL), "HDmalloc succeeded for outdata"); for(n=0; n0), dname); @@ -1353,10 +1349,10 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid) /* this is the original value */ for(i=0; i0), gname); recursive_read_group(memspace, filespace, child_gid, counter+1); @@ -1418,7 +1414,7 @@ write_attribute(hid_t obj_id, int this_type, int num) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if(this_type == is_group) { - sprintf(attr_name, "Group Attribute %d", num); + HDsprintf(attr_name, "Group Attribute %d", num); sid = H5Screate(H5S_SCALAR); aid = H5Acreate2(obj_id, attr_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); H5Awrite(aid, H5T_NATIVE_INT, &num); @@ -1426,7 +1422,7 @@ write_attribute(hid_t obj_id, int this_type, int num) H5Sclose(sid); } /* end if */ else if(this_type == is_dset) { - sprintf(attr_name, "Dataset Attribute %d", num); + HDsprintf(attr_name, "Dataset Attribute %d", num); for(i=0; i<8; i++) attr_data[i] = i; sid = H5Screate_simple(dspace_rank, dspace_dims, NULL); @@ -1450,23 +1446,23 @@ read_attribute(hid_t obj_id, int this_type, int num) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if(this_type == is_group) { - sprintf(attr_name, "Group Attribute %d", num); + HDsprintf(attr_name, "Group Attribute %d", num); aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT); if(MAINPROCESS) { H5Aread(aid, H5T_NATIVE_INT, &in_num); vrfy_errors = dataset_vrfy(NULL, NULL, NULL, group_block, &in_num, &num); - } + } H5Aclose(aid); } else if(this_type == is_dset) { - sprintf(attr_name, "Dataset Attribute %d", num); + HDsprintf(attr_name, "Dataset Attribute %d", num); for(i=0; i<8; i++) out_data[i] = i; aid = H5Aopen(obj_id, attr_name, H5P_DEFAULT); if(MAINPROCESS) { H5Aread(aid, H5T_NATIVE_INT, in_data); vrfy_errors = dataset_vrfy(NULL, NULL, NULL, dset_block, in_data, out_data); - } + } H5Aclose(aid); } @@ -1476,11 +1472,11 @@ read_attribute(hid_t obj_id, int this_type, int num) /* This functions compares the original data with the read-in data for its * hyperslab part only by process ID. * - * Changes: Modified function to use a passed in size parameter - * instead of the old SIZE #define. This should let us - * run with an arbitrary number of processes. + * Changes: Modified function to use a passed in size parameter + * instead of the old SIZE #define. This should let us + * run with an arbitrary number of processes. * - * JRM - 8/16/04 + * JRM - 8/16/04 */ static int check_value(DATATYPE *indata, DATATYPE *outdata, int size) @@ -1500,23 +1496,23 @@ check_value(DATATYPE *indata, DATATYPE *outdata, int size) for(i=chunk_origin[0]; i<(chunk_origin[0]+chunk_dims[0]); i++) for(j=chunk_origin[1]; j<(chunk_origin[1]+chunk_dims[1]); j++) { if(*indata != *outdata ) - if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%lu][%lu](row %lu, col%lu): expect %d, got %d\n",(unsigned long)i,(unsigned long)j,(unsigned long)i,(unsigned long)j, *outdata, *indata); - } + if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) + HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col%lu): expect %d, got %d\n",(unsigned long)i,(unsigned long)j,(unsigned long)i,(unsigned long)j, *outdata, *indata); + } if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) - printf("[more errors ...]\n"); + HDprintf("[more errors ...]\n"); if(err_num) - printf("%d errors found in check_value\n", err_num); + HDprintf("%d errors found in check_value\n", err_num); return err_num; } /* Decide the portion of data chunk in dataset by process ID. * - * Changes: Modified function to use a passed in size parameter - * instead of the old SIZE #define. This should let us - * run with an arbitrary number of processes. + * Changes: Modified function to use a passed in size parameter + * instead of the old SIZE #define. This should let us + * run with an arbitrary number of processes. * - * JRM - 8/11/04 + * JRM - 8/11/04 */ static void @@ -1560,7 +1556,7 @@ get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], * on failure. * JRM - 9/13/04 * - * Changes: None. + * Changes: None. */ #define N 4 @@ -1595,10 +1591,10 @@ void io_mode_confusion(void) * test bed related variables */ - const char * fcn_name = "io_mode_confusion"; - const hbool_t verbose = FALSE; - const H5Ptest_param_t * pt; - char * filename; + const char * fcn_name = "io_mode_confusion"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t * pt; + char * filename; pt = GetTestParameters(); @@ -1799,13 +1795,13 @@ void io_mode_confusion(void) /* * At present, the object header code maintains an image of its on disk * representation, which is updates as necessary instead of generating on - * request. + * request. * * Prior to the fix that this test in designed to verify, the image of the * on disk representation was only updated on flush -- not when the object * header was marked clean. * - * This worked perfectly well as long as all writes of a given object + * This worked perfectly well as long as all writes of a given object * header were written from a single process. However, with the implementation * of round robin metadata data writes in parallel HDF5, this is no longer * the case -- it is possible for a given object header to be flushed from @@ -1813,14 +1809,14 @@ void io_mode_confusion(void) * clean in all other processes on each flush. This resulted in NULL or * out of data object header information being written to disk. * - * To repair this, I modified the object header code to update its - * on disk image both on flush on when marked clean. + * To repair this, I modified the object header code to update its + * on disk image both on flush on when marked clean. * * This test is directed at verifying that the fix performs as expected. * * The test functions by creating a HDF5 file with several small datasets, - * and then flushing the file. This should result of at least one of - * the associated object headers being flushed by a process other than + * and then flushing the file. This should result of at least one of + * the associated object headers being flushed by a process other than * process 0. * * Then for each data set, add an attribute and flush the file again. @@ -1830,26 +1826,26 @@ void io_mode_confusion(void) * Open the each of the data sets in turn. If all opens are successful, * the test passes. Otherwise the test fails. * - * Note that this test will probably become irrelevent shortly, when we + * Note that this test will probably become irrelevent shortly, when we * land the journaling modifications on the trunk -- at which point all * cache clients will have to construct on disk images on demand. * - * JRM -- 10/13/10 + * JRM -- 10/13/10 * * Changes: - * Break it into two parts, a writer to write the file and a reader - * the correctness of the writer. AKC -- 2010/10/27 + * Break it into two parts, a writer to write the file and a reader + * the correctness of the writer. AKC -- 2010/10/27 */ -#define NUM_DATA_SETS 4 -#define LOCAL_DATA_SIZE 4 -#define LARGE_ATTR_SIZE 256 +#define NUM_DATA_SETS 4 +#define LOCAL_DATA_SIZE 4 +#define LARGE_ATTR_SIZE 256 /* Since all even and odd processes are split into writer and reader comm * respectively, process 0 and 1 in COMM_WORLD become the root process of * the writer and reader comm respectively. */ -#define Writer_Root 0 -#define Reader_Root 1 +#define Writer_Root 0 +#define Reader_Root 1 #define Reader_wait(mpi_err, xsteps) \ mpi_err = MPI_Bcast(&xsteps, 1, MPI_INT, Writer_Root, MPI_COMM_WORLD) #define Reader_result(mpi_err, xsteps_done) \ @@ -1861,26 +1857,26 @@ void io_mode_confusion(void) /* object names used by both rr_obj_hdr_flush_confusion and * rr_obj_hdr_flush_confusion_reader. */ -const char * dataset_name[NUM_DATA_SETS] = - { - "dataset_0", - "dataset_1", - "dataset_2", - "dataset_3" +const char * dataset_name[NUM_DATA_SETS] = + { + "dataset_0", + "dataset_1", + "dataset_2", + "dataset_3" }; -const char * att_name[NUM_DATA_SETS] = - { - "attribute_0", - "attribute_1", - "attribute_2", - "attribute_3" +const char * att_name[NUM_DATA_SETS] = + { + "attribute_0", + "attribute_1", + "attribute_2", + "attribute_3" }; -const char * lg_att_name[NUM_DATA_SETS] = - { - "large_attribute_0", - "large_attribute_1", - "large_attribute_2", - "large_attribute_3" +const char * lg_att_name[NUM_DATA_SETS] = + { + "large_attribute_0", + "large_attribute_1", + "large_attribute_2", + "large_attribute_3" }; void rr_obj_hdr_flush_confusion(void) @@ -1889,14 +1885,14 @@ void rr_obj_hdr_flush_confusion(void) /* private communicator size and rank */ int mpi_size; int mpi_rank; - int mrc; /* mpi error code */ - int is_reader; /* 1 for reader process; 0 for writer process. */ + int mrc; /* mpi error code */ + int is_reader; /* 1 for reader process; 0 for writer process. */ MPI_Comm comm; /* test bed related variables */ - const char * fcn_name = "rr_obj_hdr_flush_confusion"; - const hbool_t verbose = FALSE; + const char * fcn_name = "rr_obj_hdr_flush_confusion"; + const hbool_t verbose = FALSE; /* Create two new private communicators from MPI_COMM_WORLD. * Even and odd ranked processes go to comm_writers and comm_readers @@ -1919,9 +1915,9 @@ void rr_obj_hdr_flush_confusion(void) * step. When all steps are done, they inform readers to end. */ if (is_reader) - rr_obj_hdr_flush_confusion_reader(comm); + rr_obj_hdr_flush_confusion_reader(comm); else - rr_obj_hdr_flush_confusion_writer(comm); + rr_obj_hdr_flush_confusion_writer(comm); MPI_Comm_free(&comm); if(verbose ) @@ -1965,16 +1961,16 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* private communicator size and rank */ int mpi_size; int mpi_rank; - int mrc; /* mpi error code */ + int mrc; /* mpi error code */ /* steps to verify and have been verified */ int steps = 0; int steps_done = 0; /* test bed related variables */ - const char * fcn_name = "rr_obj_hdr_flush_confusion_writer"; - const hbool_t verbose = FALSE; - const H5Ptest_param_t * pt; - char * filename; + const char * fcn_name = "rr_obj_hdr_flush_confusion_writer"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t * pt; + char * filename; /* * setup test bed related variables: @@ -2008,7 +2004,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) */ if(verbose ) - HDfprintf(stdout, "%0d:%s: Creating new file \"%s\".\n", + HDfprintf(stdout, "%0d:%s: Creating new file \"%s\".\n", mpi_rank, fcn_name, filename); file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); @@ -2023,7 +2019,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) */ if(verbose ) - HDfprintf(stdout, "%0d:%s: Creating the datasets.\n", + HDfprintf(stdout, "%0d:%s: Creating the datasets.\n", mpi_rank, fcn_name); disk_size[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_size); @@ -2032,15 +2028,15 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) for ( i = 0; i < NUM_DATA_SETS; i++ ) { disk_space[i] = H5Screate_simple(1, disk_size, NULL); - VRFY((disk_space[i] >= 0), "H5Screate_simple(1) failed.\n"); + VRFY((disk_space[i] >= 0), "H5Screate_simple(1) failed.\n"); - dataset[i] = H5Dcreate2(file_id, dataset_name[i], H5T_NATIVE_DOUBLE, + dataset[i] = H5Dcreate2(file_id, dataset_name[i], H5T_NATIVE_DOUBLE, disk_space[i], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset[i] >= 0), "H5Dcreate(1) failed.\n"); } - /* + /* * setup data transfer property list */ @@ -2051,11 +2047,11 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); - VRFY((err >= 0), + VRFY((err >= 0), "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); - /* - * write data to the data sets + /* + * write data to the data sets */ if(verbose ) @@ -2071,22 +2067,22 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, NULL, disk_count, NULL); VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); mem_space[i] = H5Screate_simple(1, mem_size, NULL); - VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); - err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, mem_start, NULL, mem_count, NULL); VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); - err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], disk_space[i], dxpl_id, data); VRFY((err >= 0), "H5Dwrite(1) failed.\n"); for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - data[j] *= 10.0; + data[j] *= 10.0; } - /* + /* * close the data spaces */ @@ -2102,12 +2098,12 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* End of Step 1: create the data sets and write data. */ - /* + /* * flush the metadata cache */ if(verbose ) - HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name); err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((err >= 0), "H5Fflush(1) failed.\n"); @@ -2131,7 +2127,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) for ( i = 0; i < NUM_DATA_SETS; i++ ) { att_space[i] = H5Screate_simple(1, att_size, NULL); VRFY((att_space[i] >= 0), "H5Screate_simple(3) failed.\n"); - att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, + att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, att_space[i], H5P_DEFAULT, H5P_DEFAULT); VRFY((att_id[i] >= 0), "H5Acreate(1) failed.\n"); err = H5Awrite(att_id[i], H5T_NATIVE_DOUBLE, att); @@ -2142,11 +2138,11 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } /* - * close attribute IDs and spaces + * close attribute IDs and spaces */ if(verbose ) - HDfprintf(stdout, "%0d:%s: closing attr ids and spaces .\n", + HDfprintf(stdout, "%0d:%s: closing attr ids and spaces .\n", mpi_rank, fcn_name); for ( i = 0; i < NUM_DATA_SETS; i++ ) { @@ -2159,12 +2155,12 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* End of Step 2: write attributes to each dataset */ - /* + /* * flush the metadata cache again */ if(verbose ) - HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name); err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((err >= 0), "H5Fflush(2) failed.\n"); @@ -2178,7 +2174,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) */ if(verbose ) - HDfprintf(stdout, "%0d:%s: writing large attributes.\n", + HDfprintf(stdout, "%0d:%s: writing large attributes.\n", mpi_rank, fcn_name); lg_att_size[0] = (hsize_t)(LARGE_ATTR_SIZE); @@ -2190,7 +2186,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) for ( i = 0; i < NUM_DATA_SETS; i++ ) { lg_att_space[i] = H5Screate_simple(1, lg_att_size, NULL); VRFY((lg_att_space[i] >= 0), "H5Screate_simple(4) failed.\n"); - lg_att_id[i] = H5Acreate2(dataset[i], lg_att_name[i], H5T_NATIVE_DOUBLE, + lg_att_id[i] = H5Acreate2(dataset[i], lg_att_name[i], H5T_NATIVE_DOUBLE, lg_att_space[i], H5P_DEFAULT, H5P_DEFAULT); VRFY((lg_att_id[i] >= 0), "H5Acreate(2) failed.\n"); err = H5Awrite(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att); @@ -2199,21 +2195,21 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) lg_att[j] /= 10.0; } } - + /* Step 3: write large attributes to each dataset */ - /* + /* * flush the metadata cache yet again to clean the object headers. * * This is an attempt to crate a situation where we have dirty * object header continuation chunks, but clean opject headers * to verify a speculative bug fix -- it doesn't seem to work, - * but I will leave the code in anyway, as the object header + * but I will leave the code in anyway, as the object header * code is going to change a lot in the near future. */ if(verbose ) - HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name); err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((err >= 0), "H5Fflush(3) failed.\n"); @@ -2227,7 +2223,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) */ if(verbose ) - HDfprintf(stdout, "%0d:%s: writing different large attributes.\n", + HDfprintf(stdout, "%0d:%s: writing different large attributes.\n", mpi_rank, fcn_name); for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { @@ -2244,11 +2240,11 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* End of Step 4: write different large attributes to each dataset */ - /* + /* * flush the metadata cache again */ if(verbose ) - HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", + HDfprintf(stdout, "%0d:%s: flushing metadata cache.\n", mpi_rank, fcn_name); err = H5Fflush(file_id, H5F_SCOPE_GLOBAL); VRFY((err >= 0), "H5Fflush(3) failed.\n"); @@ -2260,11 +2256,11 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) /* Step 5: Close all objects and the file */ /* - * close large attribute IDs and spaces + * close large attribute IDs and spaces */ if(verbose ) - HDfprintf(stdout, "%0d:%s: closing large attr ids and spaces .\n", + HDfprintf(stdout, "%0d:%s: closing large attr ids and spaces .\n", mpi_rank, fcn_name); for ( i = 0; i < NUM_DATA_SETS; i++ ) { @@ -2276,7 +2272,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } - /* + /* * close the data sets */ @@ -2308,7 +2304,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) err = H5Fclose(file_id); VRFY((err >= 0 ), "H5Fclose(1) failed"); - + /* End of Step 5: Close all objects and the file */ /* Tell the reader to check the file up to steps. */ steps++; @@ -2359,15 +2355,15 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* private communicator size and rank */ int mpi_size; int mpi_rank; - int mrc; /* mpi error code */ - int steps = -1; /* How far (steps) to verify the file */ - int steps_done = -1; /* How far (steps) have been verified */ + int mrc; /* mpi error code */ + int steps = -1; /* How far (steps) to verify the file */ + int steps_done = -1; /* How far (steps) have been verified */ /* test bed related variables */ - const char * fcn_name = "rr_obj_hdr_flush_confusion_reader"; - const hbool_t verbose = FALSE; - const H5Ptest_param_t * pt; - char * filename; + const char * fcn_name = "rr_obj_hdr_flush_confusion_reader"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t * pt; + char * filename; /* * setup test bed related variables: @@ -2384,291 +2380,291 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* Repeatedly re-open the file and verify its contents until it is */ /* told to end (when steps=0). */ while (steps_done != 0){ - Reader_wait(mrc, steps); - VRFY((mrc >= 0), "Reader_wait failed"); - steps_done = 0; + Reader_wait(mrc, steps); + VRFY((mrc >= 0), "Reader_wait failed"); + steps_done = 0; - if (steps > 0 ){ - /* - * Set up file access property list with parallel I/O access - */ + if (steps > 0 ){ + /* + * Set up file access property list with parallel I/O access + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Setting up property list.\n", - mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up property list.\n", + mpi_rank, fcn_name); - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); - err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); - VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); + err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); + VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); - /* - * Create a new file collectively and release property list identifier. - */ + /* + * Create a new file collectively and release property list identifier. + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", - mpi_rank, fcn_name, filename); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", + mpi_rank, fcn_name, filename); - file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); - VRFY((file_id >= 0 ), "H5Fopen() failed"); - err = H5Pclose(fapl_id); - VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); + file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); + VRFY((file_id >= 0 ), "H5Fopen() failed"); + err = H5Pclose(fapl_id); + VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); #if 1 - if (steps >= 1){ - /*=====================================================* - * Step 1: open the data sets and read data. - *=====================================================*/ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: opening the datasets.\n", - mpi_rank, fcn_name); - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - dataset[i] = -1; - } - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT); - VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n"); - disk_space[i] = H5Dget_space(dataset[i]); - VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n"); - } - - /* - * setup data transfer property list - */ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); - - dxpl_id = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); - err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); - VRFY((err >= 0), - "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); - - /* - * read data from the data sets - */ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name); - - disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); - disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); - - mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); - - mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); - mem_start[0] = (hsize_t)(0); - - /* set up expected data for verification */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { - data[j] = (double)(mpi_rank + 1); - } - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, - NULL, disk_count, NULL); - VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); - mem_space[i] = H5Screate_simple(1, mem_size, NULL); - VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); - err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, - mem_start, NULL, mem_count, NULL); - VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); - err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], - disk_space[i], dxpl_id, data_read); - VRFY((err >= 0), "H5Dread(1) failed.\n"); - - /* compare read data with expected data */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (data_read[j] != data[j]){ - HDfprintf(stdout, - "%0d:%s: Reading datasets value failed in " - "Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, data[j], data_read[j]); - nerrors++; - } - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - data[j] *= 10.0; - } - - /* - * close the data spaces - */ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sclose(disk_space[i]); - VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); - err = H5Sclose(mem_space[i]); - VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); - } - steps_done++; - } - /* End of Step 1: open the data sets and read data. */ + if (steps >= 1){ + /*=====================================================* + * Step 1: open the data sets and read data. + *=====================================================*/ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: opening the datasets.\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = -1; + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT); + VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n"); + disk_space[i] = H5Dget_space(dataset[i]); + VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n"); + } + + /* + * setup data transfer property list + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); + + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); + err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); + VRFY((err >= 0), + "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); + + /* + * read data from the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name); + + disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); + + mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + + mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_start[0] = (hsize_t)(0); + + /* set up expected data for verification */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + data[j] = (double)(mpi_rank + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + NULL, disk_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); + mem_space[i] = H5Screate_simple(1, mem_size, NULL); + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + mem_start, NULL, mem_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); + err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + disk_space[i], dxpl_id, data_read); + VRFY((err >= 0), "H5Dread(1) failed.\n"); + + /* compare read data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (data_read[j] != data[j]){ + HDfprintf(stdout, + "%0d:%s: Reading datasets value failed in " + "Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, data[j], data_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + data[j] *= 10.0; + } + + /* + * close the data spaces + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sclose(disk_space[i]); + VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); + err = H5Sclose(mem_space[i]); + VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); + } + steps_done++; + } + /* End of Step 1: open the data sets and read data. */ #endif #if 1 - /*=====================================================* - * Step 2: reading attributes from each dataset - *=====================================================*/ - - if (steps >= 2){ - if(verbose ) - HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name); - - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { - - att[j] = (double)(j + 1); - } - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - hid_t att_id, att_type; - - att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT); - VRFY((att_id >= 0), "H5Aopen failed.\n"); - att_type = H5Aget_type(att_id); - VRFY((att_type >= 0), "H5Aget_type failed.\n"); - tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE); - VRFY((tri_err >= 0), "H5Tequal failed.\n"); - if (tri_err==0){ - HDfprintf(stdout, - "%0d:%s: Mismatched Attribute type of Dataset %d.\n", - mpi_rank, fcn_name, i); - nerrors++; - }else{ - /* should verify attribute size before H5Aread */ - err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read); - VRFY((err >= 0), "H5Aread failed.\n"); - /* compare read attribute data with expected data */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (att_read[j] != att[j]){ - HDfprintf(stdout, - "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, att[j], att_read[j]); - nerrors++; - } - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { - - att[j] /= 10.0; - } - } - err = H5Aclose(att_id); - VRFY((err >= 0), "H5Aclose failed.\n"); - } - steps_done++; - } - /* End of Step 2: reading attributes from each dataset */ + /*=====================================================* + * Step 2: reading attributes from each dataset + *=====================================================*/ + + if (steps >= 2){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name); + + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + + att[j] = (double)(j + 1); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + hid_t att_id, att_type; + + att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT); + VRFY((att_id >= 0), "H5Aopen failed.\n"); + att_type = H5Aget_type(att_id); + VRFY((att_type >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + }else{ + /* should verify attribute size before H5Aread */ + err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (att_read[j] != att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, att[j], att_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + + att[j] /= 10.0; + } + } + err = H5Aclose(att_id); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + steps_done++; + } + /* End of Step 2: reading attributes from each dataset */ #endif #if 1 - /*=====================================================* - * Step 3 or 4: read large attributes from each dataset. - * Step 4 has different attribute value from step 3. - *=====================================================*/ - - if (steps >= 3){ - if(verbose ) - HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name); - - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { - - lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2); - } - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT); - VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n"); - lg_att_type[i] = H5Aget_type(lg_att_id[i]); - VRFY((err >= 0), "H5Aget_type failed.\n"); - tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE); - VRFY((tri_err >= 0), "H5Tequal failed.\n"); - if (tri_err==0){ - HDfprintf(stdout, - "%0d:%s: Mismatched Large attribute type of Dataset %d.\n", - mpi_rank, fcn_name, i); - nerrors++; - }else{ - /* should verify large attribute size before H5Aread */ - err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read); - VRFY((err >= 0), "H5Aread failed.\n"); - /* compare read attribute data with expected data */ - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) - if (lg_att_read[j] != lg_att[j]){ - HDfprintf(stdout, - "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); - nerrors++; - } - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { - - lg_att[j] /= 10.0; - } - } - err = H5Tclose(lg_att_type[i]); - VRFY((err >= 0), "H5Tclose failed.\n"); - err = H5Aclose(lg_att_id[i]); - VRFY((err >= 0), "H5Aclose failed.\n"); - } - /* Both step 3 and 4 use this same read checking code. */ - steps_done = (steps==3) ? 3 : 4; - } - - /* End of Step 3 or 4: read large attributes from each dataset */ + /*=====================================================* + * Step 3 or 4: read large attributes from each dataset. + * Step 4 has different attribute value from step 3. + *=====================================================*/ + + if (steps >= 3){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name); + + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + + lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2); + } + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT); + VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n"); + lg_att_type[i] = H5Aget_type(lg_att_id[i]); + VRFY((err >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Large attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + }else{ + /* should verify large attribute size before H5Aread */ + err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) + if (lg_att_read[j] != lg_att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); + nerrors++; + } + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + + lg_att[j] /= 10.0; + } + } + err = H5Tclose(lg_att_type[i]); + VRFY((err >= 0), "H5Tclose failed.\n"); + err = H5Aclose(lg_att_id[i]); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + /* Both step 3 and 4 use this same read checking code. */ + steps_done = (steps==3) ? 3 : 4; + } + + /* End of Step 3 or 4: read large attributes from each dataset */ #endif - /*=====================================================* - * Step 5: read all objects from the file - *=====================================================*/ - if (steps>=5){ - /* nothing extra to verify. The file is closed normally. */ - /* Just increment steps_done */ - steps_done++; - } - - /* - * Close the data sets - */ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing datasets again.\n", - mpi_rank, fcn_name); - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - if ( dataset[i] >= 0 ) { - err = H5Dclose(dataset[i]); - VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); - } - } - - /* - * close the data transfer property list. - */ - - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); - - err = H5Pclose(dxpl_id); - VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); - - /* - * Close the file - */ - if(verbose) - HDfprintf(stdout, "%0d:%s: closing file again.\n", - mpi_rank, fcn_name); - err = H5Fclose(file_id); - VRFY((err >= 0 ), "H5Fclose(1) failed"); - - } /* else if (steps_done==0) */ - Reader_result(mrc, steps_done); + /*=====================================================* + * Step 5: read all objects from the file + *=====================================================*/ + if (steps>=5){ + /* nothing extra to verify. The file is closed normally. */ + /* Just increment steps_done */ + steps_done++; + } + + /* + * Close the data sets + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing datasets again.\n", + mpi_rank, fcn_name); + + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + if ( dataset[i] >= 0 ) { + err = H5Dclose(dataset[i]); + VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); + } + } + + /* + * close the data transfer property list. + */ + + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); + + err = H5Pclose(dxpl_id); + VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); + + /* + * Close the file + */ + if(verbose) + HDfprintf(stdout, "%0d:%s: closing file again.\n", + mpi_rank, fcn_name); + err = H5Fclose(file_id); + VRFY((err >= 0 ), "H5Fclose(1) failed"); + + } /* else if (steps_done==0) */ + Reader_result(mrc, steps_done); } /* end while(1) */ if(verbose ) diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 94ecbfa..890a918 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -53,7 +53,7 @@ static int test_mpio_overlap_writes(char *filename) { MPI_Status mpi_stat; if (VERBOSE_MED) - printf("MPIO independent overlapping writes test on file %s\n", + HDprintf("MPIO independent overlapping writes test on file %s\n", filename); nerrs = 0; @@ -64,8 +64,8 @@ static int test_mpio_overlap_writes(char *filename) { /* Need at least 2 processes */ if (mpi_size < 2) { if (MAINPROCESS) - printf("Need at least 2 processes to run MPIO test.\n"); - printf(" -SKIP- \n"); + HDprintf("Need at least 2 processes to run MPIO test.\n"); + HDprintf(" -SKIP- \n"); return 0; } @@ -138,13 +138,13 @@ static int test_mpio_overlap_writes(char *filename) { expected = (unsigned char) (mpi_off + i); if ((expected != buf[i]) && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { - printf( + HDprintf( "proc %d: found data error at [%ld], expect %u, got %u\n", mpi_rank, (long) (mpi_off + i), expected, buf[i]); } } if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); + HDprintf("proc %d: [more errors ...]\n", mpi_rank); nerrs += vrfyerrs; } @@ -204,7 +204,7 @@ static int test_mpio_gb_file(char *filename) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (VERBOSE_MED) - printf("MPI_Offset range test\n"); + HDprintf("MPI_Offset range test\n"); /* figure out the signness and sizeof MPI_Offset */ mpi_off = 0; @@ -216,10 +216,10 @@ static int test_mpio_gb_file(char *filename) { * sizes. */ if (MAINPROCESS) { /* only process 0 needs to check it*/ - printf("MPI_Offset is %s %d bytes integeral type\n", + HDprintf("MPI_Offset is %s %d bytes integeral type\n", is_signed ? "signed" : "unsigned", (int) sizeof(MPI_Offset)); if (sizeof_mpi_offset <= 4 && is_signed) { - printf("Skipped 2GB range test " + HDprintf("Skipped 2GB range test " "because MPI_Offset cannot support it\n"); } else { /* verify correctness of assigning 2GB sizes */ @@ -241,7 +241,7 @@ static int test_mpio_gb_file(char *filename) { } if (sizeof_mpi_offset <= 4) { - printf("Skipped 4GB range test " + HDprintf("Skipped 4GB range test " "because MPI_Offset cannot support it\n"); } else { /* verify correctness of assigning 4GB sizes */ @@ -267,10 +267,10 @@ static int test_mpio_gb_file(char *filename) { * Verify if we can write to a file of multiple GB sizes. */ if (VERBOSE_MED) - printf("MPIO GB file test %s\n", filename); + HDprintf("MPIO GB file test %s\n", filename); if (sizeof_mpi_offset <= 4) { - printf("Skipped GB file range test " + HDprintf("Skipped GB file range test " "because MPI_Offset cannot support it\n"); } else { buf = (char *) HDmalloc(MB); @@ -286,7 +286,7 @@ static int test_mpio_gb_file(char *filename) { MPI_MODE_CREATE | MPI_MODE_RDWR, info, &fh); VRFY((mrc == MPI_SUCCESS), "MPI_FILE_OPEN"); - printf("MPIO GB file write test %s\n", filename); + HDprintf("MPIO GB file write test %s\n", filename); /* instead of writing every bytes of the file, we will just write * some data around the 2 and 4 GB boundaries. That should cover @@ -328,9 +328,9 @@ static int test_mpio_gb_file(char *filename) { */ /* open it again to verify the data written */ /* but only if there was no write errors */ - printf("MPIO GB file read test %s\n", filename); + HDprintf("MPIO GB file read test %s\n", filename); if (errors_sum(writerrs) > 0) { - printf("proc %d: Skip read test due to previous write errors\n", + HDprintf("proc %d: Skip read test due to previous write errors\n", mpi_rank); goto finish; } @@ -356,14 +356,14 @@ static int test_mpio_gb_file(char *filename) { for (j = 0; j < MB; j++) { if ((*(buf + j) != expected) && (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED)) { - printf( + HDprintf( "proc %d: found data error at [%ld+%d], expect %d, got %d\n", mpi_rank, (long) mpi_off, j, expected, *(buf + j)); } } if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) - printf("proc %d: [more errors ...]\n", mpi_rank); + HDprintf("proc %d: [more errors ...]\n", mpi_rank); nerrs += vrfyerrs; } @@ -380,7 +380,7 @@ static int test_mpio_gb_file(char *filename) { mrc = MPI_Barrier(MPI_COMM_WORLD); VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); - printf("Test if MPI_File_get_size works correctly with %s\n", filename); + HDprintf("Test if MPI_File_get_size works correctly with %s\n", filename); mrc = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, info, &fh); @@ -428,7 +428,7 @@ static int test_mpio_gb_file(char *filename) { */ #define DIMSIZE 32 /* Dimension size. */ -#define PRINTID printf("Proc %d: ", mpi_rank) +#define PRINTID HDprintf("Proc %d: ", mpi_rank) #define USENONE 0 #define USEATOM 1 /* request atomic I/O */ #define USEFSYNC 2 /* request file_sync */ @@ -452,24 +452,24 @@ static int test_mpio_1wMr(char *filename, int special_request) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if (MAINPROCESS && VERBOSE_MED) { - printf("Testing one process writes, all processes read.\n"); - printf("Using %d processes accessing file %s\n", mpi_size, filename); - printf(" (Filename can be specified via program argument)\n"); + HDprintf("Testing one process writes, all processes read.\n"); + HDprintf("Using %d processes accessing file %s\n", mpi_size, filename); + HDprintf(" (Filename can be specified via program argument)\n"); } /* show the hostname so that we can tell where the processes are running */ if (VERBOSE_DEF) { #ifdef H5_HAVE_GETHOSTNAME if(HDgethostname(hostname, sizeof(hostname)) < 0) { - printf("gethostname failed\n"); + HDprintf("gethostname failed\n"); hostname[0] = '\0'; } #else - printf("gethostname unavailable\n"); + HDprintf("gethostname unavailable\n"); hostname[0] = '\0'; #endif PRINTID; - printf("hostname=%s\n", hostname); + HDprintf("hostname=%s\n", hostname); } /* Delete any old file in order to start anew. */ @@ -483,7 +483,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_open failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } @@ -495,29 +495,29 @@ static int test_mpio_1wMr(char *filename, int special_request) { if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("Initial atomicity = %d\n", atomicity); + HDprintf("Initial atomicity = %d\n", atomicity); if ((mpi_err = MPI_File_set_atomicity(fh, 1)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_set_atomicity failed (%s)\n", mpi_err_str); } if ((mpi_err = MPI_File_get_atomicity(fh, &atomicity)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_get_atomicity failed (%s)\n", mpi_err_str); } if (VERBOSE_HI) - printf("After set_atomicity atomicity = %d\n", atomicity); + HDprintf("After set_atomicity atomicity = %d\n", atomicity); } /* This barrier is not necessary but do it anyway. */ MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI) { PRINTID; - printf("between MPI_Barrier and MPI_File_write_at\n"); + HDprintf("between MPI_Barrier and MPI_File_write_at\n"); } /* ================================================== @@ -533,13 +533,13 @@ static int test_mpio_1wMr(char *filename, int special_request) { if (mpi_rank == irank) { if (VERBOSE_HI) { PRINTID; - printf("wrote %d bytes at %ld\n", DIMSIZE, (long) mpi_off); + HDprintf("wrote %d bytes at %ld\n", DIMSIZE, (long) mpi_off); } if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, MPI_BYTE, &mpi_stat)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + HDprintf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", (long) mpi_off, DIMSIZE, mpi_err_str); return 1; }; @@ -550,7 +550,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { MPI_Bcast(&mpi_err, 1, MPI_INT, irank, MPI_COMM_WORLD); if (VERBOSE_HI) { PRINTID; - printf("MPI_Bcast: mpi_err = %d\n", mpi_err); + HDprintf("MPI_Bcast: mpi_err = %d\n", mpi_err); } if (special_request & USEFSYNC) { @@ -559,19 +559,19 @@ static int test_mpio_1wMr(char *filename, int special_request) { * should not need this. * ==================================================*/ if (VERBOSE_HI) - printf("Apply MPI_File_sync\n"); + HDprintf("Apply MPI_File_sync\n"); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_sync failed (%s)\n", mpi_err_str); } MPI_Barrier(MPI_COMM_WORLD); /* call file_sync to force the write out */ if ((mpi_err = MPI_File_sync(fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_sync failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_sync failed (%s)\n", mpi_err_str); } } @@ -580,7 +580,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { MPI_Barrier(MPI_COMM_WORLD); if (VERBOSE_HI) { PRINTID; - printf("after MPI_Barrier\n"); + HDprintf("after MPI_Barrier\n"); } /* ================================================== @@ -592,7 +592,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { &mpi_stat)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); PRINTID; - printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + HDprintf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", (long) mpi_off, DIMSIZE, mpi_err_str); return 1; }; @@ -600,7 +600,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { expect_val = irank * DIMSIZE + i; if (readdata[i] != expect_val) { PRINTID; - printf("read data[%d:%d] got %02x, expect %02x\n", irank, i, + HDprintf("read data[%d:%d] got %02x, expect %02x\n", irank, i, readdata[i], expect_val); nerrs++; } @@ -610,7 +610,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { if (VERBOSE_HI) { PRINTID; - printf("%d data errors detected\n", nerrs); + HDprintf("%d data errors detected\n", nerrs); } mpi_err = MPI_Barrier(MPI_COMM_WORLD); @@ -664,7 +664,7 @@ static int test_mpio_1wMr(char *filename, int special_request) { 2. This test will verify whether the complicated derived datatype is working on the current platform. - If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + If this bug has been fixed in the previous not-working package, this test will issue a HDprintf message to tell the developer to change the configuration specific file of HDF5 so that we can change our configurationsetting to support collective IO for irregular selections. If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that @@ -703,7 +703,7 @@ static int test_mpio_derived_dtype(char *filename) { MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } @@ -717,13 +717,13 @@ static int test_mpio_derived_dtype(char *filename) { if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, &filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } @@ -733,13 +733,13 @@ static int test_mpio_derived_dtype(char *filename) { if ((mpi_err = MPI_Type_create_hindexed(count, blocklens, offsets, MPI_BYTE, &filetypenew)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_Type_commit(&filetypenew)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } @@ -754,52 +754,52 @@ static int test_mpio_derived_dtype(char *filename) { if ((mpi_err = MPI_Type_create_struct(outcount, adv_blocklens, adv_disp, bas_filetype, &adv_filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_create_struct failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_Type_commit(&adv_filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_set_view(fh, disp, etype, adv_filetype, "native", MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_write(fh, buf, 3, MPI_BYTE, &Status)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_write failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_close failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_RDONLY, MPI_INFO_NULL, &fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_set_view(fh, 0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str); return 1; } if ((mpi_err = MPI_File_read(fh, outbuf, 3, MPI_BYTE, &Status)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_read failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_read failed (%s)\n", mpi_err_str); return 1; } @@ -807,9 +807,9 @@ static int test_mpio_derived_dtype(char *filename) { retcode = 0; } else { /* if(mpi_rank == 0) { - printf("complicated derived datatype is NOT working at this platform\n"); - printf("go back to hdf5/config and find the corresponding\n"); - printf("configure-specific file and change ?????\n"); + HDprintf("complicated derived datatype is NOT working at this platform\n"); + HDprintf("go back to hdf5/config and find the corresponding\n"); + HDprintf("configure-specific file and change ?????\n"); } */ retcode = -1; @@ -817,16 +817,16 @@ static int test_mpio_derived_dtype(char *filename) { if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_close failed (%s)\n", mpi_err_str); return 1; } mpi_err = MPI_Barrier(MPI_COMM_WORLD); if (retcode == -1) { if (mpi_rank == 0) { - printf( + HDprintf( "Complicated derived datatype is NOT working at this platform\n"); - printf(" Please report to help@hdfgroup.org about this problem.\n"); + HDprintf(" Please report to help@hdfgroup.org about this problem.\n"); } retcode = 1; } @@ -851,7 +851,7 @@ static int test_mpio_derived_dtype(char *filename) { 2. This test will fail with the MPI-IO package that doesn't support this. For example, mpich 1.2.6. - If this bug has been fixed in the previous not-working package, this test will issue a printf message to tell the developer to change + If this bug has been fixed in the previous not-working package, this test will issue a HDprintf message to tell the developer to change the configuration specific file of HDF5 so that we can change our configurationsetting to support special collective IO; currently only special collective IO. If it turns out that the previous working MPI-IO package no longer works, this test will also issue a message to inform the corresponding failure so that @@ -898,26 +898,26 @@ static int test_mpio_special_collective(char *filename) { if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, &filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ if ((mpi_err = MPI_Type_commit(&filetype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } /* end if */ if ((mpi_err = MPI_Type_create_hindexed(2, blocklens, offsets, etype, &buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_contiguous failed (%s)\n", mpi_err_str); return 1; } /* end if */ if ((mpi_err = MPI_Type_commit(&buftype)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_Type_commit failed (%s)\n", mpi_err_str); + HDprintf("MPI_Type_commit failed (%s)\n", mpi_err_str); return 1; } /* end if */ } /* end if */ @@ -931,7 +931,7 @@ static int test_mpio_special_collective(char *filename) { MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_open failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_open failed (%s)\n", mpi_err_str); return 1; } /* end if */ @@ -943,7 +943,7 @@ static int test_mpio_special_collective(char *filename) { if ((mpi_err = MPI_File_set_view(fh, mpi_off, MPI_BYTE, filetype, filerep, MPI_INFO_NULL)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_set_view failed (%s)\n", mpi_err_str); + HDprintf("MPI_File_set_view failed (%s)\n", mpi_err_str); return 1; } /* end if */ @@ -951,7 +951,7 @@ static int test_mpio_special_collective(char *filename) { if ((mpi_err = MPI_File_write_at_all(fh, mpi_off, writedata, bufcount, buftype, &mpi_stat)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + HDprintf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", (long) mpi_off, bufcount, mpi_err_str); return 1; } /* end if */ @@ -959,7 +959,7 @@ static int test_mpio_special_collective(char *filename) { /* Close the file */ if ((mpi_err = MPI_File_close(&fh)) != MPI_SUCCESS) { MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); - printf("MPI_File_close failed. \n"); + HDprintf("MPI_File_close failed. \n"); return 1; } /* end if */ @@ -967,8 +967,8 @@ static int test_mpio_special_collective(char *filename) { mpi_err = MPI_Barrier(MPI_COMM_WORLD); if (retcode != 0) { if (mpi_rank == 0) { - printf("special collective IO is NOT working at this platform\n"); - printf(" Please report to help@hdfgroup.org about this problem.\n"); + HDprintf("special collective IO is NOT working at this platform\n"); + HDprintf(" Please report to help@hdfgroup.org about this problem.\n"); } /* end if */ retcode = 1; } /* end if */ @@ -1024,15 +1024,15 @@ static int parse_options(int argc, char **argv) { for (i = 0; i < n; i++) if (h5_fixname(FILENAME[i], plist, filenames[i], sizeof(filenames[i])) == NULL) { - printf("h5_fixname failed\n"); + HDprintf("h5_fixname failed\n"); nerrors++; return (1); } H5Pclose(plist); if (VERBOSE_MED) { - printf("Test filenames are:\n"); + HDprintf("Test filenames are:\n"); for (i = 0; i < n; i++) - printf(" %s\n", filenames[i]); + HDprintf(" %s\n", filenames[i]); } } @@ -1043,10 +1043,10 @@ static int parse_options(int argc, char **argv) { * Show command usage */ static void usage(void) { - printf("Usage: t_mpi [-v] [-f ]\n"); - printf("\t-v\tset verbose level (0-9,l,m,h)\n"); - printf("\t-f \tfilename prefix\n"); - printf("\n"); + HDprintf("Usage: t_mpi [-v] [-f ]\n"); + HDprintf("\t-v\tset verbose level (0-9,l,m,h)\n"); + HDprintf("\t-f \tfilename prefix\n"); + HDprintf("\n"); } /* @@ -1072,7 +1072,7 @@ int main(int argc, char **argv) { * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0) { - printf("Failed to turn off atexit processing. Continue.\n"); + HDprintf("Failed to turn off atexit processing. Continue.\n"); }; H5open(); if (parse_options(argc, argv) != 0) { @@ -1082,9 +1082,9 @@ int main(int argc, char **argv) { } if (MAINPROCESS) { - printf("===================================\n"); - printf("MPI functionality tests\n"); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("MPI functionality tests\n"); + HDprintf("===================================\n"); } if (VERBOSE_MED) @@ -1103,7 +1103,7 @@ int main(int argc, char **argv) { ret_code = test_mpio_1wMr(filenames[0], USENONE); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } @@ -1114,7 +1114,7 @@ int main(int argc, char **argv) { ret_code = test_mpio_1wMr(filenames[0], USEATOM); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } @@ -1122,7 +1122,7 @@ int main(int argc, char **argv) { ret_code = test_mpio_1wMr(filenames[0], USEFSYNC); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } } @@ -1135,12 +1135,12 @@ int main(int argc, char **argv) { ret_code = test_mpio_gb_file(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } #else if (mpi_rank==0) - printf(" will be skipped on Windows (JIRA HDDFV-8064)\n"); + HDprintf(" will be skipped on Windows (JIRA HDDFV-8064)\n"); #endif /*======================================= @@ -1150,7 +1150,7 @@ int main(int argc, char **argv) { ret_code = test_mpio_overlap_writes(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } @@ -1161,7 +1161,7 @@ int main(int argc, char **argv) { ret_code = test_mpio_derived_dtype(filenames[0]); ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } @@ -1171,7 +1171,7 @@ int main(int argc, char **argv) { if (mpi_size < 4) { MPI_BANNER("MPIO special collective io test SKIPPED."); if (mpi_rank == 0) - printf("This test needs at least four processes to run.\n"); + HDprintf("This test needs at least four processes to run.\n"); ret_code = 0; goto sc_finish; } /* end if */ @@ -1181,7 +1181,7 @@ int main(int argc, char **argv) { sc_finish: ret_code = errors_sum(ret_code); if (mpi_rank == 0 && ret_code > 0) { - printf("***FAILED with %d total errors\n", ret_code); + HDprintf("***FAILED with %d total errors\n", ret_code); nerrors += ret_code; } @@ -1191,14 +1191,14 @@ int main(int argc, char **argv) { */ MPI_Barrier(MPI_COMM_WORLD); if (MAINPROCESS) { /* only process 0 reports */ - printf("===================================\n"); + HDprintf("===================================\n"); if (nerrors) { - printf("***MPI tests detected %d errors***\n", nerrors); + HDprintf("***MPI tests detected %d errors***\n", nerrors); } else { - printf("MPI tests finished with no errors\n"); + HDprintf("MPI tests finished with no errors\n"); } - printf("===================================\n"); + HDprintf("===================================\n"); } /* turn off alarm */ diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index 574591c..8e554ee 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -50,13 +50,13 @@ test_fapl_mpio_dup(void) int nkeys, nkeys_tmp; if (VERBOSE_MED) - printf("Verify fapl_mpio duplicates communicator and INFO objects\n"); + HDprintf("Verify fapl_mpio duplicates communicator and INFO objects\n"); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); if (VERBOSE_MED) - printf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); + HDprintf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); /* Create a new communicator that has the same processes as MPI_COMM_WORLD. * Use MPI_Comm_split because it is simplier than MPI_Comm_create @@ -66,7 +66,7 @@ test_fapl_mpio_dup(void) MPI_Comm_size(comm,&mpi_size_old); MPI_Comm_rank(comm,&mpi_rank_old); if (VERBOSE_MED) - printf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); + HDprintf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); /* create a new INFO object with some trivial information. */ mrc = MPI_Info_create(&info); @@ -103,7 +103,7 @@ test_fapl_mpio_dup(void) MPI_Comm_size(comm_tmp,&mpi_size_tmp); MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); if (VERBOSE_MED) - printf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", + HDprintf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp); VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); @@ -151,7 +151,7 @@ test_fapl_mpio_dup(void) MPI_Comm_size(comm_tmp,&mpi_size_tmp); MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); if (VERBOSE_MED) - printf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", + HDprintf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp); VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); @@ -171,7 +171,7 @@ test_fapl_mpio_dup(void) MPI_Comm_size(comm_tmp,&mpi_size_tmp); MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); if (VERBOSE_MED) - printf("After Property list closed: rank/size of comm are %d/%d\n", + HDprintf("After Property list closed: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp); if (MPI_INFO_NULL != info_tmp){ mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index 719d150..d75e627 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -107,7 +107,7 @@ main (int argc, char **argv) for (i=0; i < block[0]; i++){ for (j=0; j < block[1]; j++){ if(*dataptr != mpi_rank+1) { - printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", + HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", (unsigned long)i, (unsigned long)j, (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), mpi_rank+1, *(dataptr)); diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 2eb3914..fd89c6a 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -141,7 +141,7 @@ test_plist_ed(void) herr_t ret; /* Generic return value */ if(VERBOSE_MED) - printf("Encode/Decode DCPLs\n"); + HDprintf("Encode/Decode DCPLs\n"); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index b65e219..abbfbb3 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4656,10 +4656,10 @@ void pause_proc(void) if (MAINPROCESS) while ((HDstat(greenlight, &statbuf) == -1) && loops < maxloop){ if (!loops++){ - printf("Proc %d (%*s, %d): to debug, attach %d\n", + HDprintf("Proc %d (%*s, %d): to debug, attach %d\n", mpi_rank, mpi_namelen, mpi_name, pid, pid); } - printf("waiting(%ds) for file %s ...\n", time_int, greenlight); + HDprintf("waiting(%ds) for file %s ...\n", time_int, greenlight); fflush(stdout); HDsleep(time_int); } @@ -4683,18 +4683,18 @@ int MPI_Init(int *argc, char ***argv) static void usage(void) { - printf(" [-r] [-w] [-m] [-n] " + HDprintf(" [-r] [-w] [-m] [-n] " "[-o] [-f ] [-d ]\n"); - printf("\t-m" + HDprintf("\t-m" "\tset number of datasets for the multiple dataset test\n"); - printf("\t-n" + HDprintf("\t-n" "\tset number of groups for the multiple group test\n"); - printf("\t-f \tfilename prefix\n"); - printf("\t-2\t\tuse Split-file together with MPIO\n"); - printf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", + HDprintf("\t-f \tfilename prefix\n"); + HDprintf("\t-2\t\tuse Split-file together with MPIO\n"); + HDprintf("\t-d \tdataset dimensions factors. Defaults (%d,%d)\n", ROW_FACTOR, COL_FACTOR); - printf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); - printf("\n"); + HDprintf("\t-c \tdataset chunk dimensions. Defaults (dim0/10,dim1/10)\n"); + HDprintf("\n"); } @@ -4772,7 +4772,7 @@ parse_options(int argc, char **argv) break; case 'h': /* print help message--return with nerrors set */ return(1); - default: printf("Illegal option(%s)\n", *argv); + default: HDprintf("Illegal option(%s)\n", *argv); nerrors++; return(1); } @@ -4781,12 +4781,12 @@ parse_options(int argc, char **argv) /* check validity of dimension and chunk sizes */ if (dim0 <= 0 || dim1 <= 0){ - printf("Illegal dim sizes (%d, %d)\n", dim0, dim1); + HDprintf("Illegal dim sizes (%d, %d)\n", dim0, dim1); nerrors++; return(1); } if (chunkdim0 <= 0 || chunkdim1 <= 0){ - printf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); + HDprintf("Illegal chunkdim sizes (%d, %d)\n", chunkdim0, chunkdim1); nerrors++; return(1); } @@ -4794,7 +4794,7 @@ parse_options(int argc, char **argv) /* Make sure datasets can be divided into equal portions by the processes */ if ((dim0 % mpi_size) || (dim1 % mpi_size)){ if (MAINPROCESS) - printf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", + HDprintf("dim0(%d) and dim1(%d) must be multiples of processes(%d)\n", dim0, dim1, mpi_size); nerrors++; return(1); @@ -4809,13 +4809,13 @@ parse_options(int argc, char **argv) for (i=0; i < n; i++) if (h5_fixname(FILENAME[i],fapl,filenames[i],sizeof(filenames[i])) == NULL){ - printf("h5_fixname failed\n"); + HDprintf("h5_fixname failed\n"); nerrors++; return(1); } - printf("Test filenames are:\n"); + HDprintf("Test filenames are:\n"); for (i=0; i < n; i++) - printf(" %s\n", filenames[i]); + HDprintf(" %s\n", filenames[i]); } return(0); @@ -4952,10 +4952,10 @@ int main(int argc, char **argv) dim1 = COL_FACTOR*mpi_size; if (MAINPROCESS){ - printf("===================================\n"); - printf("Shape Same Tests Start\n"); - printf(" express_test = %d.\n", GetTestExpress()); - printf("===================================\n"); + HDprintf("===================================\n"); + HDprintf("Shape Same Tests Start\n"); + HDprintf(" express_test = %d.\n", GetTestExpress()); + HDprintf("===================================\n"); } /* Attempt to turn off atexit post processing so that in case errors @@ -4964,7 +4964,7 @@ int main(int argc, char **argv) * calls. By then, MPI calls may not work. */ if (H5dont_atexit() < 0){ - printf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank); + HDprintf("%d: Failed to turn off atexit processing. Continue.\n", mpi_rank); }; H5open(); h5_show_hostname(); @@ -5003,7 +5003,7 @@ int main(int argc, char **argv) TestParseCmdLine(argc, argv); if (dxfer_coll_type == DXFER_INDEPENDENT_IO && MAINPROCESS){ - printf("===================================\n" + HDprintf("===================================\n" " Using Independent I/O with file set view to replace collective I/O \n" "===================================\n"); } @@ -5034,12 +5034,12 @@ int main(int argc, char **argv) } if (MAINPROCESS){ /* only process 0 reports */ - printf("===================================\n"); + HDprintf("===================================\n"); if (nerrors) - printf("***Shape Same tests detected %d errors***\n", nerrors); + HDprintf("***Shape Same tests detected %d errors***\n", nerrors); else - printf("Shape Same tests finished with no errors\n"); - printf("===================================\n"); + HDprintf("Shape Same tests finished with no errors\n"); + HDprintf("===================================\n"); } /* close HDF5 library */ diff --git a/testpar/testpar.h b/testpar/testpar.h index 84c073f..4fbe8d8 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -32,7 +32,7 @@ */ #define MESG(mesg) \ if (VERBOSE_MED && *mesg != '\0') \ - printf("%s\n", mesg) + HDprintf("%s\n", mesg) /* * VRFY: Verify if the condition val is true. @@ -48,14 +48,14 @@ if (val) { \ MESG(mesg); \ } else { \ - printf("Proc %d: ", mpi_rank); \ - printf("*** Parallel ERROR ***\n"); \ - printf(" VRFY (%s) failed at line %4d in %s\n", \ + HDprintf("Proc %d: ", mpi_rank); \ + HDprintf("*** Parallel ERROR ***\n"); \ + HDprintf(" VRFY (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ ++nerrors; \ fflush(stdout); \ if (!VERBOSE_MED) { \ - printf("aborting MPI processes\n"); \ + HDprintf("aborting MPI processes\n"); \ MPI_Abort(MPI_COMM_WORLD, 1); \ } \ } \ @@ -70,9 +70,9 @@ if (val) { \ MESG(mesg); \ } else { \ - printf("Proc %d: ", mpi_rank); \ - printf("*** PHDF5 REMARK (not an error) ***\n"); \ - printf(" Condition (%s) failed at line %4d in %s\n", \ + HDprintf("Proc %d: ", mpi_rank); \ + HDprintf("*** PHDF5 REMARK (not an error) ***\n"); \ + HDprintf(" Condition (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ fflush(stdout); \ } \ @@ -80,10 +80,10 @@ #define MPI_BANNER(mesg) do { \ if (VERBOSE_MED || MAINPROCESS){ \ - printf("--------------------------------\n"); \ - printf("Proc %d: ", mpi_rank); \ - printf("*** %s\n", mesg); \ - printf("--------------------------------\n"); \ + HDprintf("--------------------------------\n"); \ + HDprintf("Proc %d: ", mpi_rank); \ + HDprintf("*** %s\n", mesg); \ + HDprintf("--------------------------------\n"); \ } \ } while(0) diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 9fece12..cf611b7 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -19,7 +19,7 @@ #include "testpar.h" enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, - API_MULTI_HARD,API_LINK_TRUE,API_LINK_FALSE, + API_MULTI_HARD,API_LINK_TRUE,API_LINK_FALSE, API_MULTI_COLL,API_MULTI_IND}; #ifndef FALSE @@ -32,20 +32,20 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, /* Constants definitions */ -#define DIM0 600 /* Default dataset sizes. */ -#define DIM1 1200 /* Values are from a monitor pixel sizes */ -#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ -#define COL_FACTOR 16 /* Nominal column factor for dataset size */ -#define RANK 2 -#define DATASETNAME1 "Data1" -#define DATASETNAME2 "Data2" -#define DATASETNAME3 "Data3" -#define DATASETNAME4 "Data4" -#define DATASETNAME5 "Data5" -#define DATASETNAME6 "Data6" -#define DATASETNAME7 "Data7" -#define DATASETNAME8 "Data8" -#define DATASETNAME9 "Data9" +#define DIM0 600 /* Default dataset sizes. */ +#define DIM1 1200 /* Values are from a monitor pixel sizes */ +#define ROW_FACTOR 8 /* Nominal row factor for dataset size */ +#define COL_FACTOR 16 /* Nominal column factor for dataset size */ +#define RANK 2 +#define DATASETNAME1 "Data1" +#define DATASETNAME2 "Data2" +#define DATASETNAME3 "Data3" +#define DATASETNAME4 "Data4" +#define DATASETNAME5 "Data5" +#define DATASETNAME6 "Data6" +#define DATASETNAME7 "Data7" +#define DATASETNAME8 "Data8" +#define DATASETNAME9 "Data9" /* point selection order */ #define IN_ORDER 1 @@ -179,14 +179,14 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, /* Definitions of the selection mode for the no_collective_cause_tests function. */ #define TEST_COLLECTIVE 0x001 -#define TEST_SET_INDEPENDENT 0x002 +#define TEST_SET_INDEPENDENT 0x002 #define TEST_DATATYPE_CONVERSION 0x004 #define TEST_DATA_TRANSFORMS 0x008 #define TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES 0x010 #define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x020 #define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x040 #define TEST_FILTERS 0x080 -/* TEST_FILTERS will take place of this after supporting mpio + filter for +/* TEST_FILTERS will take place of this after supporting mpio + filter for * H5Dcreate and H5Dwrite */ #define TEST_FILTERS_READ 0x100 @@ -209,8 +209,8 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, /* type definitions */ typedef struct H5Ptest_param_t /* holds extra test parameters */ { - char *name; - int count; + char *name; + int count; } H5Ptest_param_t; /* Dataset data type. Int's can be easily octo dumped. */ @@ -218,19 +218,19 @@ typedef int DATATYPE; /* Shape Same Tests Definitions */ typedef enum { - IND_CONTIG, /* Independent IO on contigous datasets */ - COL_CONTIG, /* Collective IO on contigous datasets */ - IND_CHUNKED, /* Independent IO on chunked datasets */ - COL_CHUNKED /* Collective IO on chunked datasets */ + IND_CONTIG, /* Independent IO on contigous datasets */ + COL_CONTIG, /* Collective IO on contigous datasets */ + IND_CHUNKED, /* Independent IO on chunked datasets */ + COL_CHUNKED /* Collective IO on chunked datasets */ } ShapeSameTestMethods; /* Shared global variables */ -extern int dim0, dim1; /*Dataset dimensions */ -extern int chunkdim0, chunkdim1; /*Chunk dimensions */ -extern int nerrors; /*errors count */ -extern H5E_auto2_t old_func; /* previous error handler */ -extern void *old_client_data; /*previous error handler arg.*/ -extern int facc_type; /*Test file access type */ +extern int dim0, dim1; /*Dataset dimensions */ +extern int chunkdim0, chunkdim1; /*Chunk dimensions */ +extern int nerrors; /*errors count */ +extern H5E_auto2_t old_func; /* previous error handler */ +extern void *old_client_data; /*previous error handler arg.*/ +extern int facc_type; /*Test file access type */ extern int dxfer_coll_type; /* Test program prototypes */ diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 16c0d8c..1eef5ab 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -3753,7 +3753,7 @@ void setDefaultValues(struct Input *in, int count) in->path.count = 1; HDstrcpy(temp, "dataset"); - sprintf(num, "%d", count); + HDsprintf(num, "%d", count); HDstrcat(temp, num); HDstrcpy(in->path.group[0], temp); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 057cbbd..ec8df3c 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -4120,7 +4120,7 @@ int write_dset_in(hid_t loc_id, dbuf = (double*)HDmalloc( size ); if (NULL == dbuf) { - printf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); + HDprintf ("\nError: Cannot allocate memory for \"arrayd\" data buffer size %dMB.\n", (int) size / 1000000 ); goto out; } diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c index 3784278..f50e5fb 100644 --- a/tools/test/misc/h5perf_gentest.c +++ b/tools/test/misc/h5perf_gentest.c @@ -10,8 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** - This test generates attributes, groups, and datasets of many types. It - creates a large number of attributes, groups, and datasets by specifying + This test generates attributes, groups, and datasets of many types. It + creates a large number of attributes, groups, and datasets by specifying -a, -g, -d options respectively. Using "-h" option to see details. Programmer: Peter Cao , Jan. 2013 @@ -31,7 +31,7 @@ #define MAXVLEN 10 #define FIXED_LEN 8 -typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; +typedef enum { SOLID=0, LIQUID, GAS, PLASMA } phase_t; typedef struct { int i; @@ -43,24 +43,24 @@ typedef struct { float f_array[FIXED_LEN]; hvl_t i_vlen; char *s_vlen; -} test_comp_t; +} test_comp_t; typedef struct { int zipcode; char *city; -} zipcode_t; +} zipcode_t; int add_attrs(hid_t oid, int idx); int add_attr(hid_t oid, const char *name, hid_t tid, hid_t sid, void *buf) ; -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest); +herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, + int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, + int compressed, int latest); int main (int argc, char *argv[]) { char fname[32]; - int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, - chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; + int i, ngrps=NGROUPS, ndsets=NDSETS, nattrs=NATTRS, dim0=DIM0, + chunk=DIM0/10+1, nrows=NROWS, vlen=MAXVLEN, l=0, z=0; memset(fname, 0, 32); for (i=1; i, Jan. 2013 ****************************************************************************/ -herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, - int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, - int compressed, int latest) +herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, + int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen, + int compressed, int latest) { int i, j, k; - hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, - fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, - tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; + hid_t fid, sid_null, sid_scalar, sid_1d, sid_2d, did, aid, sid_2, sid_large, + fapl=H5P_DEFAULT, dcpl=H5P_DEFAULT, gid1, gid2, cmp_tid, tid_str, + tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s; char name[32], tmp_name1[32], tmp_name2[32], tmp_name3[32]; - hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, - dim1[1]={2}; + hsize_t dims[1]={dim0}, dims2d[2]={dim0, (dim0/4+1)}, dims_array[1]={FIXED_LEN}, + dim1[1]={2}; char *enum_names[4] = {"SOLID", "LIQUID", "GAS", "PLASMA"}; test_comp_t *buf_comp=NULL, *buf_comp_large=NULL; int *buf_int=NULL; float (*buf_float_a)[FIXED_LEN]=NULL; double **buf_double2d=NULL; hvl_t *buf_vlen_i=NULL; - char (*buf_str)[FIXED_LEN]; - char **buf_vlen_s=NULL; - hobj_ref_t buf_ref[2]; - hdset_reg_ref_t buf_reg_ref[2]; + char (*buf_str)[FIXED_LEN]; + char **buf_vlen_s=NULL; + hobj_ref_t buf_ref[2]; + hdset_reg_ref_t buf_reg_ref[2]; size_t offset, len; herr_t status; - char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", - "enum", "fixed float array", "vlen int array", "vlen strings"}; - hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, + char *names[NTYPES] = { "int", "ulong", "float", "double", "fixed string", + "enum", "fixed float array", "vlen int array", "vlen strings"}; + hid_t types[NTYPES] = { H5T_NATIVE_INT, H5T_NATIVE_UINT64, H5T_NATIVE_FLOAT, H5T_NATIVE_DOUBLE, tid_str, tid_enum, tid_array_f, tid_vlen_i, tid_vlen_s}; - hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; - - if (nrows < NROWS) nrows = NROWS; + hsize_t coords[4][2] = { {0, 1}, {3, 5}, {1, 0}, {2, 4}}, start=0, stride=1, count=1; + + if (nrows < NROWS) nrows = NROWS; if (ngrpsdim0) chunk=dim0/4; if (chunk<1) chunk = 1; - if (vlen<1) vlen = MAXVLEN; + if (vlen<1) vlen = MAXVLEN; - /* create fixed string datatype */ + /* create fixed string datatype */ types[4] = tid_str = H5Tcopy (H5T_C_S1); H5Tset_size (tid_str, FIXED_LEN); @@ -181,15 +181,15 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, /* create float array datatype */ types[6] = tid_array_f = H5Tarray_create (H5T_NATIVE_FLOAT, 1, dims_array); - + /* create variable length integer datatypes */ types[7] = tid_vlen_i = H5Tvlen_create (H5T_NATIVE_INT); - + /* create variable length string datatype */ types[8] = tid_vlen_s = H5Tcopy (H5T_C_S1); H5Tset_size (tid_vlen_s, H5T_VARIABLE); - - /* create compound datatypes */ + + /* create compound datatypes */ cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof (test_comp_t)); offset = 0; for (i=0; i0) { H5Pset_chunk (dcpl, 1, &chunk); } - /* set dataset compression */ + /* set dataset compression */ if (compressed) { if (chunk<=0) { chunk = dim0/10+1;; @@ -229,54 +229,54 @@ herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets, } H5Pset_shuffle (dcpl); H5Pset_deflate (dcpl, 6); - } + } - /* allocate buffers */ + /* allocate buffers */ buf_comp = (test_comp_t *)calloc(dim0, sizeof(test_comp_t)); buf_comp_large = (test_comp_t *)calloc(nrows, sizeof(test_comp_t)); buf_int = (int *)calloc(dim0, sizeof(int)); buf_float_a = malloc(dim0*sizeof(*buf_float_a)); - buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); + buf_vlen_i = (hvl_t *)calloc(dim0, sizeof (hvl_t)); buf_vlen_s = (char **)calloc(dim0, sizeof(char *)); - buf_str = malloc(dim0*sizeof (*buf_str)); + buf_str = malloc(dim0*sizeof (*buf_str)); - /* allocate array of doulbe pointers */ - buf_double2d = (double **)calloc(dims2d[0],sizeof(double *)); - /* allocate a contigous chunk of memory for the data */ - buf_double2d[0] = (double *)calloc( dims2d[0]*dims2d[1],sizeof(double) ); - /* assign memory city to pointer array */ - for (i=1; i Date: Mon, 26 Aug 2019 10:26:31 -0700 Subject: Added H5Pset/get_mpi_params calls and unified them with the MPI-I/O VFD info in H5FDmpio.c. --- src/H5FDmpio.c | 379 +++++++++-------------------------- src/H5FDprivate.h | 8 - src/H5Fmpi.c | 11 +- src/H5Fprivate.h | 4 + src/H5Pfapl.c | 544 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/H5Ppublic.h | 2 + src/H5mpi.c | 229 ++++++++++++++++++++-- src/H5private.h | 2 + testpar/t_file.c | 103 ++++++++-- testpar/t_ph5basic.c | 135 +++++++------ testpar/testpar.h | 15 +- 11 files changed, 1007 insertions(+), 425 deletions(-) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 6ca7aa4..13efcff 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -58,27 +58,24 @@ static char H5FD_mpi_native_g[] = "native"; * driver doesn't bother to keep it updated since it's an expensive operation. */ typedef struct H5FD_mpio_t { - H5FD_t pub; /*public stuff, must be first */ - MPI_File f; /*MPIO file handle */ - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ - int mpi_rank; /* This process's rank */ - int mpi_size; /* Total number of processes */ - haddr_t eof; /*end-of-file marker */ - haddr_t eoa; /*end-of-address marker */ - haddr_t last_eoa; /* Last known end-of-address marker */ - haddr_t local_eof; /* Local end-of-file address for each process */ + H5FD_t pub; /* Public stuff, must be first */ + MPI_File f; /* MPIO file handle */ + MPI_Comm comm; /* MPI Communicator */ + MPI_Info info; /* MPI info object */ + int mpi_rank; /* This process's rank */ + int mpi_size; /* Total number of processes */ + haddr_t eof; /* End-of-file marker */ + haddr_t eoa; /* End-of-address marker */ + haddr_t last_eoa; /* Last known end-of-address marker */ + haddr_t local_eof; /* Local end-of-file address for each process */ } H5FD_mpio_t; /* Private Prototypes */ /* Callbacks */ static herr_t H5FD__mpio_term(void); -static void *H5FD__mpio_fapl_get(H5FD_t *_file); -static void *H5FD__mpio_fapl_copy(const void *_old_fa); -static herr_t H5FD__mpio_fapl_free(void *_fa); static H5FD_t *H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD__mpio_close(H5FD_t *_file); static herr_t H5FD__mpio_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); @@ -106,10 +103,10 @@ static const H5FD_class_mpi_t H5FD_mpio_g = { NULL, /*sb_size */ NULL, /*sb_encode */ NULL, /*sb_decode */ - sizeof(H5FD_mpio_fapl_t), /*fapl_size */ - H5FD__mpio_fapl_get, /*fapl_get */ - H5FD__mpio_fapl_copy, /*fapl_copy */ - H5FD__mpio_fapl_free, /*fapl_free */ + 0, /*fapl_size */ + NULL, /*fapl_get */ + NULL, /*fapl_copy */ + NULL, /*fapl_free */ 0, /*dxpl_size */ NULL, /*dxpl_copy */ NULL, /*dxpl_free */ @@ -306,7 +303,6 @@ H5FD__mpio_term(void) herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) { - H5FD_mpio_fapl_t fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; @@ -319,15 +315,16 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "MPI_COMM_NULL is not a valid communicator") - /* Initialize driver specific properties */ - HDmemset(&fa, 0, sizeof(H5FD_mpio_fapl_t)); - fa.comm = comm; - fa.info = info; + /* Set the MPI communicator and info object */ + if(H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator") + if(H5P_set(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object") /* duplication is done during driver setting. */ - ret_value = H5P_set_driver(plist, H5FD_MPIO, &fa); + ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL); done: FUNC_LEAVE_API(ret_value) @@ -361,52 +358,43 @@ herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/) { H5P_genplist_t *plist; /* Property list pointer */ - const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ - MPI_Comm comm_tmp = MPI_COMM_NULL; - hbool_t comm_copied = FALSE; /* MPI Comm has been duplicated */ - int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, comm, info); + /* Set comm and info in case we have problems */ + if(comm) + *comm = MPI_COMM_NULL; + if(info) + *info = MPI_INFO_NULL; + /* Check arguments */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if(H5FD_MPIO != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") - if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") - - /* Store the duplicated communicator in a temporary variable for error */ - /* recovery in case the INFO duplication fails. */ - if(comm) { - if(MPI_SUCCESS != (mpi_code = MPI_Comm_dup(fa->comm, &comm_tmp))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) - comm_copied = TRUE; - } /* end if */ + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "VFL driver is not MPI-I/O") - if(info) { - if(MPI_INFO_NULL != fa->info) { - if(MPI_SUCCESS != (mpi_code = MPI_Info_dup(fa->info, info))) - HMPI_GOTO_ERROR(FAIL, "MPI_Info_dup failed", mpi_code) - } /* end if */ - else - /* do not dup it */ - *info = MPI_INFO_NULL; - } /* end if */ - - /* Store the copied communicator, now that the Info object has been - * successfully copied. - */ + /* Get the MPI communicator and info object */ if(comm) - *comm = comm_tmp; + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator") + if(info) + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info object") done: - if(ret_value < 0) - /* need to free anything created here */ - if(comm_copied) - MPI_Comm_free(&comm_tmp); + /* Clean up anything duplicated on errors. The free calls will set + * the output values to MPI_COMM|INFO_NULL. + */ + if(ret_value != SUCCEED) { + if(comm) + if(H5_mpi_comm_free(comm) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + if(info) + if(H5_mpi_info_free(info) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + } FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_mpio() */ @@ -667,161 +655,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_get - * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. - * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. - * Failure: NULL - * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * - *------------------------------------------------------------------------- - */ -static void * -H5FD__mpio_fapl_get(H5FD_t *_file) -{ - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - H5FD_mpio_fapl_t *fa = NULL; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - - /* Check arguments */ - if(NULL == (fa = (H5FD_mpio_fapl_t *)H5MM_calloc(sizeof(H5FD_mpio_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - fa->comm = MPI_COMM_NULL; - fa->info = MPI_INFO_NULL; - - /* Duplicate MPI communicator and info */ - if(FAIL == H5_mpi_comm_dup(file->comm, &fa->comm)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") - if(FAIL == H5_mpi_info_dup(file->info, &fa->info)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") - - /* Set return value */ - ret_value = fa; - -done: - /* Clean up badness if we're failing */ - if(NULL == ret_value && fa) { - H5_mpi_comm_free(&fa->comm); - H5_mpi_info_free(&fa->info); - H5MM_xfree(fa); - } - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD__mpio_fapl_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_copy - * - * Purpose: Copies the mpio-specific file access properties. - * - * Return: Success: Ptr to a new property list - * Failure: NULL - * - * Programmer: Albert Cheng - * Jan 8, 2003 - * - *------------------------------------------------------------------------- - */ -static void * -H5FD__mpio_fapl_copy(const void *_old_fa) -{ - const H5FD_mpio_fapl_t *old_fa = (const H5FD_mpio_fapl_t*)_old_fa; - H5FD_mpio_fapl_t *new_fa = NULL; - void *ret_value = NULL; - - FUNC_ENTER_STATIC - -#ifdef H5FDmpio_DEBUG -if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stderr, "%s: entering\n", FUNC); -#endif - - if(NULL == (new_fa = (H5FD_mpio_fapl_t *)H5MM_malloc(sizeof(H5FD_mpio_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Copy the general information */ - H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); - - /* Duplicate MPI communicator and info */ - if(H5_mpi_comm_dup(old_fa->comm, &new_fa->comm) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") - if(H5_mpi_info_dup(old_fa->info, &new_fa->info) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") - - /* Set return value */ - ret_value = new_fa; - -done: - /* Clean up badness if we're failing */ - if(NULL == ret_value && new_fa) { - H5_mpi_comm_free(&new_fa->comm); - H5_mpi_info_free(&new_fa->info); - H5MM_xfree(new_fa); - } - -#ifdef H5FDmpio_DEBUG -if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stderr, "%s: leaving\n", FUNC); -#endif - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FD__mpio_fapl_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5FD__mpio_fapl_free - * - * Purpose: Frees the mpio-specific file access properties. - * - * Return: SUCCEED/FAIL - * - * Programmer: Albert Cheng - * Jan 8, 2003 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5FD__mpio_fapl_free(void *_fa) -{ - H5FD_mpio_fapl_t *fa = (H5FD_mpio_fapl_t*)_fa; - - FUNC_ENTER_STATIC_NOERR - -#ifdef H5FDmpio_DEBUG -if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stderr, "%s: Entering\n", FUNC); -#endif - - /* Sanity checks */ - HDassert(fa); - - /* Free the internal communicator and INFO object */ - HDassert(MPI_COMM_NULL != fa->comm); - H5_mpi_comm_free(&fa->comm); - H5_mpi_info_free(&fa->info); - H5MM_xfree(fa); - -#ifdef H5FDmpio_DEBUG -if(H5FD_mpio_Debug[(int)'t']) - HDfprintf(stderr, "%s: leaving\n", FUNC); -#endif - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5FD__mpio_fapl_free() */ - - -/*------------------------------------------------------------------------- * Function: H5FD_set_mpio_atomicity * * Purpose: Sets the atomicity mode @@ -935,20 +768,18 @@ static H5FD_t * H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { - H5FD_mpio_t *file = NULL; - MPI_File fh; - unsigned file_opened = 0; /* Flag to indicate that the file was successfully opened */ - int mpi_amode; - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* mpi return code */ - MPI_Offset size; - const H5FD_mpio_fapl_t *fa = NULL; - H5FD_mpio_fapl_t _fa; + H5FD_mpio_t *file = NULL; + MPI_File fh; + hbool_t file_opened = FALSE; /* Flag to indicate that the file was successfully opened */ + int mpi_amode; + int mpi_rank; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + int mpi_code; /* MPI return code */ + MPI_Offset size; H5P_genplist_t *plist; /* Property list pointer */ - MPI_Comm comm_dup = MPI_COMM_NULL; - MPI_Info info_dup = MPI_INFO_NULL; - H5FD_t *ret_value = NULL; /* Return value */ + MPI_Comm comm = MPI_COMM_NULL; + MPI_Info info = MPI_INFO_NULL; + H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -957,26 +788,27 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, HDfprintf(stdout, "%s: Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", FUNC, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif - /* Obtain a pointer to mpio-specific file access properties */ + /* Get a pointer to the fapl */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { - _fa.comm = MPI_COMM_SELF; /*default*/ - _fa.info = MPI_INFO_NULL; /*default*/ - fa = &_fa; - } /* end if */ - else - if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") - /* Duplicate MPI communicator and info */ - if(FAIL == H5_mpi_comm_dup(fa->comm, &comm_dup)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") - if(FAIL == H5_mpi_info_dup(fa->info, &info_dup)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "info duplicate failed") + /* Set MPI communicator and info object */ + if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { + /* Non-parallel defaults */ + if(FAIL == H5_mpi_comm_dup(MPI_COMM_SELF, &comm)) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") + info = MPI_INFO_NULL; + } + else { + /* Get the MPI communicator and info object from the property list */ + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + } - /* convert HDF5 flags to MPI-IO flags */ - /* some combinations are illegal; let MPI-IO figure it out */ + /* Convert HDF5 flags to MPI-IO flags */ + /* Some combinations are illegal; let MPI-IO figure it out */ mpi_amode = (flags & H5F_ACC_RDWR) ? MPI_MODE_RDWR : MPI_MODE_RDONLY; if(flags & H5F_ACC_CREAT) mpi_amode |= MPI_MODE_CREATE; @@ -985,11 +817,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, #ifdef H5FDmpio_DEBUG /* Check for debug commands in the info parameter */ - if(MPI_INFO_NULL != info_dup) { + if(MPI_INFO_NULL != info) { char debug_str[128]; int flag; - MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); + MPI_Info_get(info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str) - 1, debug_str, &flag); if(flag) { int i; @@ -1000,22 +832,22 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, } /* end if */ #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, name, mpi_amode, info_dup, &fh))) + if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm, name, mpi_amode, info, &fh))) HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) - file_opened=1; + file_opened = TRUE; /* Get the MPI rank of this process and the total number of processes */ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank))) + if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank (comm, &mpi_rank))) HMPI_GOTO_ERROR(NULL, "MPI_Comm_rank failed", mpi_code) - if (MPI_SUCCESS != (mpi_code=MPI_Comm_size (comm_dup, &mpi_size))) + if (MPI_SUCCESS != (mpi_code = MPI_Comm_size (comm, &mpi_size))) HMPI_GOTO_ERROR(NULL, "MPI_Comm_size failed", mpi_code) /* Build the return value and initialize it */ if(NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") file->f = fh; - file->comm = comm_dup; - file->info = info_dup; + file->comm = comm; + file->info = info; file->mpi_rank = mpi_rank; file->mpi_size = mpi_size; @@ -1026,7 +858,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, } /* end if */ /* Broadcast file size */ - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm_dup))) + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(&size, (int)sizeof(MPI_Offset), MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) /* Determine if the file should be truncated */ @@ -1035,7 +867,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, HMPI_GOTO_ERROR(NULL, "MPI_File_set_size failed", mpi_code) /* Don't let any proc return until all have truncated the file. */ - if (MPI_SUCCESS!= (mpi_code=MPI_Barrier(comm_dup))) + if (MPI_SUCCESS != (mpi_code = MPI_Barrier(comm))) HMPI_GOTO_ERROR(NULL, "MPI_Barrier failed", mpi_code) /* File is zero size now */ @@ -1053,8 +885,10 @@ done: if(ret_value == NULL) { if(file_opened) MPI_File_close(&fh); - MPI_Comm_free(&comm_dup); - MPI_Info_free(&info_dup); + if(H5_mpi_comm_free(&comm) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI communicator") + if(H5_mpi_info_free(&info) < 0) + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI info object") if(file) H5MM_xfree(file); } /* end if */ @@ -1282,37 +1116,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpio_get_info - * - * Purpose: Returns the file info of MPIO file driver. - * - * Returns: SUCCEED/FAIL - * - * Programmer: John Mainzer - * April 4, 2017 - * - *------------------------------------------------------------------------- -*/ -static herr_t -H5FD_mpio_get_info(H5FD_t *_file, void** mpi_info) -{ - H5FD_mpio_t *file = (H5FD_mpio_t *)_file; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - if(!mpi_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mpi info not valid") - - *mpi_info = &(file->info); - -done: - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5FD_mpio_get_info() */ - - -/*------------------------------------------------------------------------- * Function: H5FD__mpio_read * * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR @@ -1697,7 +1500,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, io_size = type_size * size_i; /* Check for write failure */ - if(bytes_written != io_size) + if(bytes_written != io_size || bytes_written < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") /* Each process will keep track of its perceived EOF value locally, and @@ -1708,8 +1511,8 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, * potentially be wrong.) */ file->eof = HADDR_UNDEF; - if(bytes_written && ((bytes_written + addr) > file->local_eof)) - file->local_eof = addr + bytes_written; + if(bytes_written && (((haddr_t)bytes_written + addr) > file->local_eof)) + file->local_eof = addr + (haddr_t)bytes_written; done: #ifdef H5FDmpio_DEBUG diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0db66af..ac08f7f 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -95,14 +95,6 @@ typedef struct { const void *driver_info; /* Driver info, for open callbacks */ } H5FD_driver_prop_t; -#ifdef H5_HAVE_PARALLEL -/* MPIO-specific file access properties */ -typedef struct H5FD_mpio_fapl_t { - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ -} H5FD_mpio_fapl_t; -#endif /* H5_HAVE_PARALLEL */ - /*****************************/ /* Library Private Variables */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 470241b..bb422ac 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -368,14 +368,9 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access list") - if(H5FD_MPIO == H5P_peek_driver(plist)) { - const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ - - if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad VFL driver info") - - *mpi_comm = fa->comm; - } + if(H5FD_MPIO == H5P_peek_driver(plist)) + if(H5P_peek(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, mpi_comm) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") } done: diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 867db84..0a7daa0 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -513,6 +513,10 @@ typedef struct H5F_t H5F_t; #define H5F_ACS_PAGE_BUFFER_SIZE_NAME "page_buffer_size" /* the maximum size for the page buffer cache */ #define H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME "page_buffer_min_meta_perc" /* the min metadata percentage for the page buffer cache */ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME "page_buffer_min_raw_perc" /* the min raw data percentage for the page buffer cache */ +#ifdef H5_HAVE_PARALLEL +#define H5F_ACS_MPI_PARAMS_COMM_NAME "mpi_params_comm" /* the MPI communicator */ +#define H5F_ACS_MPI_PARAMS_INFO_NAME "mpi_params_info" /* the MPI info struct */ +#endif /* H5_HAVE_PARALLEL */ /* ======================== File Mount properties ====================*/ #define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 8bb2b12..22252d3 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -30,22 +30,22 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory Management */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory Management */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VMprivate.h" /* Vector Functions */ /* Includes needed to set default file driver */ -#include "H5FDsec2.h" /* POSIX unbuffered I/O */ -#include "H5FDstdio.h" /* Standard C buffered I/O */ +#include "H5FDsec2.h" /* POSIX unbuffered I/O */ +#include "H5FDstdio.h" /* Standard C buffered I/O */ #ifdef H5_HAVE_WINDOWS -#include "H5FDwindows.h" /* Win32 I/O */ +#include "H5FDwindows.h" /* Win32 I/O */ #endif /* Includes needed to set default VOL connector */ @@ -111,7 +111,7 @@ #define H5F_ACS_GARBG_COLCT_REF_DEF 0 #define H5F_ACS_GARBG_COLCT_REF_ENC H5P__encode_unsigned #define H5F_ACS_GARBG_COLCT_REF_DEC H5P__decode_unsigned -/* Definition for file driver ID & info*/ +/* Definition for file driver ID & info */ #define H5F_ACS_FILE_DRV_SIZE sizeof(H5FD_driver_prop_t) #define H5F_ACS_FILE_DRV_DEF {H5_DEFAULT_VFD, NULL} #define H5F_ACS_FILE_DRV_CRT H5P__facc_file_driver_create @@ -231,6 +231,24 @@ #define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE #define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t #define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t +/* Definition for the file's MPI communicator */ +#define H5F_ACS_MPI_PARAMS_COMM_SIZE sizeof(MPI_Comm) +#define H5F_ACS_MPI_PARAMS_COMM_DEF MPI_COMM_NULL +#define H5F_ACS_MPI_PARAMS_COMM_SET H5P__facc_mpi_comm_set +#define H5F_ACS_MPI_PARAMS_COMM_GET H5P__facc_mpi_comm_get +#define H5F_ACS_MPI_PARAMS_COMM_DEL H5P__facc_mpi_comm_del +#define H5F_ACS_MPI_PARAMS_COMM_COPY H5P__facc_mpi_comm_copy +#define H5F_ACS_MPI_PARAMS_COMM_CMP H5P__facc_mpi_comm_cmp +#define H5F_ACS_MPI_PARAMS_COMM_CLOSE H5P__facc_mpi_comm_close +/* Definition for the file's MPI info */ +#define H5F_ACS_MPI_PARAMS_INFO_SIZE sizeof(MPI_Info) +#define H5F_ACS_MPI_PARAMS_INFO_DEF MPI_INFO_NULL +#define H5F_ACS_MPI_PARAMS_INFO_SET H5P__facc_mpi_info_set +#define H5F_ACS_MPI_PARAMS_INFO_GET H5P__facc_mpi_info_get +#define H5F_ACS_MPI_PARAMS_INFO_DEL H5P__facc_mpi_info_del +#define H5F_ACS_MPI_PARAMS_INFO_COPY H5P__facc_mpi_info_copy +#define H5F_ACS_MPI_PARAMS_INFO_CMP H5P__facc_mpi_info_cmp +#define H5F_ACS_MPI_PARAMS_INFO_CLOSE H5P__facc_mpi_info_close #endif /* H5_HAVE_PARALLEL */ /* Definitions for the initial metadata cache image configuration */ #define H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_SIZE sizeof(H5AC_cache_image_config_t) @@ -334,6 +352,24 @@ static herr_t H5P__facc_vol_copy(const char *name, size_t size, void *value); static int H5P__facc_vol_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__facc_vol_close(const char *name, size_t size, void *value); +#ifdef H5_HAVE_PARALLEL +/* MPI communicator callbacks */ +static herr_t H5P__facc_mpi_comm_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_comm_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_comm_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_comm_copy(const char *name, size_t size, void *value); +static int H5P__facc_mpi_comm_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_mpi_comm_close(const char *name, size_t size, void *value); + +/* MPI info callbacks */ +static herr_t H5P__facc_mpi_info_set(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_info_get(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_info_del(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P__facc_mpi_info_copy(const char *name, size_t size, void *value); +static int H5P__facc_mpi_info_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__facc_mpi_info_close(const char *name, size_t size, void *value); +#endif /* H5_HAVE_PARALLEL */ + /*********************/ /* Package Variables */ @@ -404,6 +440,8 @@ static const hbool_t H5F_def_evict_on_close_flag_g = H5F_ACS_EVICT_ON_CLOSE_FLAG #ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ +static const MPI_Comm H5F_def_mpi_params_comm_g = H5F_ACS_MPI_PARAMS_COMM_DEF; /* Default MPI communicator */ +static const MPI_Info H5F_def_mpi_params_info_g = H5F_ACS_MPI_PARAMS_INFO_DEF; /* Default MPI info struct */ #endif /* H5_HAVE_PARALLEL */ static const H5AC_cache_image_config_t H5F_def_mdc_initCacheImageCfg_g = H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEF; /* Default metadata cache image settings */ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF; /* Default page buffer size */ @@ -621,6 +659,19 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the MPI communicator */ + if(H5P__register_real(pclass, H5F_ACS_MPI_PARAMS_COMM_NAME, H5F_ACS_MPI_PARAMS_COMM_SIZE, &H5F_def_mpi_params_comm_g, + NULL, H5F_ACS_MPI_PARAMS_COMM_SET, H5F_ACS_MPI_PARAMS_COMM_GET, NULL, NULL, + H5F_ACS_MPI_PARAMS_COMM_DEL, H5F_ACS_MPI_PARAMS_COMM_COPY, H5F_ACS_MPI_PARAMS_COMM_CMP, H5F_ACS_MPI_PARAMS_COMM_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the MPI info struct */ + if(H5P__register_real(pclass, H5F_ACS_MPI_PARAMS_INFO_NAME, H5F_ACS_MPI_PARAMS_INFO_SIZE, &H5F_def_mpi_params_info_g, + NULL, H5F_ACS_MPI_PARAMS_INFO_SET, H5F_ACS_MPI_PARAMS_INFO_GET, NULL, NULL, + H5F_ACS_MPI_PARAMS_INFO_DEL, H5F_ACS_MPI_PARAMS_INFO_COPY, H5F_ACS_MPI_PARAMS_INFO_CMP, H5F_ACS_MPI_PARAMS_INFO_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + #endif /* H5_HAVE_PARALLEL */ /* Register the initial metadata cache image configuration */ @@ -634,11 +685,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the size of the page buffer minimum metadata size */ if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the size of the page buffer minimum raw data size */ if(H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, @@ -4738,6 +4791,468 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pget_mpi_params + * + * Purpose: Gets the MPI communicator and info stored in the fapl. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Dana Robinson + * August 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm, MPI_Info *info) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*Mc*Mi", plist_id, comm, info); + + /* Make sure that the property list is a fapl */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get the properties */ + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator from plist") + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info from plist") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_mpi_params() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_mpi_params + * + * Purpose: Set the MPI communicator and info + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Dana Robinson + * August 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_mpi_params(hid_t plist_id, MPI_Comm comm, MPI_Info info) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "iMcMi", plist_id, comm, info); + + /* Make sure the MPI communicator is valid */ + if(MPI_COMM_NULL == comm) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "not a valid argument") + + /* Make sure that the property list is a fapl */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator") + if(H5P_set(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_mpi_params() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_set + * + * Purpose: Copies an MPI comminicator property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_comm_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Comm *comm = (MPI_Comm *)value; + MPI_Comm comm_tmp = MPI_COMM_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI communicator */ + if(H5_mpi_comm_dup(*comm, &comm_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + +done: + /* Copy the communicator to the in/out parameter */ + if(ret_value != SUCCEED) + *comm = MPI_COMM_NULL; + else + *comm = comm_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_get + * + * Purpose: Copies an MPI comminicator property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_comm_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Comm *comm = (MPI_Comm *)value; + MPI_Comm comm_tmp = MPI_COMM_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI communicator */ + if(H5_mpi_comm_dup(*comm, &comm_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + +done: + /* Copy the communicator to the out parameter */ + if(ret_value != SUCCEED) + *comm = MPI_COMM_NULL; + else + *comm = comm_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_del + * + * Purpose: Frees an MPI communicator property + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_comm_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Comm *comm = (MPI_Comm *)value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Free the MPI communicator */ + if(H5_mpi_comm_free(comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_copy + * + * Purpose: Copy callback for the MPI communicator property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_comm_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Comm *comm = (MPI_Comm *)value; + MPI_Comm comm_tmp = MPI_COMM_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI communicator */ + if(H5_mpi_comm_dup(*comm, &comm_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + +done: + /* Copy the communicator to the in/out parameter */ + if(ret_value != SUCCEED) + *comm = MPI_COMM_NULL; + else + *comm = comm_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_cmp + * + * Purpose: Callback routine which is called whenever the MPI + * communicator property in the file access property list + * is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_mpi_comm_cmp(const void *_comm1, const void *_comm2, size_t H5_ATTR_UNUSED size) +{ + const MPI_Comm *comm1 = (const MPI_Comm *)_comm1; + const MPI_Comm *comm2 = (const MPI_Comm *)_comm2; + int ret_value = 0; + + FUNC_ENTER_STATIC + + /* Compare the MPI communicators */ + if(H5_mpi_comm_cmp(*comm1, *comm2, &ret_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI communicator") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_comm_close + * + * Purpose: Close callback for the MPI communicator property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_comm_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Comm *comm = (MPI_Comm *)value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Free the MPI communicator */ + if(H5_mpi_comm_free(comm) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_comm_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_set + * + * Purpose: Copies an MPI info object property when it's set for a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Info *info = (MPI_Info *)value; + MPI_Info info_tmp = MPI_INFO_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI info object */ + if(H5_mpi_info_dup(*info, &info_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + +done: + /* Copy the info object to the in/out parameter */ + if(ret_value != SUCCEED) + *info = MPI_INFO_NULL; + else + *info = info_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_get + * + * Purpose: Copies an MPI comminicator property when it's retrieved from a property list + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Info *info = (MPI_Info *)value; + MPI_Info info_tmp = MPI_INFO_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI communicator */ + if(H5_mpi_info_dup(*info, &info_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + +done: + /* Copy the info object to the out parameter */ + if(ret_value != SUCCEED) + *info = MPI_INFO_NULL; + else + *info = info_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_del + * + * Purpose: Frees an MPI info object property + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Info *info = (MPI_Info *)value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Free the MPI info object */ + if(H5_mpi_info_free(info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_copy + * + * Purpose: Copy callback for the MPI info object property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Info *info = (MPI_Info *)value; + MPI_Info info_tmp = MPI_INFO_NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Make a copy of the MPI info object */ + if(H5_mpi_info_dup(*info, &info_tmp) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + +done: + /* Copy the info object to the in/out parameter */ + if(ret_value != SUCCEED) + *info = MPI_INFO_NULL; + else + *info = info_tmp; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_cmp + * + * Purpose: Callback routine which is called whenever the MPI + * info object property in the file access property list + * is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +static int +H5P__facc_mpi_info_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) +{ + const MPI_Info *info1 = (const MPI_Info *)_info1; + const MPI_Info *info2 = (const MPI_Info *)_info2; + int ret_value = 0; + + FUNC_ENTER_STATIC + + /* Compare the MPI info objects */ + if(H5_mpi_info_cmp(*info1, *info2, &ret_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI info objects") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__facc_mpi_info_close + * + * Purpose: Close callback for the MPI info object property. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__facc_mpi_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + MPI_Info *info = (MPI_Info *)value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC + + /* Free the MPI info object */ + if(H5_mpi_info_free(info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__facc_mpi_info_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Pget_coll_metadata_write * * Purpose: Gets information about collective metadata write mode. @@ -5305,4 +5820,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_vol_close() */ - diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 43e477a..9f26b8b 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -381,6 +381,8 @@ H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); +H5_DLL herr_t H5Pget_mpi_params(hid_t fapl_id, MPI_Comm *comm, MPI_Info *info); +H5_DLL herr_t H5Pset_mpi_params(hid_t fapl_id, MPI_Comm comm, MPI_Info info); #endif /* H5_HAVE_PARALLEL */ H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); diff --git a/src/H5mpi.c b/src/H5mpi.c index ea6b33f..aec1e03 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -16,14 +16,10 @@ * */ - #include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* Common MPI file driver */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5MMprivate.h" /* Memory Management */ + #ifdef H5_HAVE_PARALLEL @@ -32,6 +28,9 @@ * * Purpose: Duplicate an MPI communicator. * + * Does not duplicate MPI_COMM_NULL. Instead, comm_new will + * be set to MPI_COMM_NULL directly. + * * The new communicator is returned via the comm_new pointer. * * Return: SUCCEED/FAIL @@ -50,19 +49,26 @@ H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new) /* Check arguments */ if (!comm_new) HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL") - if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't duplicate MPI_COMM_NULL") - /* Duplicate the MPI communicator */ - if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(comm, &comm_dup))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + /* Handle MPI_COMM_NULL separately */ + if (MPI_COMM_NULL == comm) { + /* Don't duplicate MPI_COMM_NULL since that's an error in MPI */ + comm_dup = MPI_COMM_NULL; + } + else { - /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal, - * and return codes can be checked and handled. - */ - if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN))) - HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code) + /* Duplicate the MPI communicator */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_dup(comm, &comm_dup))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + + /* Set MPI_ERRORS_RETURN on comm_dup so that MPI failures are not fatal, + * and return codes can be checked and handled. + */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_set_errhandler(comm_dup, MPI_ERRORS_RETURN))) + HMPI_GOTO_ERROR(FAIL, "MPI_Errhandler_set failed", mpi_code) + } + /* Copy the new communicator to the return argument */ *comm_new = comm_dup; @@ -108,7 +114,7 @@ H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new) /* Duplicate the MPI info */ if (info == MPI_INFO_NULL) { /* Don't duplicate MPI_INFO_NULL. Just copy it. */ - info_dup = info; + info_dup = MPI_INFO_NULL; } else { /* Duplicate the info */ @@ -194,5 +200,194 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* End H5_mpi_info_free() */ + +/*------------------------------------------------------------------------- + * Function: H5_mpi_comm_cmp + * + * Purpose: Compares two MPI communicators. + * + * Note that passing MPI_COMM_NULL to this function will not + * throw errors, unlike MPI_Comm_compare(). + * + * We consider MPI communicators to be the "same" when the + * groups are identical. We don't care about the context + * since that will always be different as we call MPI_Comm_dup + * when we store the communicator in the fapl. + * + * The out parameter is a value like strcmp. The value is + * undefined when the return value is FAIL. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result) +{ + int mpi_code; + int mpi_result = MPI_IDENT; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!result) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL") + + /* Set out parameter to something reasonable in case something goes wrong */ + *result = 0; + + /* Can't pass MPI_COMM_NULL to MPI_Comm_compare() so we have to handle + * it in special cases. + */ + if (MPI_COMM_NULL == comm1 && MPI_COMM_NULL == comm2) { + /* Special case of both communicators being MPI_COMM_NULL */ + *result = 0; + } + else if (MPI_COMM_NULL == comm1 || MPI_COMM_NULL == comm2) { + + /* Special case of one communicator being MPI_COMM_NULL */ + *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1; + } + else { + + /* Normal communicator compare */ + + /* Compare the MPI communicators */ + if (MPI_SUCCESS != (mpi_code = MPI_Comm_compare(comm1, comm2, &mpi_result))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_compare failed", mpi_code) + + /* Set the result + * + * The else clause should work regardless of whether MPI_Datatype is + * fundamentally an integer or a pointer. + */ + if (MPI_IDENT == mpi_result || MPI_CONGRUENT == mpi_result) + *result = 0; + else + *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_mpi_comm_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5_mpi_info_cmp + * + * Purpose: Compares two MPI info objects. + * + * For our purposes, two mpi info objects are the "same" if + * they contain the same key-value pairs or are both + * MPI_INFO_NULL. + * + * The out parameter is a value like strcmp. The value is + * undefined when the return value is FAIL. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) +{ + hbool_t same = FALSE; + char *key = NULL; + char *value1 = NULL; + char *value2 = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments */ + if (!result) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL") + + /* Check for MPI_INFO_NULL */ + if (MPI_INFO_NULL == info1 && MPI_INFO_NULL == info2) { + /* Special case of both info objects being MPI_INFO_NULL */ + same = TRUE; + } + else if (MPI_INFO_NULL == info1 || MPI_INFO_NULL == info2) { + + /* Special case of one info object being MPI_INFO_NULL */ + same = FALSE; + } + else { + int mpi_code; + int nkeys_1; + int nkeys_2; + + /* Check if the number of keys is the same */ + if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nkeys(info1, &nkeys_1))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nkeys failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nkeys(info2, &nkeys_2))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nkeys failed", mpi_code) + + if (nkeys_1 != nkeys_2) + same = FALSE; + else if (0 == nkeys_1 && 0 == nkeys_2) + same = TRUE; + else { + int i; + int flag1 = -1; + int flag2 = -1; + + /* Allocate buffers for iteration */ + if (NULL == (key = (char *)H5MM_malloc(MPI_MAX_INFO_KEY * sizeof(char)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if (NULL == (value1 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if (NULL == (value2 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + /* Iterate over the keys, comparing them */ + for (i = 0; i < nkeys_1; i++) { + + same = TRUE; + + /* Memset the buffers to zero */ + HDmemset(key, 0, MPI_MAX_INFO_KEY); + HDmemset(value1, 0, MPI_MAX_INFO_VAL); + HDmemset(value2, 0, MPI_MAX_INFO_VAL); + + /* Get the nth key */ + if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nthkey(info1, i, key))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_get_nthkey failed", mpi_code) + + /* Get the values */ + if (MPI_SUCCESS != (mpi_code = MPI_Info_get(info1, key, MPI_MAX_INFO_VAL, value1, &flag1))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_get failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Info_get(info2, key, MPI_MAX_INFO_VAL, value2, &flag2))) + HMPI_GOTO_ERROR(FAIL, "MPI_Info_get failed", mpi_code) + + /* Compare values and flags */ + if (!flag1 || !flag2 || HDmemcmp(value1, value2, MPI_MAX_INFO_VAL)) { + same = FALSE; + break; + } + + } /* end for */ + } /* end else */ + } /* end else */ + + /* Set the output value */ + if (same) + *result = 0; + else + *result = (MPI_Datatype)info1 < (MPI_Datatype)info2 ? -1 : 1; + +done: + if (key) + H5MM_xfree(key); + if (value1) + H5MM_xfree(value1); + if (value2) + H5MM_xfree(value2); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_mpi_info_cmp() */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5private.h b/src/H5private.h index 18b52a0..bb2a2eb 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2674,6 +2674,8 @@ H5_DLL herr_t H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new); H5_DLL herr_t H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new); H5_DLL herr_t H5_mpi_comm_free(MPI_Comm *comm); H5_DLL herr_t H5_mpi_info_free(MPI_Info *info); +H5_DLL herr_t H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result); +H5_DLL herr_t H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result); #endif /* H5_HAVE_PARALLEL */ /* Functions for debugging */ diff --git a/testpar/t_file.c b/testpar/t_file.c index a3c007d..1811a62 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -120,7 +120,7 @@ void test_page_buffer_access(void) { hid_t file_id = -1; /* File ID */ - hid_t fcpl, fapl, fapl_self; + hid_t fcpl, fapl; size_t page_count = 0; int i, num_elements = 200; haddr_t raw_addr, meta_addr; @@ -180,7 +180,7 @@ test_page_buffer_access(void) data[i] = -1; if(MAINPROCESS) { - hid_t fapl_self; + hid_t fapl_self = H5I_INVALID_HID; fapl_self = create_faccess_plist(MPI_COMM_SELF, MPI_INFO_NULL, facc_type); @@ -740,29 +740,99 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, void test_file_properties(void) { - hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access plist */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ + hid_t fapl_copy_id = H5I_INVALID_HID; /* File access plist */ hbool_t is_coll; + htri_t are_equal; const char *filename; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + MPI_Comm comm_out = MPI_COMM_NULL; + MPI_Info info_out = MPI_INFO_NULL; herr_t ret; /* Generic return value */ + int mpi_ret; /* MPI return value */ + int cmp; /* Compare value */ filename = (const char *)GetTestParameters(); /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + mpi_ret = MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + VRFY((mpi_ret >= 0), "MPI_Comm_size succeeded"); + mpi_ret = MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + VRFY((mpi_ret >= 0), "MPI_Comm_rank succeeded"); + mpi_ret = MPI_Info_create(&info); + VRFY((mpi_ret >= 0), "MPI_Info_create succeeded"); + mpi_ret = MPI_Info_set(info, "hdf_info_prop1", "xyz"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); /* setup file access plist */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fapl_id >= 0), "H5Pcreate"); + VRFY((fapl_id != H5I_INVALID_HID), "H5Pcreate"); ret = H5Pset_fapl_mpio(fapl_id, comm, info); VRFY((ret >= 0), "H5Pset_fapl_mpio"); + /* Check getting and setting MPI properties + * (for use in VOL connectors, not the MPI-I/O VFD) + */ + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + ret = H5Pget_mpi_params(fapl_id, &comm_out, &info_out); + VRFY((ret >= 0), "H5Pget_mpi_params succeeded"); + + /* Check the communicator */ + VRFY((comm != comm_out), "Communicators should not be bitwise identical"); + cmp = MPI_UNEQUAL; + mpi_ret = MPI_Comm_compare(comm, comm_out, &cmp); + VRFY((ret >= 0), "MPI_Comm_compare succeeded"); + VRFY((cmp == MPI_CONGRUENT), "Communicators should be congruent via MPI_Comm_compare"); + + /* Check the info object */ + VRFY((info != info_out), "Info objects should not be bitwise identical"); + + /* Free the obtained comm and info object */ + mpi_ret = MPI_Comm_free(&comm_out); + VRFY((mpi_ret >= 0), "MPI_Comm_free succeeded"); + mpi_ret = MPI_Info_free(&info_out); + VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); + + /* Copy the fapl and ensure it's equal to the original */ + fapl_copy_id = H5Pcopy(fapl_id); + VRFY((fapl_copy_id != H5I_INVALID_HID), "H5Pcopy"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((TRUE == are_equal), "H5Pequal"); + + /* Add a property to the copy and ensure it's different now */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "abc"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_copy_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((FALSE == are_equal), "H5Pequal"); + + /* Add a property with the same key but a different value to the original + * and ensure they are still different. + */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "ijk"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((FALSE == are_equal), "H5Pequal"); + + /* Set the second property in the original to the same + * value as the copy and ensure they are the same now. + */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "abc"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((TRUE == are_equal), "H5Pequal"); + /* create the file */ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -783,7 +853,7 @@ test_file_properties(void) ret = H5Pset_fapl_mpio(fapl_id, comm, info); VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -800,7 +870,7 @@ test_file_properties(void) ret = H5Fclose(fid); VRFY((ret >= 0), "H5Fclose succeeded"); - /* Open the file with the MPI-IO driver w collective settings */ + /* Open the file with the MPI-IO driver w/ collective settings */ ret = H5Pset_fapl_mpio(fapl_id, comm, info); VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); /* Collective metadata writes */ @@ -810,7 +880,7 @@ test_file_properties(void) ret = H5Pset_all_coll_metadata_ops(fapl_id, TRUE); VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -827,10 +897,10 @@ test_file_properties(void) /* close fapl and retrieve it from file */ ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); - fapl_id = -1; + fapl_id = H5I_INVALID_HID; fapl_id = H5Fget_access_plist(fid); - VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + VRFY((fapl_id != H5I_INVALID_HID), "H5P_FILE_ACCESS"); /* verify settings for file access properties */ @@ -851,5 +921,12 @@ test_file_properties(void) /* Release file-access plist */ ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); + ret = H5Pclose(fapl_copy_id); + VRFY((ret >= 0), "H5Pclose succeeded"); + + /* Free the MPI info object */ + mpi_ret = MPI_Info_free(&info); + VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); + } /* end test_file_properties() */ diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index 574591c..73d262e 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -22,17 +22,15 @@ * Function: test_fapl_mpio_dup * * Purpose: Test if fapl_mpio property list keeps a duplicate of the - * communicator and INFO objects given when set; and returns - * duplicates of its components when H5Pget_fapl_mpio is called. + * communicator and INFO objects given when set; and returns + * duplicates of its components when H5Pget_fapl_mpio is called. * - * Return: Success: None - * - * Failure: Abort + * Return: Success: None + * Failure: Abort * * Programmer: Albert Cheng * January 9, 2003 * - * Modifications: *------------------------------------------------------------------------- */ void @@ -44,43 +42,43 @@ test_fapl_mpio_dup(void) int mpi_size_tmp, mpi_rank_tmp; MPI_Info info = MPI_INFO_NULL; MPI_Info info_tmp = MPI_INFO_NULL; - int mrc; /* MPI return value */ - hid_t acc_pl; /* File access properties */ - herr_t ret; /* hdf5 return value */ + int mrc; /* MPI return value */ + hid_t acc_pl; /* File access properties */ + herr_t ret; /* HDF5 return value */ int nkeys, nkeys_tmp; if (VERBOSE_MED) - printf("Verify fapl_mpio duplicates communicator and INFO objects\n"); + HDprintf("Verify fapl_mpio duplicates communicator and INFO objects\n"); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); if (VERBOSE_MED) - printf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); + HDprintf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); /* Create a new communicator that has the same processes as MPI_COMM_WORLD. * Use MPI_Comm_split because it is simplier than MPI_Comm_create */ mrc = MPI_Comm_split(MPI_COMM_WORLD, 0, 0, &comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_split"); - MPI_Comm_size(comm,&mpi_size_old); - MPI_Comm_rank(comm,&mpi_rank_old); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_split"); + MPI_Comm_size(comm, &mpi_size_old); + MPI_Comm_rank(comm, &mpi_rank_old); if (VERBOSE_MED) - printf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); + HDprintf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); /* create a new INFO object with some trivial information. */ mrc = MPI_Info_create(&info); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_create"); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_create"); mrc = MPI_Info_set(info, "hdf_info_name", "XYZ"); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_set"); - if (MPI_INFO_NULL != info){ - mrc=MPI_Info_get_nkeys(info, &nkeys); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_set"); + if (MPI_INFO_NULL != info) { + mrc = MPI_Info_get_nkeys(info, &nkeys); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); } if (VERBOSE_MED) - h5_dump_info_object(info); + h5_dump_info_object(info); - acc_pl = H5Pcreate (H5P_FILE_ACCESS); + acc_pl = H5Pcreate(H5P_FILE_ACCESS); VRFY((acc_pl >= 0), "H5P_FILE_ACCESS"); ret = H5Pset_fapl_mpio(acc_pl, comm, info); @@ -92,28 +90,27 @@ test_fapl_mpio_dup(void) * valid communicator and INFO object. */ mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info){ - mrc = MPI_Info_free(&info); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info) { + mrc = MPI_Info_free(&info); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio"); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - printf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); - VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); - VRFY((nkeys_tmp==nkeys), "new and old nkeys equal"); + HDprintf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp); + VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size"); + VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((nkeys_tmp == nkeys), "new and old nkeys equal"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* Case 2: * Free the retrieved communicator and INFO object. @@ -122,23 +119,23 @@ test_fapl_mpio_dup(void) * Also verify the NULL argument option. */ mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } /* check NULL argument options. */ ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, NULL); VRFY((ret >= 0), "H5Pget_fapl_mpio Comm only"); mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); ret = H5Pget_fapl_mpio(acc_pl, NULL, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio Info only"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } ret = H5Pget_fapl_mpio(acc_pl, NULL, NULL); @@ -148,44 +145,44 @@ test_fapl_mpio_dup(void) /* Donot free the returned objects which are used in the next case. */ ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio"); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - printf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); - VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); - VRFY((nkeys_tmp==nkeys), "new and old nkeys equal"); + HDprintf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", + mpi_rank_tmp, mpi_size_tmp); + VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size"); + VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((nkeys_tmp == nkeys), "new and old nkeys equal"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* Case 3: * Close the property list and verify the retrieved communicator and INFO * object are still valid. */ H5Pclose(acc_pl); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - printf("After Property list closed: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); + HDprintf("After Property list closed: rank/size of comm are %d/%d\n", + mpi_rank_tmp, mpi_size_tmp); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* clean up */ mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } -} +} /* end test_fapl_mpio_dup() */ diff --git a/testpar/testpar.h b/testpar/testpar.h index 84c073f..6b8375d 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -32,7 +32,7 @@ */ #define MESG(mesg) \ if (VERBOSE_MED && *mesg != '\0') \ - printf("%s\n", mesg) + HDprintf("%s\n", mesg) /* * VRFY: Verify if the condition val is true. @@ -46,16 +46,17 @@ */ #define VRFY(val, mesg) do { \ if (val) { \ - MESG(mesg); \ - } else { \ - printf("Proc %d: ", mpi_rank); \ - printf("*** Parallel ERROR ***\n"); \ - printf(" VRFY (%s) failed at line %4d in %s\n", \ + MESG(mesg); \ + } \ + else { \ + HDprintf("Proc %d: ", mpi_rank); \ + HDprintf("*** Parallel ERROR ***\n"); \ + HDprintf(" VRFY (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ ++nerrors; \ fflush(stdout); \ if (!VERBOSE_MED) { \ - printf("aborting MPI processes\n"); \ + HDprintf("aborting MPI processes\n"); \ MPI_Abort(MPI_COMM_WORLD, 1); \ } \ } \ -- cgit v0.12 From 3090ac81506094ee510ae89c31749b5c1632aa34 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 26 Aug 2019 14:38:58 -0500 Subject: Add a 'closing' flag on the shared file struct, and switch several of the "internal" data structures to use it. --- src/H5FSsection.c | 4 ++-- src/H5Fint.c | 3 +++ src/H5Fpkg.h | 1 + src/H5MFaggr.c | 4 ++-- src/H5Ocache_image.c | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 9f86aea..df67bd9 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" cache_flags |= H5AC__DIRTIED_FLAG; /* On file close or flushing, does not allow section info to shrink in size */ - if(f->closing || flush_in_progress) { + if(f->shared->closing || flush_in_progress) { if(fspace->sect_size > fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; else @@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* Set flag to release section info space in file */ /* On file close or flushing, only need to release section info with size bigger than previous section */ - if(f->closing || flush_in_progress) { + if(f->shared->closing || flush_in_progress) { if(fspace->sect_size > fspace->alloc_sect_size) release_sinfo_space = TRUE; else diff --git a/src/H5Fint.c b/src/H5Fint.c index 9b31d7e..c56bd10 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1175,6 +1175,9 @@ H5F__dest(H5F_t *f, hbool_t flush) if(1 == f->shared->nrefs) { int actype; /* metadata cache type (enum value) */ + /* Mark this file as closing */ + f->shared->closing = TRUE; + /* Flush at this point since the file will be closed (phase 1). * Only try to flush the file if it was opened with write access, and if * the caller requested a flush. diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 42c9a828..7e89111 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -309,6 +309,7 @@ struct H5F_shared_t { struct H5G_t *root_grp; /* Open root group */ H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + hbool_t closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ hid_t vol_id; /* ID of VOL connector for the container */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index c726341..d716ae2 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -194,9 +194,9 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); * the cache eventually adjusts/evicts ageout entries and ends up flushing out the * same entry that is being serialized (flush_in_progress). */ - if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && (!f->closing || !f->shared->fs_persist)) { + if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && (!f->shared->closing || !f->shared->fs_persist)) { #ifdef REPLACE - if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->closing) { + if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE && !f->shared->closing) { #endif haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */ hsize_t aggr_frag_size = 0; /* Size of aggregator fragment */ diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 7336211..70d9ef5 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -325,7 +325,7 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) - if(f->closing) { + if(f->shared->closing) { /* Get the eoa, and verify that it has the expected value */ if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) ) -- cgit v0.12 From d42de626b604b75963fd593a145fd9c9b9e20602 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Aug 2019 07:03:51 -0700 Subject: Fixed a bug where we incorrectly pass a lock struct to fcntl for file locking instead of a pointer. --- src/H5system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5system.c b/src/H5system.c index 1d47d13..384360d 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -631,7 +631,7 @@ Pflock(int fd, int operation) { flk.l_pid = 0; /* not used with set */ /* Lock or unlock */ - if(HDfcntl(fd, F_SETLK, flk) < 0) + if(HDfcntl(fd, F_SETLK, &flk) < 0) return -1; return 0; -- cgit v0.12 From 392340062b7c130a02368aee79bc34ba9868038a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 27 Aug 2019 09:21:08 -0500 Subject: Add HD prefix --- tools/test/misc/talign.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c index 944674d..7f1f038 100644 --- a/tools/test/misc/talign.c +++ b/tools/test/misc/talign.c @@ -53,12 +53,12 @@ int main(void) HDprintf("%-70s", "Testing alignment in compound datatypes"); - strcpy(string5, "Hi!"); + HDstrcpy(string5, "Hi!"); HDunlink(fname); fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fil < 0) { - puts("*FAILED*"); + HDputs("*FAILED*"); return 1; } @@ -123,8 +123,8 @@ int main(void) data = (char *)HDmalloc(H5Tget_size(fix)); if(!data) { - perror("malloc() failed"); - abort(); + HDperror("malloc() failed"); + HDabort(); } set = H5Dopen2(fil, setname, H5P_DEFAULT); @@ -136,7 +136,7 @@ int main(void) out: if(error < 0) { result = 1; - puts("*FAILED - HDF5 library error*"); + HDputs("*FAILED - HDF5 library error*"); } else if(!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) || !(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) @@ -183,9 +183,9 @@ out: (double)fok[1], (double)fptr[1], (double)fnok[0], (double)fptr[2], (double)fnok[1], (double)fptr[3]); - puts("*FAILED - compound type alignmnent problem*"); + HDputs("*FAILED - compound type alignmnent problem*"); } else { - puts(" PASSED"); + HDputs(" PASSED"); } if(data) @@ -200,7 +200,7 @@ out: H5Pclose(plist); H5Fclose(fil); HDunlink(fname); - fflush(stdout); + HDfflush(stdout); return result; } -- cgit v0.12 From 9a4f86997ad160bcc8a3f9eefdbd92d4a63e14c6 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Aug 2019 12:20:12 -0700 Subject: Fixed typo from HD changes --- testpar/t_cache_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 08d455d..e0c8211 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -4155,7 +4155,7 @@ main(int argc, char **argv) if ( serial_insert_cache_image(file_idx, mpi_size) ) { - HD exit(0); + HDexit(0); } else { -- cgit v0.12 From 369d17c05c57689338a22988df90bfb8313da071 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 27 Aug 2019 15:10:37 -0500 Subject: HDFFV-10876 h5dump OPAQUE size should be optional --- tools/lib/h5tools_dump.c | 26 +++++++++++++++++--------- tools/src/h5dump/h5dump_ddl.c | 8 -------- tools/testfiles/tudlink-2.ddl | 1 - 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index a8b7e30..beb397c 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -94,7 +94,7 @@ h5tool_format_t h5tools_dataformat = { const h5tools_dump_header_t h5tools_standardformat = { "standardformat", /*name */ -"HDF5", /*fileebgin */ +"HDF5", /*filebegin */ "", /*fileend */ SUPER_BLOCK, /*bootblockbegin */ "", /*bootblockend */ @@ -2277,18 +2277,26 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level++; { - char *ttag; + char *ttag; - if(NULL == (ttag = H5Tget_tag(type))) - H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed") + if(NULL == (ttag = H5Tget_tag(type))) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed") - ctx->need_prefix = TRUE; + ctx->need_prefix = TRUE; + + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + + H5free_memory(ttag); - h5tools_str_reset(buffer); - h5tools_str_append(buffer, "OPAQUE_TAG \"%s\";", ttag); - h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + if((size = H5Tget_size(type)) <= 0) { + ctx->need_prefix = TRUE; - H5free_memory(ttag); + h5tools_str_reset(buffer); + h5tools_str_append(buffer, "OPAQUE_SIZE \"%s\";", size); + h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } } ctx->indent_level--; diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c index e66a1c5..d7c7b1a 100644 --- a/tools/src/h5dump/h5dump_ddl.c +++ b/tools/src/h5dump/h5dump_ddl.c @@ -1943,9 +1943,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT break; case H5L_TYPE_EXTERNAL: - begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - PRINTVALSTREAM(rawoutstream, "\n"); - indentation(COL); begin_obj(h5tools_dump_header_format->extlinkbegin, links, h5tools_dump_header_format->extlinkblockbegin); PRINTVALSTREAM(rawoutstream, "\n"); if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0) { @@ -1954,8 +1951,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &elink_file, &elink_path)>=0) { indentation(COL); - PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); - indentation(COL); PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); @@ -1979,9 +1974,6 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); PRINTVALSTREAM(rawoutstream, "\n"); indentation(COL); - begin_obj(h5tools_dump_header_format->udlinkbegin, links, h5tools_dump_header_format->udlinkblockbegin); - PRINTVALSTREAM(rawoutstream, "\n"); - indentation(COL); PRINTSTREAM(rawoutstream, "LINKCLASS %d\n", linfo.type); end_obj(h5tools_dump_header_format->udlinkend, h5tools_dump_header_format->udlinkblockend); break; diff --git a/tools/testfiles/tudlink-2.ddl b/tools/testfiles/tudlink-2.ddl index 7f4281a..82b9f8e 100644 --- a/tools/testfiles/tudlink-2.ddl +++ b/tools/testfiles/tudlink-2.ddl @@ -1,6 +1,5 @@ HDF5 "tudlink.h5" { USERDEFINED_LINK "udlink2" { - USERDEFINED_LINK "udlink2" { LINKCLASS 187 } } -- cgit v0.12 From 7dfe1769248d7f05ded66b4c6b78cb0be5ebee52 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Aug 2019 13:26:22 -0700 Subject: Fixed a bug in the cache image code that was introduced by the HD changes. --- testpar/t_cache_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index e0c8211..14e3d10 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -1187,7 +1187,7 @@ open_hdf5_file(const hbool_t create_file, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { -- cgit v0.12 From 937616872cf228f838fd1eb2853ce6110f3da10b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 27 Aug 2019 14:00:49 -0700 Subject: Minor tweaks to new H5P MPI code based on code review feedback. --- src/H5FDmpio.c | 19 +++++-------------- src/H5mpi.c | 21 ++++++++++++--------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 13efcff..71e9fe1 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -792,20 +792,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - /* Set MPI communicator and info object */ - if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) { - /* Non-parallel defaults */ - if(FAIL == H5_mpi_comm_dup(MPI_COMM_SELF, &comm)) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed") - info = MPI_INFO_NULL; - } - else { - /* Get the MPI communicator and info object from the property list */ - if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") - if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") - } + /* Get the MPI communicator and info object from the property list */ + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") + if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") /* Convert HDF5 flags to MPI-IO flags */ /* Some combinations are illegal; let MPI-IO figure it out */ diff --git a/src/H5mpi.c b/src/H5mpi.c index aec1e03..d48790b 100644 --- a/src/H5mpi.c +++ b/src/H5mpi.c @@ -239,6 +239,9 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result) /* Can't pass MPI_COMM_NULL to MPI_Comm_compare() so we have to handle * it in special cases. + * + * MPI_Comm can either be an integer type or a pointer. We cast them + * to intptr_t so we can compare them with < and > when needed. */ if (MPI_COMM_NULL == comm1 && MPI_COMM_NULL == comm2) { /* Special case of both communicators being MPI_COMM_NULL */ @@ -247,7 +250,7 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result) else if (MPI_COMM_NULL == comm1 || MPI_COMM_NULL == comm2) { /* Special case of one communicator being MPI_COMM_NULL */ - *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1; + *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1; } else { @@ -257,15 +260,11 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result) if (MPI_SUCCESS != (mpi_code = MPI_Comm_compare(comm1, comm2, &mpi_result))) HMPI_GOTO_ERROR(FAIL, "MPI_Comm_compare failed", mpi_code) - /* Set the result - * - * The else clause should work regardless of whether MPI_Datatype is - * fundamentally an integer or a pointer. - */ + /* Set the result */ if (MPI_IDENT == mpi_result || MPI_CONGRUENT == mpi_result) *result = 0; else - *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1; + *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1; } done: @@ -372,11 +371,15 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) } /* end else */ } /* end else */ - /* Set the output value */ + /* Set the output value + * + * MPI_Info can either be an integer type or a pointer. We cast them + * to intptr_t so we can compare them with < and > when needed. + */ if (same) *result = 0; else - *result = (MPI_Datatype)info1 < (MPI_Datatype)info2 ? -1 : 1; + *result = (intptr_t)info1 < (intptr_t)info2 ? -1 : 1; done: if (key) -- cgit v0.12 From 09d13b3c13dfc3fa79a7d616d80a06183fb05cc9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 27 Aug 2019 16:49:10 -0500 Subject: OESS-29 Fix HD prefix in perform and enable test compile --- java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 6 +- testpar/CMakeLists.txt | 2 +- testpar/CMakeTests.cmake | 3 + tools/test/perform/iopipe.c | 14 +- tools/test/perform/overhead.c | 6 +- tools/test/perform/perf_meta.c | 28 +- tools/test/perform/pio_engine.c | 90 +++--- tools/test/perform/pio_perf.c | 320 ++++++++++----------- tools/test/perform/pio_standalone.h | 2 + tools/test/perform/sio_engine.c | 46 +-- tools/test/perform/sio_perf.c | 234 +++++++-------- tools/test/perform/sio_standalone.h | 2 + 12 files changed, 380 insertions(+), 373 deletions(-) diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index f56a038..c13473c 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -17,7 +17,7 @@ package hdf.hdf5lib.structs; import java.io.Serializable; /* - * Java representation of the HDFS VFD file access property list (fapl) + * Java representation of the HDFS VFD file access property list (fapl) * structure. * * Used for the access of files hosted on the Hadoop Distributed File System. @@ -33,7 +33,7 @@ public class H5FD_hdfs_fapl_t implements Serializable { private int namenode_port; private int stream_buffer_size; - /** + /* * Create a fapl_t structure with the specified components. */ public H5FD_hdfs_fapl_t( @@ -91,7 +91,7 @@ public class H5FD_hdfs_fapl_t implements Serializable { public String toString() { return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" + "\n namenode_name: '" + this.namenode_name + - "'\n namenode_port: " + this.namenode_port + + "'\n namenode_port: " + this.namenode_port + "\n user_name: '" + this.user_name + "'\n kerberos_ticket_cache: '" + this.kerberos_ticket_cache + "'\n stream_buffer_size: " + this.stream_buffer_size + diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 1aecef6..47a0e15 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -61,7 +61,7 @@ set (H5P_TESTS t_mpi t_bigio t_cache - #t_cache_image + t_cache_image t_pflush1 t_pflush2 t_pread diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index ad244b5..5848c60 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -72,6 +72,9 @@ endforeach () # list (REMOVE_ITEM H5P_TESTS t_shapesame) #endif () +# do not test until new version is added +list (REMOVE_ITEM H5P_TESTS t_cache_image) + set (test_par_CLEANFILES t_cache_image_00.h5 t_cache_image_01.h5 diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c index eac099b..2d9c44f 100644 --- a/tools/test/perform/iopipe.c +++ b/tools/test/perform/iopipe.c @@ -224,7 +224,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "fill raw"); + HDfprintf (stderr, HEADING, "fill raw"); for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -262,7 +262,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "fill hdf5"); + HDfprintf (stderr, HEADING, "fill hdf5"); for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -301,7 +301,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "out raw"); + HDfprintf (stderr, HEADING, "out raw"); for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -341,7 +341,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "out hdf5"); + HDfprintf (stderr, HEADING, "out hdf5"); for(u = 0; u < nwrite; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -380,7 +380,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "in raw"); + HDfprintf (stderr, HEADING, "in raw"); for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -421,7 +421,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "in hdf5"); + HDfprintf (stderr, HEADING, "in hdf5"); for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); HDfflush(stderr); @@ -465,7 +465,7 @@ main (void) _ftime(tbstart); #endif #endif - fprintf (stderr, HEADING, "in hdf5 partial"); + HDfprintf (stderr, HEADING, "in hdf5 partial"); for(u = 0; u < nread; u++) { putc (PROGRESS, stderr); HDfflush(stderr); diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c index 81f9de6..108d9e4 100644 --- a/tools/test/perform/overhead.c +++ b/tools/test/perform/overhead.c @@ -84,9 +84,9 @@ typedef enum fill_t { static void usage(const char *prog) { - fprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", + HDfprintf(stderr, "usage: %s [STYLE|cache] [LEFT [MIDDLE [RIGHT]]]\n", prog); - fprintf(stderr, "\ + HDfprintf(stderr, "\ STYLE is the order that the dataset is filled and should be one of:\n\ forward -- Fill the dataset from lowest address to highest\n\ address. This style tests the right split ratio.\n\ @@ -401,6 +401,6 @@ main(int argc, char *argv[]) return 0; error: - fprintf(stderr, "*** ERRORS DETECTED ***\n"); + HDfprintf(stderr, "*** ERRORS DETECTED ***\n"); return 1; } diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c index c24e598..b56f074 100644 --- a/tools/test/perform/perf_meta.c +++ b/tools/test/perform/perf_meta.c @@ -313,7 +313,7 @@ create_dsets(hid_t file) * Create a dataset using the default dataset creation properties. */ for(i = 0; i < NUM_DSETS; i++) { - sprintf(dset_name, "dataset %d", i); + HDsprintf(dset_name, "dataset %d", i); if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; @@ -378,14 +378,14 @@ create_attrs_1(void) * Create all(user specifies the number) attributes for each dataset */ for(i = 0; i < NUM_DSETS; i++) { - sprintf(dset_name, "dataset %d", i); + HDsprintf(dset_name, "dataset %d", i); open_t.start = retrieve_time(); if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); for(j = 0; j < NUM_ATTRS; j++) { - sprintf(attr_name, "all attrs for each dset %d", j); + HDsprintf(attr_name, "all attrs for each dset %d", j); attr_t.start = retrieve_time(); if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -422,7 +422,7 @@ create_attrs_1(void) attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS); /* Print out the performance result */ - fprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n", + HDfprintf(stderr, "1. Create %d attributes for each of %d existing datasets\n", NUM_ATTRS, NUM_DSETS); print_perf(open_t, close_t, attr_t); } @@ -480,7 +480,7 @@ create_attrs_2(void) * Create all(user specifies the number) attributes for each new dataset */ for(i = 0; i < NUM_DSETS; i++) { - sprintf(dset_name, "dataset %d", i); + HDsprintf(dset_name, "dataset %d", i); create_t.start = retrieve_time(); if((dataset = H5Dcreate2(file, dset_name, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -488,7 +488,7 @@ create_attrs_2(void) perf(&create_t, create_t.start, retrieve_time()); for(j = 0; j < NUM_ATTRS; j++) { - sprintf(attr_name, "all attrs for each dset %d", j); + HDsprintf(attr_name, "all attrs for each dset %d", j); attr_t.start = retrieve_time(); if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -525,7 +525,7 @@ create_attrs_2(void) attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS); /* Print out the performance result */ - fprintf(stderr, "2. Create %d attributes for each of %d new datasets\n", + HDfprintf(stderr, "2. Create %d attributes for each of %d new datasets\n", NUM_ATTRS, NUM_DSETS); print_perf(create_t, close_t, attr_t); } @@ -593,14 +593,14 @@ create_attrs_3(void) for(i = 0; i < loop_num; i++) { for(j = 0; j < NUM_DSETS; j++) { - sprintf(dset_name, "dataset %d", j); + HDsprintf(dset_name, "dataset %d", j); open_t.start = retrieve_time(); if((dataset = H5Dopen2(file, dset_name, H5P_DEFAULT)) < 0) goto error; perf(&open_t, open_t.start, retrieve_time()); for(k = 0; k < BATCH_ATTRS; k++) { - sprintf(attr_name, "some attrs for each dset %d %d", i, k); + HDsprintf(attr_name, "some attrs for each dset %d %d", i, k); attr_t.start = retrieve_time(); if((attr = H5Acreate2(dataset, attr_name, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -637,7 +637,7 @@ create_attrs_3(void) attr_t.avg = attr_t.total / (NUM_ATTRS*NUM_DSETS); /* Print out the performance result */ - fprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n", + HDfprintf(stderr, "3. Create %d attributes for each of %d existing datasets for %d times\n", BATCH_ATTRS, NUM_DSETS, loop_num); print_perf(open_t, close_t, attr_t); } @@ -750,12 +750,12 @@ void perf(p_time *perf_t, double start_t, double end_t) */ void print_perf(p_time open_t, p_time close_t, p_time attr_t) { - fprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", + HDfprintf(stderr, "\t%s:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", open_t.func, open_t.avg, open_t.max, open_t.min); - fprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", + HDfprintf(stderr, "\tH5Dclose:\t\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", close_t.avg, close_t.max, close_t.min); if(NUM_ATTRS) - fprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", + HDfprintf(stderr, "\tH5A(create & close):\tavg=%.6fs;\tmax=%.6fs;\tmin=%.6fs\n", attr_t.avg, attr_t.max, attr_t.min); } @@ -799,7 +799,7 @@ main(int argc, char **argv) #ifdef H5_HAVE_PARALLEL if (facc_type == FACC_DEFAULT || (facc_type != FACC_DEFAULT && MAINPROCESS)) #endif /*H5_HAVE_PARALLEL*/ - fprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n"); + HDfprintf(stderr, "\t\tPerformance result of metadata for datasets and attributes\n\n"); fapl = H5Pcreate (H5P_FILE_ACCESS); #ifdef H5_HAVE_PARALLEL diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index d47cd43..798e32e 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -61,14 +61,14 @@ #define GOTOERROR(errcode) { ret_code = errcode; goto done; } #define GOTODONE { goto done; } #define ERRMSG(mesg) { \ - fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ - fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ + HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ + HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ } #define MSG(mesg) { \ - fprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ - fprintf(stderr, "(%s) at line %4d in %s\n", \ + HDfprintf(stderr, "Proc %d: ", pio_mpi_rank_g); \ + HDfprintf(stderr, "(%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ } @@ -194,7 +194,7 @@ do_pio(parameters param) break; default: /* unknown request */ - fprintf(stderr, "Unknown IO type request (%d)\n", iot); + HDfprintf(stderr, "Unknown IO type request (%d)\n", iot); GOTOERROR(FAIL); } @@ -213,21 +213,21 @@ do_pio(parameters param) } if (param.num_files < 0 ) { - fprintf(stderr, + HDfprintf(stderr, "number of files must be >= 0 (%ld)\n", param.num_files); GOTOERROR(FAIL); } if (ndsets < 0 ) { - fprintf(stderr, + HDfprintf(stderr, "number of datasets per file must be >= 0 (%ld)\n", ndsets); GOTOERROR(FAIL); } if (param.num_procs <= 0 ) { - fprintf(stderr, + HDfprintf(stderr, "maximum number of process to use must be > 0 (%d)\n", param.num_procs); GOTOERROR(FAIL); @@ -292,7 +292,7 @@ do_pio(parameters param) /* output all of the times for all iterations */ if (myrank == 0) - fprintf(output, "Timer details:\n"); + HDfprintf(output, "Timer details:\n"); } for (nf = 1; nf <= param.num_files; nf++) { @@ -302,7 +302,7 @@ do_pio(parameters param) /* Open file for write */ char base_name[256]; - sprintf(base_name, "#pio_tmp_%lu", nf); + HDsprintf(base_name, "#pio_tmp_%lu", nf); pio_create_filename(iot, base_name, fname, sizeof(fname)); if (pio_debug_level > 0) HDfprintf(output, "rank %d: data filename=%s\n", @@ -385,7 +385,7 @@ done: /* release generic resources */ if(buffer) - free(buffer); + HDfree(buffer); res.ret_code = ret_code; return res; } @@ -620,7 +620,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Prepare buffer for verifying data */ if (parms->verify) - memset(buffer,pio_mpi_rank_g+1,buf_size*blk_size); + HDmemset(buffer,pio_mpi_rank_g+1,buf_size*blk_size); } /* end else */ @@ -853,7 +853,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Create the dataset transfer property list */ h5dxpl = H5Pcreate(H5P_DATASET_XFER); if (h5dxpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } @@ -861,7 +861,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, if(parms->collective) { hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* end if */ } /* end if */ @@ -883,7 +883,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, case PHDF5: h5dcpl = H5Pcreate(H5P_DATASET_CREATE); if (h5dcpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } /* 1D dataspace */ @@ -894,7 +894,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, h5dims[0] = blk_size; hrc = H5Pset_chunk(h5dcpl, 1, h5dims); if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* end if */ } /* end if */ @@ -907,25 +907,25 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, h5dims[1] = blk_size; hrc = H5Pset_chunk(h5dcpl, 2, h5dims); if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* end if */ } /* end if */ }/* end else */ - sprintf(dname, "Dataset_%ld", ndset); + HDsprintf(dname, "Dataset_%ld", ndset); h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl); if (h5ds_id < 0) { - fprintf(stderr, "HDF5 Dataset Create failed\n"); + HDfprintf(stderr, "HDF5 Dataset Create failed\n"); GOTOERROR(FAIL); } hrc = H5Pclose(h5dcpl); /* verifying the close of the dcpl */ if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Property List Close failed\n"); GOTOERROR(FAIL); } break; @@ -1398,7 +1398,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, hrc = H5Dclose(h5ds_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); GOTOERROR(FAIL); } @@ -1455,7 +1455,7 @@ done: if (h5dset_space_id != -1) { hrc = H5Sclose(h5dset_space_id); if (hrc < 0){ - fprintf(stderr, "HDF5 Dataset Space Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { h5dset_space_id = -1; @@ -1465,7 +1465,7 @@ done: if (h5mem_space_id != -1) { hrc = H5Sclose(h5mem_space_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Memory Space Close failed\n"); + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { h5mem_space_id = -1; @@ -1475,7 +1475,7 @@ done: if (h5dxpl != -1) { hrc = H5Pclose(h5dxpl); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { h5dxpl = -1; @@ -1824,7 +1824,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Create the dataset transfer property list */ h5dxpl = H5Pcreate(H5P_DATASET_XFER); if (h5dxpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } @@ -1832,7 +1832,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, if(parms->collective) { hrc = H5Pset_dxpl_mpio(h5dxpl, H5FD_MPIO_COLLECTIVE); if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* end if */ } /* end if */ @@ -1852,10 +1852,10 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, break; case PHDF5: - sprintf(dname, "Dataset_%ld", ndset); + HDsprintf(dname, "Dataset_%ld", ndset); h5ds_id = H5DOPEN(fd->h5fd, dname); if (h5ds_id < 0) { - fprintf(stderr, "HDF5 Dataset open failed\n"); + HDfprintf(stderr, "HDF5 Dataset open failed\n"); GOTOERROR(FAIL); } @@ -2353,7 +2353,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, hrc = H5Dclose(h5ds_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); GOTOERROR(FAIL); } @@ -2410,7 +2410,7 @@ done: if (h5dset_space_id != -1) { hrc = H5Sclose(h5dset_space_id); if (hrc < 0){ - fprintf(stderr, "HDF5 Dataset Space Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { h5dset_space_id = -1; @@ -2420,7 +2420,7 @@ done: if (h5mem_space_id != -1) { hrc = H5Sclose(h5mem_space_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Memory Space Close failed\n"); + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { h5mem_space_id = -1; @@ -2430,7 +2430,7 @@ done: if (h5dxpl != -1) { hrc = H5Pclose(h5dxpl); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { h5dxpl = -1; @@ -2461,7 +2461,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) fd->posixfd = POSIXOPEN(fname, O_RDONLY); if (fd->posixfd < 0 ) { - fprintf(stderr, "POSIX File Open failed(%s)\n", fname); + HDfprintf(stderr, "POSIX File Open failed(%s)\n", fname); GOTOERROR(FAIL); } @@ -2485,7 +2485,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) h5_io_info_g, &fd->mpifd); if (mrc != MPI_SUCCESS) { - fprintf(stderr, "MPI File Open failed(%s)\n", fname); + HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); GOTOERROR(FAIL); } @@ -2493,13 +2493,13 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) /*filesize , set size to 0 explicitedly. */ mrc = MPI_File_set_size(fd->mpifd, (MPI_Offset)0); if (mrc != MPI_SUCCESS) { - fprintf(stderr, "MPI_File_set_size failed\n"); + HDfprintf(stderr, "MPI_File_set_size failed\n"); GOTOERROR(FAIL); } } else { mrc = MPI_File_open(pio_comm_g, fname, MPI_MODE_RDONLY, h5_io_info_g, &fd->mpifd); if (mrc != MPI_SUCCESS) { - fprintf(stderr, "MPI File Open failed(%s)\n", fname); + HDfprintf(stderr, "MPI File Open failed(%s)\n", fname); GOTOERROR(FAIL); } } @@ -2508,19 +2508,19 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) case PHDF5: if ((acc_tpl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } /* Set the file driver to the MPI-IO driver */ if (H5Pset_fapl_mpio(acc_tpl, pio_comm_g, h5_io_info_g) < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* Set the alignment of objects in HDF5 file */ if (H5Pset_alignment(acc_tpl, param->h5_thresh, param->h5_align) < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } @@ -2530,13 +2530,13 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) else fd->h5fd = H5Fopen(fname, H5F_ACC_RDONLY, acc_tpl); if (fd->h5fd < 0) { - fprintf(stderr, "HDF5 File Create failed(%s)\n", fname); + HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); GOTOERROR(FAIL); } /* verifying the close of the acc_tpl */ if (H5Pclose(acc_tpl) < 0) { - fprintf(stderr, "HDF5 Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Property List Close failed\n"); GOTOERROR(FAIL); } @@ -2565,7 +2565,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) rc = POSIXCLOSE(fd->posixfd); if (rc != 0){ - fprintf(stderr, "POSIX File Close failed\n"); + HDfprintf(stderr, "POSIX File Close failed\n"); GOTOERROR(FAIL); } @@ -2576,7 +2576,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) mrc = MPI_File_close(&fd->mpifd); if (mrc != MPI_SUCCESS){ - fprintf(stderr, "MPI File close failed\n"); + HDfprintf(stderr, "MPI File close failed\n"); GOTOERROR(FAIL); } @@ -2587,7 +2587,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) hrc = H5Fclose(fd->h5fd); if (hrc < 0) { - fprintf(stderr, "HDF5 File Close failed\n"); + HDfprintf(stderr, "HDF5 File Close failed\n"); GOTOERROR(FAIL); } @@ -2621,7 +2621,7 @@ do_cleanupfile(iotype iot, char *fname) if (clean_file_g){ switch (iot){ case POSIXIO: - remove(fname); + HDremove(fname); break; case MPIO: case PHDF5: diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 597629e..93741c4 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -277,13 +277,13 @@ struct options { unsigned interleaved; /* Interleaved vs. contiguous blocks */ unsigned collective; /* Collective vs. independent I/O */ unsigned dim2d; /* 1D vs. 2D geometry */ - int print_times; /* print times as well as throughputs */ - int print_raw; /* print raw data throughput info */ + int print_times; /* print times as well as throughputs */ + int print_raw; /* print raw data throughput info */ off_t h5_alignment; /* alignment in HDF5 file */ off_t h5_threshold; /* threshold for alignment in HDF5 file */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int verify; /* Verify data correctness */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int verify; /* Verify data correctness */ }; typedef struct _minmax { @@ -339,12 +339,12 @@ main(int argc, char **argv) ret = MPI_Comm_size(MPI_COMM_WORLD, &comm_world_nprocs_g); if (ret != MPI_SUCCESS) { - fprintf(stderr, "%s: MPI_Comm_size call failed\n", progname); + HDfprintf(stderr, "%s: MPI_Comm_size call failed\n", progname); if (ret == MPI_ERR_COMM) - fprintf(stderr, "invalid MPI communicator\n"); + HDfprintf(stderr, "invalid MPI communicator\n"); else - fprintf(stderr, "invalid argument\n"); + HDfprintf(stderr, "invalid argument\n"); exit_value = EXIT_FAILURE; goto finish; @@ -353,12 +353,12 @@ main(int argc, char **argv) ret = MPI_Comm_rank(MPI_COMM_WORLD, &comm_world_rank_g); if (ret != MPI_SUCCESS) { - fprintf(stderr, "%s: MPI_Comm_rank call failed\n", progname); + HDfprintf(stderr, "%s: MPI_Comm_rank call failed\n", progname); if (ret == MPI_ERR_COMM) - fprintf(stderr, "invalid MPI communicator\n"); + HDfprintf(stderr, "invalid MPI communicator\n"); else - fprintf(stderr, "invalid argument\n"); + HDfprintf(stderr, "invalid argument\n"); exit_value = EXIT_FAILURE; goto finish; @@ -376,7 +376,7 @@ main(int argc, char **argv) if (opts->output_file) { if ((output = HDfopen(opts->output_file, "w")) == NULL) { - fprintf(stderr, "%s: cannot open output file\n", progname); + HDfprintf(stderr, "%s: cannot open output file\n", progname); perror(opts->output_file); goto finish; } @@ -667,7 +667,7 @@ run_test(iotype iot, parameters parms, struct options *opts) /* * Show various statistics */ - /* Write statistics */ + /* Write statistics */ /* Print the raw data throughput if desired */ if (opts->print_raw) { /* accumulate and output the max, min, and average "raw write" times */ @@ -733,7 +733,7 @@ run_test(iotype iot, parameters parms, struct options *opts) } if (!parms.h5_write_only) { - /* Read statistics */ + /* Read statistics */ /* Print the raw data throughput if desired */ if (opts->print_raw) { /* accumulate and output the max, min, and average "raw read" times */ @@ -925,7 +925,7 @@ create_comm_world(int num_procs, int *doing_pio) MPI_Comm_size(MPI_COMM_WORLD, &nprocs); if (num_procs > nprocs) { - fprintf(stderr, + HDfprintf(stderr, "number of process(%d) must be <= number of processes in MPI_COMM_WORLD(%d)\n", num_procs, nprocs); goto error_done; @@ -936,7 +936,7 @@ create_comm_world(int num_procs, int *doing_pio) mrc = MPI_Comm_split(MPI_COMM_WORLD, color, myrank, &pio_comm_g); if (mrc != MPI_SUCCESS) { - fprintf(stderr, "MPI_Comm_split failed\n"); + HDfprintf(stderr, "MPI_Comm_split failed\n"); goto error_done; } @@ -1065,9 +1065,9 @@ output_report(const char *fmt, ...) if (myrank == 0) { va_list ap; - va_start(ap, fmt); - vfprintf(output, fmt, ap); - va_end(ap); + HDva_start(ap, fmt); + HDvfprintf(output, fmt, ap); + HDva_end(ap); } } @@ -1087,10 +1087,10 @@ print_indent(register int indent) MPI_Comm_rank(pio_comm_g, &myrank); if (myrank == 0) { - indent *= TAB_SPACE; + indent *= TAB_SPACE; - for (; indent > 0; --indent) - fputc(' ', output); + for (; indent > 0; --indent) + HDfputc(' ', output); } } @@ -1115,11 +1115,11 @@ static void print_io_api(long io_types) { if (io_types & PIO_POSIX) - HDfprintf(output, "posix "); + HDfprintf(output, "posix "); if (io_types & PIO_MPI) - HDfprintf(output, "mpiio "); + HDfprintf(output, "mpiio "); if (io_types & PIO_HDF5) - HDfprintf(output, "phdf5 "); + HDfprintf(output, "phdf5 "); HDfprintf(output, "\n"); } @@ -1128,7 +1128,7 @@ report_parameters(struct options *opts) { int rank = comm_world_rank_g; - print_version("HDF5 Library"); /* print library version */ + print_version("HDF5 Library"); /* print library version */ HDfprintf(output, "rank %d: ==== Parameters ====\n", rank); HDfprintf(output, "rank %d: IO API=", rank); @@ -1303,9 +1303,9 @@ parse_command_line(int argc, char *argv[]) } else if (!HDstrcasecmp(buf, "posix")) { cl_opts->io_types |= PIO_POSIX; } else { - fprintf(stderr, "pio_perf: invalid --api option %s\n", + HDfprintf(stderr, "pio_perf: invalid --api option %s\n", buf); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if (*end == '\0') @@ -1345,17 +1345,17 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; - if (strlen(buf) > 1 || isdigit(buf[0])) { + if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { size_t j; for (j = 0; j < 10 && buf[j] != '\0'; ++j) if (!isdigit(buf[j])) { - fprintf(stderr, "pio_perf: invalid --debug option %s\n", + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } pio_debug_level = atoi(buf); @@ -1379,8 +1379,8 @@ parse_command_line(int argc, char *argv[]) cl_opts->verify = TRUE; break; default: - fprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); - exit(EXIT_FAILURE); + HDfprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); } } @@ -1396,13 +1396,13 @@ parse_command_line(int argc, char *argv[]) cl_opts->num_bpp = parse_size_directive(opt_arg); break; case 'F': - cl_opts->num_files = atoi(opt_arg); + cl_opts->num_files = HDatoi(opt_arg); break; case 'g': cl_opts->dim2d = 1; break; case 'i': - cl_opts->num_iters = atoi(opt_arg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'I': cl_opts->interleaved = 1; @@ -1411,10 +1411,10 @@ parse_command_line(int argc, char *argv[]) cl_opts->output_file = opt_arg; break; case 'p': - cl_opts->min_num_procs = atoi(opt_arg); + cl_opts->min_num_procs = HDatoi(opt_arg); break; case 'P': - cl_opts->max_num_procs = atoi(opt_arg); + cl_opts->max_num_procs = HDatoi(opt_arg); break; case 'T': cl_opts->h5_threshold = parse_size_directive(opt_arg); @@ -1432,7 +1432,7 @@ parse_command_line(int argc, char *argv[]) case '?': default: usage(progname); - free(cl_opts); + HDfree(cl_opts); return NULL; } } @@ -1526,8 +1526,8 @@ parse_size_directive(const char *size) s *= ONE_GB; break; default: - fprintf(stderr, "Illegal size specifier '%c'\n", *endptr); - exit(EXIT_FAILURE); + HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); + HDexit(EXIT_FAILURE); } } @@ -1540,7 +1540,7 @@ parse_size_directive(const char *size) * Return: Nothing * Programmer: Bill Wendling, 31. October 2001 * Modifications: - * Added 2D testing (Christian Chilan, 10. August 2005) + * Added 2D testing (Christian Chilan, 10. August 2005) */ static void usage(const char *prog) @@ -1550,125 +1550,125 @@ usage(const char *prog) MPI_Comm_rank(pio_comm_g, &myrank); if (myrank == 0) { - print_version(prog); - printf("usage: %s [OPTIONS]\n", prog); - printf(" OPTIONS\n"); - printf(" -h, --help Print a usage message and exit\n"); - printf(" -a S, --align=S Alignment of objects in HDF5 file [default: 1]\n"); - printf(" -A AL, --api=AL Which APIs to test [default: all of them]\n"); + print_version(prog); + HDprintf("usage: %s [OPTIONS]\n", prog); + HDprintf(" OPTIONS\n"); + HDprintf(" -h, --help Print a usage message and exit\n"); + HDprintf(" -a S, --align=S Alignment of objects in HDF5 file [default: 1]\n"); + HDprintf(" -A AL, --api=AL Which APIs to test [default: all of them]\n"); #if 0 - printf(" -b, --binary The elusive binary option\n"); + HDprintf(" -b, --binary The elusive binary option\n"); #endif /* 0 */ - printf(" -B S, --block-size=S Block size within transfer buffer\n"); - printf(" (see below for description)\n"); - printf(" [default: half the number of bytes per process\n"); - printf(" per dataset]\n"); - printf(" -c, --chunk Create HDF5 datasets using chunked storage\n"); - printf(" [default: contiguous storage]\n"); - printf(" -C, --collective Use collective I/O for MPI and HDF5 APIs\n"); - printf(" [default: independent I/O)\n"); - printf(" -d N, --num-dsets=N Number of datasets per file [default: 1]\n"); - printf(" -D DL, --debug=DL Indicate the debugging level\n"); - printf(" [default: no debugging]\n"); - printf(" -e S, --num-bytes=S Number of bytes per process per dataset\n"); - printf(" (see below for description)\n"); - printf(" [default: 256K for 1D, 8K for 2D]\n"); - printf(" -F N, --num-files=N Number of files [default: 1]\n"); - printf(" -g, --geometry Use 2D geometry [default: 1D geometry]\n"); - printf(" -i N, --num-iterations=N Number of iterations to perform [default: 1]\n"); - printf(" -I, --interleaved Interleaved access pattern\n"); - printf(" (see below for example)\n"); - printf(" [default: Contiguous access pattern]\n"); - printf(" -o F, --output=F Output raw data into file F [default: none]\n"); - printf(" -p N, --min-num-processes=N Minimum number of processes to use [default: 1]\n"); - printf(" -P N, --max-num-processes=N Maximum number of processes to use\n"); - printf(" [default: all MPI_COMM_WORLD processes ]\n"); - printf(" -T S, --threshold=S Threshold for alignment of objects in HDF5 file\n"); - printf(" [default: 1]\n"); - printf(" -w, --write-only Perform write tests not the read tests\n"); - printf(" -x S, --min-xfer-size=S Minimum transfer buffer size\n"); - printf(" (see below for description)\n"); - printf(" [default: half the number of bytes per process\n"); - printf(" per dataset]\n"); - printf(" -X S, --max-xfer-size=S Maximum transfer buffer size\n"); - printf(" [default: the number of bytes per process per\n"); - printf(" dataset]\n"); - printf("\n"); - printf(" F - is a filename.\n"); - printf(" N - is an integer >=0.\n"); - printf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); - printf(" K - Kilobyte (%d)\n", ONE_KB); - printf(" M - Megabyte (%d)\n", ONE_MB); - printf(" G - Gigabyte (%d)\n", ONE_GB); - printf("\n"); - printf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB); - printf("\n"); - printf(" AL - is an API list. Valid values are:\n"); - printf(" phdf5 - Parallel HDF5\n"); - printf(" mpiio - MPI-I/O\n"); - printf(" posix - POSIX\n"); - printf("\n"); - printf(" Example: --api=mpiio,phdf5\n"); - printf("\n"); - printf(" Dataset size:\n"); - printf(" Depending on the selected geometry, each test dataset is either a linear\n"); - printf(" array of size bytes-per-process * num-processes, or a square array of size\n"); - printf(" (bytes-per-process * num-processes) x (bytes-per-process * num-processes).\n"); - printf("\n"); - printf(" Block size vs. Transfer buffer size:\n"); - printf(" buffer-size controls the size of the memory buffer, which is broken into\n"); - printf(" blocks and written to the file. Depending on the selected geometry, each\n"); - printf(" block can be a linear array of size block-size or a square array of size\n"); - printf(" block-size x block-size. The arrangement in which blocks are written is\n"); - printf(" determined by the access pattern.\n"); - printf("\n"); - printf(" In 1D geometry, the transfer buffer is a linear array of size buffer-size.\n"); - printf(" In 2D geometry, it is a rectangular array of size block-size x buffer-size\n"); - printf(" or buffer-size x block-size if interleaved pattern is selected.\n"); - printf("\n"); - printf(" Interleaved and Contiguous patterns in 1D geometry:\n"); - printf(" When contiguous access pattern is chosen, the dataset is evenly divided\n"); - printf(" into num-processes regions and each process writes data to its own region.\n"); - printf(" When interleaved blocks are written to a dataset, space for the first\n"); - printf(" block of the first process is allocated in the dataset, then space is\n"); - printf(" allocated for the first block of the second process, etc. until space is\n"); - printf(" allocated for the first block of each process, then space is allocated for\n"); - printf(" the second block of the first process, the second block of the second\n"); - printf(" process, etc.\n"); - printf("\n"); - printf(" For example, with a 3 process run, 512KB bytes-per-process, 256KB transfer\n"); - printf(" buffer size, and 64KB block size, each process must issue 2 transfer\n"); - printf(" requests to complete access to the dataset.\n"); - printf(" Contiguous blocks of the first transfer request are written like so:\n"); - printf(" 1111----2222----3333----\n"); - printf(" Interleaved blocks of the first transfer request are written like so:\n"); - printf(" 123123123123------------\n"); - printf(" The actual number of I/O operations involved in a transfer request\n"); - printf(" depends on the access pattern and communication mode.\n"); - printf(" When using independent I/O with interleaved pattern, each process\n"); - printf(" performs 4 small non-contiguous I/O operations per transfer request.\n"); - printf(" If collective I/O is turned on, the combined content of the buffers of\n"); - printf(" the 3 processes will be written using one collective I/O operation\n"); - printf(" per transfer request.\n"); - printf("\n"); - printf(" For information about access patterns in 2D geometry, please refer to the\n"); - printf(" HDF5 Reference Manual.\n"); - printf("\n"); - printf(" DL - is a list of debugging flags. Valid values are:\n"); - printf(" 1 - Minimal\n"); - printf(" 2 - Not quite everything\n"); - printf(" 3 - Everything\n"); - printf(" 4 - The kitchen sink\n"); - printf(" r - Raw data I/O throughput information\n"); - printf(" t - Times as well as throughputs\n"); - printf(" v - Verify data correctness\n"); - printf("\n"); - printf(" Example: --debug=2,r,t\n"); - printf("\n"); - printf(" Environment variables:\n"); - printf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); - printf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n"); - printf(" HDF5_PARAPREFIX Paralllel data files prefix\n"); + HDprintf(" -B S, --block-size=S Block size within transfer buffer\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: half the number of bytes per process\n"); + HDprintf(" per dataset]\n"); + HDprintf(" -c, --chunk Create HDF5 datasets using chunked storage\n"); + HDprintf(" [default: contiguous storage]\n"); + HDprintf(" -C, --collective Use collective I/O for MPI and HDF5 APIs\n"); + HDprintf(" [default: independent I/O)\n"); + HDprintf(" -d N, --num-dsets=N Number of datasets per file [default: 1]\n"); + HDprintf(" -D DL, --debug=DL Indicate the debugging level\n"); + HDprintf(" [default: no debugging]\n"); + HDprintf(" -e S, --num-bytes=S Number of bytes per process per dataset\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: 256K for 1D, 8K for 2D]\n"); + HDprintf(" -F N, --num-files=N Number of files [default: 1]\n"); + HDprintf(" -g, --geometry Use 2D geometry [default: 1D geometry]\n"); + HDprintf(" -i N, --num-iterations=N Number of iterations to perform [default: 1]\n"); + HDprintf(" -I, --interleaved Interleaved access pattern\n"); + HDprintf(" (see below for example)\n"); + HDprintf(" [default: Contiguous access pattern]\n"); + HDprintf(" -o F, --output=F Output raw data into file F [default: none]\n"); + HDprintf(" -p N, --min-num-processes=N Minimum number of processes to use [default: 1]\n"); + HDprintf(" -P N, --max-num-processes=N Maximum number of processes to use\n"); + HDprintf(" [default: all MPI_COMM_WORLD processes ]\n"); + HDprintf(" -T S, --threshold=S Threshold for alignment of objects in HDF5 file\n"); + HDprintf(" [default: 1]\n"); + HDprintf(" -w, --write-only Perform write tests not the read tests\n"); + HDprintf(" -x S, --min-xfer-size=S Minimum transfer buffer size\n"); + HDprintf(" (see below for description)\n"); + HDprintf(" [default: half the number of bytes per process\n"); + HDprintf(" per dataset]\n"); + HDprintf(" -X S, --max-xfer-size=S Maximum transfer buffer size\n"); + HDprintf(" [default: the number of bytes per process per\n"); + HDprintf(" dataset]\n"); + HDprintf("\n"); + HDprintf(" F - is a filename.\n"); + HDprintf(" N - is an integer >=0.\n"); + HDprintf(" S - is a size specifier, an integer >=0 followed by a size indicator:\n"); + HDprintf(" K - Kilobyte (%d)\n", ONE_KB); + HDprintf(" M - Megabyte (%d)\n", ONE_MB); + HDprintf(" G - Gigabyte (%d)\n", ONE_GB); + HDprintf("\n"); + HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB); + HDprintf("\n"); + HDprintf(" AL - is an API list. Valid values are:\n"); + HDprintf(" phdf5 - Parallel HDF5\n"); + HDprintf(" mpiio - MPI-I/O\n"); + HDprintf(" posix - POSIX\n"); + HDprintf("\n"); + HDprintf(" Example: --api=mpiio,phdf5\n"); + HDprintf("\n"); + HDprintf(" Dataset size:\n"); + HDprintf(" Depending on the selected geometry, each test dataset is either a linear\n"); + HDprintf(" array of size bytes-per-process * num-processes, or a square array of size\n"); + HDprintf(" (bytes-per-process * num-processes) x (bytes-per-process * num-processes).\n"); + HDprintf("\n"); + HDprintf(" Block size vs. Transfer buffer size:\n"); + HDprintf(" buffer-size controls the size of the memory buffer, which is broken into\n"); + HDprintf(" blocks and written to the file. Depending on the selected geometry, each\n"); + HDprintf(" block can be a linear array of size block-size or a square array of size\n"); + HDprintf(" block-size x block-size. The arrangement in which blocks are written is\n"); + HDprintf(" determined by the access pattern.\n"); + HDprintf("\n"); + HDprintf(" In 1D geometry, the transfer buffer is a linear array of size buffer-size.\n"); + HDprintf(" In 2D geometry, it is a rectangular array of size block-size x buffer-size\n"); + HDprintf(" or buffer-size x block-size if interleaved pattern is selected.\n"); + HDprintf("\n"); + HDprintf(" Interleaved and Contiguous patterns in 1D geometry:\n"); + HDprintf(" When contiguous access pattern is chosen, the dataset is evenly divided\n"); + HDprintf(" into num-processes regions and each process writes data to its own region.\n"); + HDprintf(" When interleaved blocks are written to a dataset, space for the first\n"); + HDprintf(" block of the first process is allocated in the dataset, then space is\n"); + HDprintf(" allocated for the first block of the second process, etc. until space is\n"); + HDprintf(" allocated for the first block of each process, then space is allocated for\n"); + HDprintf(" the second block of the first process, the second block of the second\n"); + HDprintf(" process, etc.\n"); + HDprintf("\n"); + HDprintf(" For example, with a 3 process run, 512KB bytes-per-process, 256KB transfer\n"); + HDprintf(" buffer size, and 64KB block size, each process must issue 2 transfer\n"); + HDprintf(" requests to complete access to the dataset.\n"); + HDprintf(" Contiguous blocks of the first transfer request are written like so:\n"); + HDprintf(" 1111----2222----3333----\n"); + HDprintf(" Interleaved blocks of the first transfer request are written like so:\n"); + HDprintf(" 123123123123------------\n"); + HDprintf(" The actual number of I/O operations involved in a transfer request\n"); + HDprintf(" depends on the access pattern and communication mode.\n"); + HDprintf(" When using independent I/O with interleaved pattern, each process\n"); + HDprintf(" performs 4 small non-contiguous I/O operations per transfer request.\n"); + HDprintf(" If collective I/O is turned on, the combined content of the buffers of\n"); + HDprintf(" the 3 processes will be written using one collective I/O operation\n"); + HDprintf(" per transfer request.\n"); + HDprintf("\n"); + HDprintf(" For information about access patterns in 2D geometry, please refer to the\n"); + HDprintf(" HDF5 Reference Manual.\n"); + HDprintf("\n"); + HDprintf(" DL - is a list of debugging flags. Valid values are:\n"); + HDprintf(" 1 - Minimal\n"); + HDprintf(" 2 - Not quite everything\n"); + HDprintf(" 3 - Everything\n"); + HDprintf(" 4 - The kitchen sink\n"); + HDprintf(" r - Raw data I/O throughput information\n"); + HDprintf(" t - Times as well as throughputs\n"); + HDprintf(" v - Verify data correctness\n"); + HDprintf("\n"); + HDprintf(" Example: --debug=2,r,t\n"); + HDprintf("\n"); + HDprintf(" Environment variables:\n"); + HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); + HDprintf(" HDF5_MPI_INFO MPI INFO object key=value separated by ;\n"); + HDprintf(" HDF5_PARAPREFIX Paralllel data files prefix\n"); fflush(stdout); } /* end if */ } /* end usage() */ @@ -1685,7 +1685,7 @@ usage(const char *prog) int main(void) { - printf("No parallel IO performance because parallel is not configured\n"); + HDprintf("No parallel IO performance because parallel is not configured\n"); return EXIT_SUCCESS; } /* end main */ diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index a40cff8..e6db2e8 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -294,6 +294,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDpipe(F) pipe(F) #define HDpow(X,Y) pow(X,Y) /* printf() variable arguments */ +#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__) #define HDputc(C,F) putc(C,F) #define HDputchar(C) putchar(C) #define HDputs(S) puts(S) @@ -355,6 +356,7 @@ H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); #define HDsnprintf snprintf /*varargs*/ #endif /* sprintf() variable arguments */ +#define HDsprintf sprintf /*varargs*/ #define HDsqrt(X) sqrt(X) #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index aefd2b3..488f575 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -41,7 +41,7 @@ #define GOTOERROR(errcode) { ret_code = errcode; goto done; } #define ERRMSG(mesg) { \ - fprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ + HDfprintf(stderr, "*** Assertion failed (%s) at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ } @@ -198,7 +198,7 @@ do_sio(parameters param, results *res) if (sio_debug_level >= 4) /* output all of the times for all iterations */ - fprintf(output, "Timer details:\n"); + HDfprintf(output, "Timer details:\n"); /* * Write performance measurement @@ -490,7 +490,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Create the dataset transfer property list */ h5dxpl = H5Pcreate(H5P_DATASET_XFER); if (h5dxpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } @@ -512,7 +512,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) h5dcpl = H5Pcreate(H5P_DATASET_CREATE); if (h5dcpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } @@ -520,12 +520,12 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Set the chunk size to be the same as the buffer size */ hrc = H5Pset_chunk(h5dcpl, rank, h5chunk); if (hrc < 0) { - fprintf(stderr, "HDF5 Property List Set failed\n"); + HDfprintf(stderr, "HDF5 Property List Set failed\n"); GOTOERROR(FAIL); } /* end if */ } /* end if */ - sprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); + HDsprintf(dname, "Dataset_%ld", (unsigned long)parms->num_bytes); h5ds_id = H5Dcreate2(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, H5P_DEFAULT, h5dcpl, H5P_DEFAULT); @@ -556,7 +556,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) hrc = dset_write(rank-1, fd, parms, buffer); if (hrc < 0) { - fprintf(stderr, "Error in dataset write\n"); + HDfprintf(stderr, "Error in dataset write\n"); GOTOERROR(FAIL); } @@ -571,7 +571,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) hrc = H5Dclose(h5ds_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); GOTOERROR(FAIL); } @@ -584,7 +584,7 @@ done: if (h5dset_space_id != -1) { hrc = H5Sclose(h5dset_space_id); if (hrc < 0){ - fprintf(stderr, "HDF5 Dataset Space Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { h5dset_space_id = -1; @@ -594,7 +594,7 @@ done: if (h5mem_space_id != -1) { hrc = H5Sclose(h5mem_space_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Memory Space Close failed\n"); + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { h5mem_space_id = -1; @@ -604,7 +604,7 @@ done: if (h5dxpl != -1) { hrc = H5Pclose(h5dxpl); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { h5dxpl = -1; @@ -837,7 +837,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) /* Create the dataset transfer property list */ h5dxpl = H5Pcreate(H5P_DATASET_XFER); if (h5dxpl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } break; @@ -856,7 +856,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) break; case HDF5: - sprintf(dname, "Dataset_%ld", (long)parms->num_bytes); + HDsprintf(dname, "Dataset_%ld", (long)parms->num_bytes); h5ds_id = H5Dopen2(fd->h5fd, dname, H5P_DEFAULT); if (h5ds_id < 0) { HDfprintf(stderr, "HDF5 Dataset open failed\n"); @@ -876,7 +876,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { - fprintf(stderr, "Error in dataset read\n"); + HDfprintf(stderr, "Error in dataset read\n"); GOTOERROR(FAIL); } @@ -890,7 +890,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) hrc = H5Dclose(h5ds_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Close failed\n"); GOTOERROR(FAIL); } @@ -903,7 +903,7 @@ done: if (h5dset_space_id != -1) { hrc = H5Sclose(h5dset_space_id); if (hrc < 0){ - fprintf(stderr, "HDF5 Dataset Space Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Space Close failed\n"); ret_code = FAIL; } else { h5dset_space_id = -1; @@ -913,7 +913,7 @@ done: if (h5mem_space_id != -1) { hrc = H5Sclose(h5mem_space_id); if (hrc < 0) { - fprintf(stderr, "HDF5 Memory Space Close failed\n"); + HDfprintf(stderr, "HDF5 Memory Space Close failed\n"); ret_code = FAIL; } else { h5mem_space_id = -1; @@ -923,7 +923,7 @@ done: if (h5dxpl != -1) { hrc = H5Pclose(h5dxpl); if (hrc < 0) { - fprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); + HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n"); ret_code = FAIL; } else { h5dxpl = -1; @@ -1089,7 +1089,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) fapl = set_vfd(param); if (fapl < 0) { - fprintf(stderr, "HDF5 Property List Create failed\n"); + HDfprintf(stderr, "HDF5 Property List Create failed\n"); GOTOERROR(FAIL); } @@ -1110,7 +1110,7 @@ do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags) if (fd->h5fd < 0) { - fprintf(stderr, "HDF5 File Create failed(%s)\n", fname); + HDfprintf(stderr, "HDF5 File Create failed(%s)\n", fname); GOTOERROR(FAIL); } break; @@ -1176,7 +1176,7 @@ set_vfd(parameters *param) HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES); for (mt=H5FD_MEM_DEFAULT; mtposixfd); if (rc != 0){ - fprintf(stderr, "POSIX File Close failed\n"); + HDfprintf(stderr, "POSIX File Close failed\n"); GOTOERROR(FAIL); } @@ -1236,7 +1236,7 @@ do_fclose(iotype iot, file_descr *fd /*out*/) hrc = H5Fclose(fd->h5fd); if (hrc < 0) { - fprintf(stderr, "HDF5 File Close failed\n"); + HDfprintf(stderr, "HDF5 File Close failed\n"); GOTOERROR(FAIL); } diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index 731be47..ff9e2b4 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -281,14 +281,14 @@ struct options { int buf_rank; /* Rank */ int order_rank; /* Rank */ int chk_rank; /* Rank */ - int print_times; /* print times as well as throughputs */ - int print_raw; /* print raw data throughput info */ + int print_times; /* print times as well as throughputs */ + int print_raw; /* print raw data throughput info */ hsize_t h5_alignment; /* alignment in HDF5 file */ hsize_t h5_threshold; /* threshold for alignment in HDF5 file */ - int h5_use_chunks; /* Make HDF5 dataset chunked */ - int h5_write_only; /* Perform the write tests only */ - int h5_extendable; /* Perform the write tests only */ - int verify; /* Verify data correctness */ + int h5_use_chunks; /* Make HDF5 dataset chunked */ + int h5_write_only; /* Perform the write tests only */ + int h5_extendable; /* Perform the write tests only */ + int verify; /* Verify data correctness */ vfdtype vfd; /* File driver */ size_t page_buffer_size; size_t page_size; @@ -333,7 +333,7 @@ main(int argc, char **argv) /* Initialize h5tools lib */ h5tools_init(); #endif - + output = stdout; opts = parse_command_line(argc, argv); @@ -345,8 +345,8 @@ main(int argc, char **argv) if (opts->output_file) { if ((output = HDfopen(opts->output_file, "w")) == NULL) { - fprintf(stderr, "%s: cannot open output file\n", progname); - perror(opts->output_file); + HDfprintf(stderr, "%s: cannot open output file\n", progname); + HDperror(opts->output_file); goto finish; } } @@ -356,7 +356,7 @@ main(int argc, char **argv) run_test_loop(opts); finish: - free(opts); + HDfree(opts); return exit_value; } @@ -385,8 +385,8 @@ static void run_test_loop(struct options *opts) { parameters parms; - int i; - size_t buf_bytes; + int i; + size_t buf_bytes; /* load options into parameter structure */ parms.num_files = opts->num_files; @@ -552,7 +552,7 @@ run_test(iotype iot, parameters parms, struct options *opts) /* * Show various statistics */ - /* Write statistics */ + /* Write statistics */ /* Print the raw data throughput if desired */ if (opts->print_raw) { /* accumulate and output the max, min, and average "raw write" times */ @@ -598,7 +598,7 @@ run_test(iotype iot, parameters parms, struct options *opts) output_results(opts,"Write Open-Close",write_gross_mm_table,parms.num_iters,raw_size); if (!parms.h5_write_only) { - /* Read statistics */ + /* Read statistics */ /* Print the raw data throughput if desired */ if (opts->print_raw) { /* accumulate and output the max, min, and average "raw read" times */ @@ -647,16 +647,16 @@ run_test(iotype iot, parameters parms, struct options *opts) } /* clean up our mess */ - free(write_sys_mm_table); - free(write_mm_table); - free(write_gross_mm_table); - free(write_raw_mm_table); + HDfree(write_sys_mm_table); + HDfree(write_mm_table); + HDfree(write_gross_mm_table); + HDfree(write_raw_mm_table); if (!parms.h5_write_only) { - free(read_sys_mm_table); - free(read_mm_table); - free(read_gross_mm_table); - free(read_raw_mm_table); + HDfree(read_sys_mm_table); + HDfree(read_mm_table); + HDfree(read_gross_mm_table); + HDfree(read_raw_mm_table); } return ret_value; @@ -790,9 +790,9 @@ output_report(const char *fmt, ...) { va_list ap; - va_start(ap, fmt); - vfprintf(output, fmt, ap); - va_end(ap); + HDva_start(ap, fmt); + HDvfprintf(output, fmt, ap); + HDva_end(ap); } /* @@ -806,10 +806,10 @@ output_report(const char *fmt, ...) static void print_indent(register int indent) { - indent *= TAB_SPACE; + indent *= TAB_SPACE; - for (; indent > 0; --indent) - fputc(' ', output); + for (; indent > 0; --indent) + HDfputc(' ', output); } static void @@ -833,9 +833,9 @@ static void print_io_api(long io_types) { if (io_types & SIO_POSIX) - HDfprintf(output, "posix "); + HDfprintf(output, "posix "); if (io_types & SIO_HDF5) - HDfprintf(output, "hdf5 "); + HDfprintf(output, "hdf5 "); HDfprintf(output, "\n"); } @@ -845,7 +845,7 @@ report_parameters(struct options *opts) int i, rank; rank = opts->dset_rank; - print_version("HDF5 Library"); /* print library version */ + print_version("HDF5 Library"); /* print library version */ HDfprintf(output, "==== Parameters ====\n"); HDfprintf(output, "IO API="); @@ -1004,7 +1004,7 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; if (!HDstrcasecmp(buf, "hdf5")) { @@ -1012,9 +1012,9 @@ parse_command_line(int argc, char *argv[]) } else if (!HDstrcasecmp(buf, "posix")) { cl_opts->io_types |= SIO_POSIX; } else { - fprintf(stderr, "sio_perf: invalid --api option %s\n", + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", buf); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } if (*end == '\0') @@ -1043,7 +1043,7 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; cl_opts->chk_size[j] = parse_size_directive(buf); @@ -1071,17 +1071,17 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; - if (strlen(buf) > 1 || isdigit(buf[0])) { + if (HDstrlen(buf) > 1 || HDisdigit(buf[0])) { size_t j; for (j = 0; j < 10 && buf[j] != '\0'; ++j) - if (!isdigit(buf[j])) { - fprintf(stderr, "sio_perf: invalid --debug option %s\n", + if (!HDisdigit(buf[j])) { + HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } sio_debug_level = atoi(buf); @@ -1105,8 +1105,8 @@ parse_command_line(int argc, char *argv[]) cl_opts->verify = TRUE; break; default: - fprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); - exit(EXIT_FAILURE); + HDfprintf(stderr, "sio_perf: invalid --debug option %s\n", buf); + HDexit(EXIT_FAILURE); } } @@ -1129,7 +1129,7 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; cl_opts->dset_size[j] = parse_size_directive(buf); @@ -1147,7 +1147,7 @@ parse_command_line(int argc, char *argv[]) break; case 'i': - cl_opts->num_iters = atoi(opt_arg); + cl_opts->num_iters = HDatoi(opt_arg); break; case 'o': cl_opts->output_file = opt_arg; @@ -1171,9 +1171,9 @@ parse_command_line(int argc, char *argv[]) } else if (!HDstrcasecmp(opt_arg, "direct")) { cl_opts->vfd=direct; } else { - fprintf(stderr, "sio_perf: invalid --api option %s\n", + HDfprintf(stderr, "sio_perf: invalid --api option %s\n", opt_arg); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } break; case 'w': @@ -1193,7 +1193,7 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; cl_opts->buf_size[j] = parse_size_directive(buf); @@ -1221,7 +1221,7 @@ parse_command_line(int argc, char *argv[]) HDmemset(buf, '\0', sizeof(buf)); for (i = 0; *end != '\0' && *end != ','; ++end) - if (isalnum(*end) && i < 10) + if (HDisalnum(*end) && i < 10) buf[i++] = *end; cl_opts->order[j] = (int)parse_size_directive(buf); @@ -1243,7 +1243,7 @@ parse_command_line(int argc, char *argv[]) case '?': default: usage(progname); - free(cl_opts); + HDfree(cl_opts); return NULL; } } @@ -1339,8 +1339,8 @@ parse_size_directive(const char *size) break; default: - fprintf(stderr, "Illegal size specifier '%c'\n", *endptr); - exit(EXIT_FAILURE); + HDfprintf(stderr, "Illegal size specifier '%c'\n", *endptr); + HDexit(EXIT_FAILURE); } } @@ -1357,72 +1357,72 @@ parse_size_directive(const char *size) static void usage(const char *prog) { - print_version(prog); - printf("usage: %s [OPTIONS]\n", prog); - printf(" OPTIONS\n"); - printf(" -h Print an usage message and exit\n"); - printf(" -A AL Which APIs to test\n"); - printf(" [default: all of them]\n"); - printf(" -c SL Selects chunked storage and defines chunks dimensions\n"); - printf(" and sizes\n"); - printf(" [default: Off]\n"); - printf(" -e SL Dimensions and sizes of dataset\n"); - printf(" [default: 100,200]\n"); - printf(" -i N Number of iterations to perform\n"); - printf(" [default: 1]\n"); - printf(" -r NL Dimension access order (see below for description)\n"); - printf(" [default: 1,2]\n"); - printf(" -t Selects extendable dimensions for HDF5 dataset\n"); - printf(" [default: Off]\n"); - printf(" -v VFD Selects file driver for HDF5 access\n"); - printf(" [default: sec2]\n"); - printf(" -w Perform write tests, not the read tests\n"); - printf(" [default: Off]\n"); - printf(" -x SL Dimensions and sizes of the transfer buffer\n"); - printf(" [default: 10,20]\n"); - printf("\n"); - printf(" N - is an integer > 0.\n"); - printf("\n"); - printf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n"); - printf(" K - Kilobyte (%d)\n", ONE_KB); - printf(" M - Megabyte (%d)\n", ONE_MB); - printf(" G - Gigabyte (%d)\n", ONE_GB); - printf("\n"); - printf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB); - printf("\n"); - printf(" AL - is an API list. Valid values are:\n"); - printf(" hdf5 - HDF5\n"); - printf(" posix - POSIX\n"); - printf("\n"); - printf(" Example: -A posix,hdf5\n"); - printf("\n"); - printf(" NL - is list of integers (N) separated by commas.\n"); - printf("\n"); - printf(" Example: 1,2,3\n"); - printf("\n"); - printf(" SL - is list of size specifiers (S) separated by commas.\n"); - printf("\n"); - printf(" Example: 2K,2K,3K\n"); - printf("\n"); - printf(" The example defines an object (dataset, tranfer buffer) with three\n"); - printf(" dimensions. Be aware that as the number of dimensions increases, the\n"); - printf(" the total size of the object increases exponentially.\n"); - printf("\n"); - printf(" VFD - is an HDF5 file driver specifier. Valid values are:\n"); - printf(" sec2, stdio, core, split, multi, family, direct\n"); - printf("\n"); - printf(" Dimension access order:\n"); - printf(" Data access starts at the cardinal origin of the dataset using the\n"); - printf(" transfer buffer. The next access occurs on a dataset region next to\n"); - printf(" the previous one. For a multidimensional dataset, there are several\n"); - printf(" directions as to where to proceed. This can be specified in the dimension\n"); - printf(" access order. For example, -r 1,2 states that the tool should traverse\n"); - printf(" dimension 1 first, and then dimension 2.\n"); - printf("\n"); - printf(" Environment variables:\n"); - printf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); - printf(" HDF5_PREFIX Data file prefix\n"); - printf("\n"); + print_version(prog); + HDprintf("usage: %s [OPTIONS]\n", prog); + HDprintf(" OPTIONS\n"); + HDprintf(" -h Print an usage message and exit\n"); + HDprintf(" -A AL Which APIs to test\n"); + HDprintf(" [default: all of them]\n"); + HDprintf(" -c SL Selects chunked storage and defines chunks dimensions\n"); + HDprintf(" and sizes\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -e SL Dimensions and sizes of dataset\n"); + HDprintf(" [default: 100,200]\n"); + HDprintf(" -i N Number of iterations to perform\n"); + HDprintf(" [default: 1]\n"); + HDprintf(" -r NL Dimension access order (see below for description)\n"); + HDprintf(" [default: 1,2]\n"); + HDprintf(" -t Selects extendable dimensions for HDF5 dataset\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -v VFD Selects file driver for HDF5 access\n"); + HDprintf(" [default: sec2]\n"); + HDprintf(" -w Perform write tests, not the read tests\n"); + HDprintf(" [default: Off]\n"); + HDprintf(" -x SL Dimensions and sizes of the transfer buffer\n"); + HDprintf(" [default: 10,20]\n"); + HDprintf("\n"); + HDprintf(" N - is an integer > 0.\n"); + HDprintf("\n"); + HDprintf(" S - is a size specifier, an integer > 0 followed by a size indicator:\n"); + HDprintf(" K - Kilobyte (%d)\n", ONE_KB); + HDprintf(" M - Megabyte (%d)\n", ONE_MB); + HDprintf(" G - Gigabyte (%d)\n", ONE_GB); + HDprintf("\n"); + HDprintf(" Example: '37M' is 37 megabytes or %d bytes\n", 37*ONE_MB); + HDprintf("\n"); + HDprintf(" AL - is an API list. Valid values are:\n"); + HDprintf(" hdf5 - HDF5\n"); + HDprintf(" posix - POSIX\n"); + HDprintf("\n"); + HDprintf(" Example: -A posix,hdf5\n"); + HDprintf("\n"); + HDprintf(" NL - is list of integers (N) separated by commas.\n"); + HDprintf("\n"); + HDprintf(" Example: 1,2,3\n"); + HDprintf("\n"); + HDprintf(" SL - is list of size specifiers (S) separated by commas.\n"); + HDprintf("\n"); + HDprintf(" Example: 2K,2K,3K\n"); + HDprintf("\n"); + HDprintf(" The example defines an object (dataset, tranfer buffer) with three\n"); + HDprintf(" dimensions. Be aware that as the number of dimensions increases, the\n"); + HDprintf(" the total size of the object increases exponentially.\n"); + HDprintf("\n"); + HDprintf(" VFD - is an HDF5 file driver specifier. Valid values are:\n"); + HDprintf(" sec2, stdio, core, split, multi, family, direct\n"); + HDprintf("\n"); + HDprintf(" Dimension access order:\n"); + HDprintf(" Data access starts at the cardinal origin of the dataset using the\n"); + HDprintf(" transfer buffer. The next access occurs on a dataset region next to\n"); + HDprintf(" the previous one. For a multidimensional dataset, there are several\n"); + HDprintf(" directions as to where to proceed. This can be specified in the dimension\n"); + HDprintf(" access order. For example, -r 1,2 states that the tool should traverse\n"); + HDprintf(" dimension 1 first, and then dimension 2.\n"); + HDprintf("\n"); + HDprintf(" Environment variables:\n"); + HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); + HDprintf(" HDF5_PREFIX Data file prefix\n"); + HDprintf("\n"); fflush(stdout); } /* end usage() */ diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index e73a6b5..5ce922b 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -316,6 +316,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDpipe(F) pipe(F) #define HDpow(X,Y) pow(X,Y) /* printf() variable arguments */ +#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__) #define HDputc(C,F) putc(C,F) #define HDputchar(C) putchar(C) #define HDputs(S) puts(S) @@ -377,6 +378,7 @@ H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); #define HDsnprintf snprintf /*varargs*/ #endif /* sprintf() variable arguments */ +#define HDsprintf sprintf /*varargs*/ #define HDsqrt(X) sqrt(X) #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); -- cgit v0.12 From e06bf9d263f46360e271569cd59a83786d80d7b6 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 28 Aug 2019 10:08:12 -0500 Subject: HDFFV-10677 and HDFFV-10661 Description: - Added functions to query chunk information: H5Dget_num_chunks(dset_id, fspace_id, *nchunks) Gets the number of written chunks that intersect with the given dataspace. However, in this version, the intersection is not yet completed. Thus, the number of all written chunks will be returned. H5Dget_chunk_info_by_coord(dset_id, *offset, *filter_mask, *addr, *size) Given a chunk's logical coordinates, returns the chunk's filter, address, and size. H5Dget_chunk_info(dset_id, fspace_id, index, *offset, *filter_mask, *addr, *size) Given a chunk's index, returns the chunk's logical coordinates, filter, address, and size. The chunk belongs to a set of chunks that have nonempty intersection with the specified dataspace. However, in this version, the intersection is not yet completed, and the index is of all the written chunks. These functions comply with VOL. - Fixed some oversights found in the library for the tests in chunk_info.c to work correctly. The returned value from a callback function was not checked in H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). This oversight caused a callback function to continue iterating even though it's supposed to stop. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test) --- MANIFEST | 1 + src/H5D.c | 179 ++++- src/H5Dchunk.c | 392 ++++++++++ src/H5Dnone.c | 57 +- src/H5Dpkg.h | 3 + src/H5Dpublic.h | 3 + src/H5EA.c | 14 +- src/H5FA.c | 14 +- src/H5VLnative.h | 7 +- src/H5VLnative_dataset.c | 102 ++- test/CMakeLists.txt | 1 + test/Makefile.am | 6 +- test/chunk_info.c | 1937 ++++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 2649 insertions(+), 67 deletions(-) create mode 100644 test/chunk_info.c diff --git a/MANIFEST b/MANIFEST index 1232411..10bffba 100644 --- a/MANIFEST +++ b/MANIFEST @@ -990,6 +990,7 @@ ./test/cache_image.c ./test/cache_logging.c ./test/cache_tagging.c +./test/chunk_info.c ./test/cmpd_dset.c ./test/cork.c ./test/corrupt_stab_msg.h5 diff --git a/src/H5D.c b/src/H5D.c index a8cefd9..9c3a096 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -457,8 +457,8 @@ done: * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 + * Programmer: Robb Matzke + * Tuesday, February 3, 1998 * *------------------------------------------------------------------------- */ @@ -512,8 +512,8 @@ done: * * Failure: H5I_INVALID_HID * - * Programmer: Neil Fortner - * Wednesday, October 29, 2008 + * Programmer: Neil Fortner + * Wednesday, October 29, 2008 * *------------------------------------------------------------------------- */ @@ -610,9 +610,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Diterate + * Function: H5Diterate * - * Purpose: This routine iterates over all the elements selected in a memory + * Purpose: This routine iterates over all the elements selected in a memory * buffer. The callback function is called once for each element selected * in the dataspace. The selection in the dataspace is modified so * that any elements already iterated over are removed from the selection @@ -659,11 +659,11 @@ done: * indicating failure. The iterator can be restarted at the next * element. * - * Return: Returns the return value of the last operator if it was non-zero, + * Return: Returns the return value of the last operator if it was non-zero, * or zero if all elements were processed. Otherwise returns a * negative value. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, June 11, 1999 * *------------------------------------------------------------------------- @@ -706,16 +706,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dvlen_reclaim + * Function: H5Dvlen_reclaim * - * Purpose: Frees the buffers allocated for storing variable-length data + * Purpose: Frees the buffers allocated for storing variable-length data * in memory. Only frees the VL data in the selection defined in the * dataspace. The dataset transfer property list is required to find the * correct allocation/free methods for the VL data in the buffer. * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, June 10, 1999 * *------------------------------------------------------------------------- @@ -756,9 +756,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5Dvlen_get_buf_size + * Function: H5Dvlen_get_buf_size * - * Purpose: This routine checks the number of bytes required to store the VL + * Purpose: This routine checks the number of bytes required to store the VL * data from the dataset, using the space_id for the selection in the * dataset on disk and the type_id for the memory representation of the * VL data, in memory. The *size value is modified according to how many @@ -772,9 +772,9 @@ done: * Kinda kludgy, but easier than the other method of trying to figure out * the sizes without actually reading the data in... - QAK * - * Return: Non-negative on success, negative on failure + * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Wednesday, August 11, 1999 * *------------------------------------------------------------------------- @@ -1095,3 +1095,150 @@ done: FUNC_LEAVE_API(ret_value); } /* H5Dget_chunk_storage_size() */ + +/*------------------------------------------------------------------------- + * Function: H5Dget_num_chunks + * + * Purpose: Retrieves the number of chunks that have non-empty intersection + * with a specified selection. + * + * Note: Currently, this function only gets the number of all written + * chunks, regardless the dataspace. + * + * Parameters: + * hid_t dset_id; IN: Chunked dataset ID + * hid_t fspace_id; IN: File dataspace ID + * hsize_t *nchunks; OUT: Number of non-empty chunks + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Binh-Minh Ribler + * May 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "ii*h", dset_id, fspace_id, nchunks); + + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + if(NULL == nchunks) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + + /* Get the number of written chunks */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, nchunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") + +done: + FUNC_LEAVE_API(ret_value); +} /* H5Dget_num_chunks() */ + + +/*------------------------------------------------------------------------- + * Function: H5Dget_chunk_info + * + * Purpose: Retrieves information about a chunk specified by its index. + * + * Parameters: + * hid_t dset_id; IN: Chunked dataset ID + * hid_t fspace_id; IN: File dataspace ID + * hsize_t index; IN: Index of written chunk + * hsize_t *offset OUT: Logical position of the chunk’s + * first element in the dataspace + * unsigned *filter_mask OUT: Mask for identifying the filters in use + * haddr_t *addr OUT: Address of the chunk + * hsize_t *size OUT: Size of the chunk + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Binh-Minh Ribler + * May 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ + hsize_t nchunks= 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_index, offset, + filter_mask, addr, size); + + /* Check arguments */ + if(NULL == offset && NULL == filter_mask && NULL == addr && NULL == size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument") + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + + /* Get the number of written chunks to check range */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, fspace_id, &nchunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks") + + /* Check range for chunk index */ + if(chk_index >= nchunks) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "chunk index is out of range") + + /* Call private function to get the chunk info given the chunk's index */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index") + +done: + FUNC_LEAVE_API(ret_value); +} /* H5Dget_chunk_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5Dget_chunk_info_by_coord + * + * Purpose: Retrieves information about a chunk specified by its logical + * coordinates. + * + * Parameters: + * hid_t dset_id; IN: Chunked dataset ID + * hsize_t *offset IN: Logical position of the chunk’s + * first element in the dataspace + * unsigned *filter_mask OUT: Mask for identifying the filters in use + * haddr_t *addr OUT: Address of the chunk + * hsize_t *size OUT: Size of the chunk + * + * Return: Non-negative on success, negative on failure + * + * Programmer: Binh-Minh Ribler + * May 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "i*h*Iu*a*h", dset_id, offset, filter_mask, addr, size); + + /* Check arguments */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + if(NULL == filter_mask && NULL == addr && NULL == size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument") + if(NULL == offset) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + + /* Call private function to get the chunk info given the chunk's index */ + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR, offset, filter_mask, addr, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dget_chunk_info_by_coord() */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 082aac3..4976075 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -216,6 +216,18 @@ typedef struct H5D_chunk_readvv_ud_t { const H5D_t *dset; /* Dataset to operate on */ } H5D_chunk_readvv_ud_t; +typedef struct H5D_chunk_info_iter_ud_t { + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset of the chunk */ + hsize_t ndims; /* Number of dimensions in the dataset */ + uint32_t nbytes; /* Size of stored data in the chunk */ + unsigned filter_mask; /* Excluded filters */ + haddr_t chunk_addr; /* Address of the chunk in file */ + hsize_t chunk_idx; /* Chunk index, where the iteration needs to stop */ + hsize_t curr_idx; /* Current index, where the iteration is */ + unsigned idx_hint; /* Index of chunk in cache, if present */ + hbool_t found; /* Whether the chunk was found */ +} H5D_chunk_info_iter_ud_t; + /* Callback info for file selection iteration */ typedef struct H5D_chunk_file_iter_ud_t { H5D_chunk_map_t *fm; /* File->memory chunk mapping info */ @@ -252,6 +264,11 @@ static herr_t H5D__chunk_flush(H5D_t *dset); static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm); static herr_t H5D__chunk_dest(H5D_t *dset); +/* Chunk query operation callbacks */ +static int H5D__get_num_chunks_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); +static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); +static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); + /* "Nonexistent" layout operation callback */ static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, @@ -6956,3 +6973,378 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_format_convert() */ + +/*------------------------------------------------------------------------- + * Function: H5D__get_num_chunks_cb + * + * Purpose: Callback function that increments the number of written + * chunks in the dataset. + * + * Note: Currently, this function only gets the number of all written + * chunks, regardless the dataspace. + * + * Return: H5_ITER_CONT + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +static int +H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_udata) +{ + hsize_t *num_chunks = (hsize_t *)_udata; + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + HDassert(num_chunks); + + (*num_chunks)++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__get_num_chunks_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__get_num_chunks + * + * Purpose: Gets the number of written chunks in a dataset. + * + * Note: Currently, this function only gets the number of all written + * chunks, regardless the dataspace. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t *nchunks) +{ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + hsize_t num_chunks = 0; /* Number of written chunks */ + H5D_rdcc_ent_t *ent; /* Cache entry */ + const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ + const H5O_layout_t *layout; /* Dataset layout */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) + + HDassert(dset); + HDassert(dset->shared); + HDassert(space); + HDassert(nchunks); + + layout = &(dset->shared->layout); /* Dataset layout */ + rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ + HDassert(rdcc); + + /* Search for cached chunks that haven't been written out */ + for(ent = rdcc->head; ent; ent = ent->next) + /* Flush the chunk out to disk, to make certain the size is correct later */ + if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* If the dataset is not written, number of chunks will be 0 */ + if(!H5F_addr_defined(idx_info.storage->idx_addr)) { + *nchunks = 0; + } + else { + /* Iterate over the allocated chunks */ + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") + *nchunks = num_chunks; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__get_num_chunks() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__get_chunk_info_cb + * + * Purpose: Get the chunk info of the queried chunk, given by its index. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * H5_ITER_STOP indicates the queried chunk is found + * Failure: Negative (H5_ITER_ERROR) + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +static int +H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) +{ + H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; + hsize_t ii = 0; /* Dimension index */ + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(chunk_rec); + HDassert(chunk_info); + + /* If this is the queried chunk, retrieve its info and stop iterating */ + if (chunk_info->curr_idx == chunk_info->chunk_idx) { + chunk_info->filter_mask = chunk_rec->filter_mask; + chunk_info->chunk_addr = chunk_rec->chunk_addr; + chunk_info->nbytes = chunk_rec->nbytes; + for (ii = 0; ii < chunk_info->ndims; ii++) + chunk_info->scaled[ii] = chunk_rec->scaled[ii]; + chunk_info->found = TRUE; + + /* Stop iterating */ + ret_value = H5_ITER_STOP; + } + /* Go to the next chunk */ + else + chunk_info->curr_idx++; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__get_chunk_info_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__get_chunk_info + * + * Purpose: Iterate over the chunks in the dataset to get the info + * of the desired chunk. + * + * Note: Currently, this function only gets the number of all written + * chunks, regardless the dataspace. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size) +{ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chunk_info_iter_ud_t udata; /* User data for callback */ + const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ + H5D_rdcc_ent_t *ent; /* Cache entry index */ + hsize_t ii = 0; /* Dimension index */ + hsize_t nchunks = 0; /* Number of chunks in this dset */ + hsize_t scaled[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED;/* Return value */ + + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) + + HDassert(dset); + HDassert(dset->shared); + HDassert(space); + + /* Get the raw data chunk cache */ + rdcc = &(dset->shared->cache.chunk); + HDassert(rdcc); + + /* Search for cached chunks that haven't been written out */ + for(ent = rdcc->head; ent; ent = ent->next) + /* Flush the chunk out to disk, to make certain the size is correct later */ + if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* Set addr & size for when dset is not written or queried chunk is not found */ + if (addr) + *addr = HADDR_UNDEF; + if (size) + *size = 0; + + /* If the chunk is written, get its info, otherwise, return without error */ + if(H5F_addr_defined(idx_info.storage->idx_addr)) { + /* Initialize before iteration */ + udata.chunk_idx = chk_index; + udata.curr_idx = 0; + udata.ndims = dset->shared->ndims; + udata.nbytes = 0; + udata.filter_mask = 0; + udata.chunk_addr = HADDR_UNDEF; + udata.found = FALSE; + + /* Iterate over the allocated chunks */ + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_cb, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index") + + /* Obtain requested info if the chunk is found */ + if(udata.found) { + if(filter_mask) + *filter_mask = udata.filter_mask; + if(addr) + *addr = udata.chunk_addr; + if(size) + *size = udata.nbytes; + if(offset) + for(ii = 0; ii < udata.ndims; ii++) + offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii]; + } + } /* end if H5F_addr_defined */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__get_chunk_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__get_chunk_info_by_coord_cb + * + * Purpose: Get the chunk info of the desired chunk, given its offset + * coordinates. + * + * Return: Success: H5_ITER_CONT or H5_ITER_STOP + * Failure: Negative (H5_ITER_ERROR) + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +static int +H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) +{ + hsize_t ii; + H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata; + hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */ + int ret_value = H5_ITER_CONT; /* Callback return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(chunk_rec); + HDassert(chunk_info); + + /* Going through the scaled, stop when a mismatch is found */ + for (ii = 0; ii < chunk_info->ndims && !different; ii++) + if (chunk_info->scaled[ii] != chunk_rec->scaled[ii]) + different = TRUE; + + /* Same scaled coords means the chunk is found, copy the chunk info */ + if (!different) { + chunk_info->nbytes = chunk_rec->nbytes; + chunk_info->filter_mask = chunk_rec->filter_mask; + chunk_info->chunk_addr = chunk_rec->chunk_addr; + chunk_info->found = TRUE; + + /* Stop iterating */ + ret_value = H5_ITER_STOP; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__get_chunk_info_by_coord_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__get_chunk_info_by_coord + * + * Purpose: Iterate over the chunks in the dataset to get the info + * of the desired chunk, given by its offset coordinates. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Binh-Minh Ribler + * June 2019 (HDFFV-10677) + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* filter_mask, haddr_t *addr, hsize_t *size) +{ + const H5O_layout_t *layout = NULL; /* Dataset layout */ + const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ + H5D_rdcc_ent_t *ent; /* Cache entry index */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chunk_info_iter_ud_t udata; /* User data for callback */ + H5D_chunk_ud_t udata2; + hsize_t scaled[H5S_MAX_RANK]; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) + + /* Check args */ + HDassert(dset); + HDassert(dset->shared); + HDassert(offset); + + /* Get dataset layout and raw data chunk cache */ + layout = &(dset->shared->layout); + rdcc = &(dset->shared->cache.chunk); + HDassert(layout); + HDassert(rdcc); + HDassert(H5D_CHUNKED == layout->type); + +/* Is this expensive? */ + /* Search for cached chunks that haven't been written out */ + for(ent = rdcc->head; ent; ent = ent->next) + /* Flush the chunk out to disk, to make certain the size is correct later */ + if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + + /* Set addr & size for when dset is not written or queried chunk is not found */ + if (addr) + *addr = HADDR_UNDEF; + if (size) + *size = 0; + + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.pline = &dset->shared->dcpl_cache.pline; + idx_info.layout = &dset->shared->layout.u.chunk; + idx_info.storage = &dset->shared->layout.storage.u.chunk; + + /* If the dataset is not written, return without errors */ + if(H5F_addr_defined(idx_info.storage->idx_addr)) { + /* Calculate the scaled of this chunk */ + H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, udata.scaled); + udata.scaled[dset->shared->ndims] = 0; + + /* Initialize before iteration */ + udata.ndims = dset->shared->ndims; + udata.nbytes = 0; + udata.filter_mask = 0; + udata.chunk_addr = HADDR_UNDEF; + udata.found = FALSE; + + /* Iterate over the allocated chunks to find the requested chunk */ + if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_by_coord_cb, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates") + + /* Obtain requested info if the chunk is found */ + if (udata.found) { + if(filter_mask) + *filter_mask = udata.filter_mask; + if(addr) + *addr = udata.chunk_addr; + if(size) + *size = udata.nbytes; + } + } /* end if H5F_addr_defined */ + +done: + FUNC_LEAVE_NOAPI_TAG(ret_value) +} /* end H5D__get_chunk_info_by_coord() */ + diff --git a/src/H5Dnone.c b/src/H5Dnone.c index be421b6..9346220 100644 --- a/src/H5Dnone.c +++ b/src/H5Dnone.c @@ -242,9 +242,9 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, unsigned u; /* Local index variable */ int curr_dim; /* Current rank */ hsize_t idx; /* Array index of chunk */ - int ret_value = -1; /* Return value */ + int ret_value = H5_ITER_CONT; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC /* Sanity checks */ HDassert(idx_info); @@ -266,34 +266,35 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, HDassert(ndims > 0); /* Iterate over all the chunks in the dataset's dataspace */ - for(u = 0; u < idx_info->layout->nchunks; u++) { - /* Calculate the index of this chunk */ - idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled); - - /* Calculate the address of the chunk */ - chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size; - - /* Make "generic chunk" callback */ - if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0) - HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); - - /* Update coordinates of chunk in dataset */ - curr_dim = (int)(ndims - 1); - while(curr_dim >= 0) { - /* Increment coordinate in current dimension */ - chunk_rec.scaled[curr_dim]++; - - /* Check if we went off the end of the current dimension */ - if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) { - /* Reset coordinate & move to next faster dimension */ - chunk_rec.scaled[curr_dim] = 0; - curr_dim--; - } /* end if */ - else - break; - } /* end while */ + for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) { + /* Calculate the index of this chunk */ + idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled); + + /* Calculate the address of the chunk */ + chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size; + + /* Make "generic chunk" callback */ + if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR, "failure in generic chunk iterator callback") + + /* Update coordinates of chunk in dataset */ + curr_dim = (int)(ndims - 1); + while(curr_dim >= 0) { + /* Increment coordinate in current dimension */ + chunk_rec.scaled[curr_dim]++; + + /* Check if we went off the end of the current dimension */ + if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) { + /* Reset coordinate & move to next faster dimension */ + chunk_rec.scaled[curr_dim] = 0; + curr_dim--; + } /* end if */ + else + break; + } /* end while */ } /* end for */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__none_idx_iterate() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index ed3bc12..723acf9 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -569,6 +569,9 @@ H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *alloc H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size); H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size); +H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t *nchunks); +H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size); +H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info); H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *op_data); diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 63f1a24..7234d16 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -142,6 +142,9 @@ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); H5_DLL hid_t H5Dget_access_plist(hid_t dset_id); H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id); H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); +H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks); +H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); +H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size); H5_DLL haddr_t H5Dget_offset(hid_t dset_id); H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf/*out*/); diff --git a/src/H5EA.c b/src/H5EA.c index d0bf474..96eee12 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -987,19 +987,25 @@ END_FUNC(PRIV) /* end H5EA_delete() */ * Purpose: Iterate over the elements of an extensible array * (copied and modified from FA_iterate() in H5FA.c) * - * Return: SUCCEED/FAIL + * Return: H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Vailin Choi; Feb 2015 * + * Modification: + * Prototype changed (HDFFV-10661) + * - herr_t to int + * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR + * June 6, 2019 -BMR *------------------------------------------------------------------------- */ BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, +int, H5_ITER_CONT, H5_ITER_ERROR, H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)) /* Local variables */ uint8_t *elmt = NULL; hsize_t u; + int cb_ret = H5_ITER_CONT; /* Return value from callback */ /* * Check arguments. @@ -1013,9 +1019,7 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata)) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element") /* Iterate over all elements in array */ - for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) { - int cb_ret; /* Return value from callback */ - + for(u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) { /* Get array element */ if(H5EA_get(ea, u, elmt) < 0) H5E_THROW(H5E_CANTGET, "unable to delete fixed array") diff --git a/src/H5FA.c b/src/H5FA.c index 8c86193..df53f27 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -686,20 +686,26 @@ END_FUNC(PRIV) /* end H5FA_delete() */ * Note: This is not very efficient, we should be iterating directly * over the fixed array's direct block [pages]. * - * Return: SUCCEED/FAIL + * Return: H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Vailin Choi * Thursday, April 30, 2009 * + * Modification: + * Prototype changed (HDFFV-10661) + * - herr_t to int + * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR + * June 6, 2019 -BMR *------------------------------------------------------------------------- */ BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, +int, H5_ITER_CONT, H5_ITER_ERROR, H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata)) /* Local variables */ uint8_t *elmt = NULL; hsize_t u; + int cb_ret = H5_ITER_CONT; /* Return value from callback */ /* * Check arguments. @@ -713,9 +719,7 @@ H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata)) H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element") /* Iterate over all elements in array */ - for(u = 0; u < fa->hdr->stats.nelmts; u++) { - int cb_ret; /* Return value from callback */ - + for(u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) { /* Get array element */ if(H5FA_get(fa, u, elmt) < 0) H5E_THROW(H5E_CANTGET, "unable to delete fixed array") diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 1a3007a..73c6189 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -36,8 +36,11 @@ typedef int H5VL_native_dataset_optional_t; #define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */ #define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */ #define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */ -#define H5VL_NATIVE_DATASET_CHUNK_READ 3 /* H5Dchunk_read */ -#define H5VL_NATIVE_DATASET_CHUNK_WRITE 4 /* H5Dchunk_write */ +#define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */ +#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */ +#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR 5 /* H5Dget_chunk_info_by_coord */ +#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */ +#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */ /* Typedef and values for native VOL connector file optional VOL operations */ typedef int H5VL_native_file_optional_t; diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 1e3d263..631eb19 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -339,7 +339,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, switch(specific_type) { /* H5Dspecific_space */ case H5VL_DATASET_SET_EXTENT: - { + { /* H5Dset_extent (H5Dextend - deprecated) */ const hsize_t *size = HDva_arg(arguments, const hsize_t *); if(H5D__set_extent(dset, size) < 0) @@ -348,7 +348,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, } case H5VL_DATASET_FLUSH: - { + { /* H5Dflush */ hid_t dset_id = HDva_arg(arguments, hid_t); /* Flush the dataset */ @@ -359,7 +359,7 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, } case H5VL_DATASET_REFRESH: - { + { /* H5Drefresh */ hid_t dset_id = HDva_arg(arguments, hid_t); /* Refresh the dataset */ @@ -399,7 +399,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, switch(optional_type) { case H5VL_NATIVE_DATASET_FORMAT_CONVERT: - { + { /* H5Dformat_convert */ dset = (H5D_t *)obj; switch(dset->shared->layout.type) { @@ -434,7 +434,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, } case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: - { + { /* H5Dget_chunk_index_type */ H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *); dset = (H5D_t *)obj; @@ -450,7 +450,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, } case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: - { + { /* H5Dget_chunk_storage_size */ hsize_t *offset = HDva_arg(arguments, hsize_t *); hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *); @@ -467,8 +467,94 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: + { /* H5Dget_num_chunks */ + const H5S_t *space = NULL; + hid_t space_id = HDva_arg(arguments, hid_t); + hsize_t *nchunks = HDva_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + HDassert(dset); + HDassert(dset->shared); + HDassert(dset->shared->space); + + /* When default dataspace is given, use the dataset's dataspace */ + if(space_id == H5S_ALL) + space = dset->shared->space; + else /* otherwise, use the given space ID */ + if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID") + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Call private function */ + if(H5D__get_num_chunks(dset, space, nchunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") + + break; + } + + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: + { /* H5Dget_chunk_info */ + const H5S_t *space = NULL; + hid_t space_id = HDva_arg(arguments, hid_t); + hsize_t chk_index = HDva_arg(arguments, hsize_t); + hsize_t *offset = HDva_arg(arguments, hsize_t *); + unsigned *filter_mask = HDva_arg(arguments, unsigned *); + haddr_t *addr = HDva_arg(arguments, haddr_t *); + hsize_t *size = HDva_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + HDassert(dset); + HDassert(dset->shared); + + /* When default dataspace is given, use the dataset's dataspace */ + if(space_id == H5S_ALL) + { + space = dset->shared->space; + if(NULL == space) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain a dataspace") + } /* otherwise, use the given space ID */ + else + if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID") + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Call private function */ + if(H5D__get_chunk_info(dset, space, chk_index, offset, filter_mask, addr, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index") + break; + } + + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR: + { /* H5Dget_chunk_info_by_coord */ + hsize_t *offset = HDva_arg(arguments, hsize_t *); + unsigned *filter_mask = HDva_arg(arguments, unsigned *); + haddr_t *addr = HDva_arg(arguments, haddr_t *); + hsize_t *size = HDva_arg(arguments, hsize_t *); + + dset = (H5D_t *)obj; + HDassert(dset); + HDassert(dset->shared); + + /* Make sure the dataset is chunked */ + if(H5D_CHUNKED != dset->shared->layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + + /* Call private function */ + if(H5D__get_chunk_info_by_coord(dset, offset, filter_mask, addr, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates") + + break; + } + case H5VL_NATIVE_DATASET_CHUNK_READ: - { + { /* H5Dread_chunk */ const hsize_t *offset = HDva_arg(arguments, hsize_t *); uint32_t *filters = HDva_arg(arguments, uint32_t *); void *buf = HDva_arg(arguments, void *); @@ -496,7 +582,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, } case H5VL_NATIVE_DATASET_CHUNK_WRITE: - { + { /* H5Dwrite_chunk */ uint32_t filters = HDva_arg(arguments, uint32_t); const hsize_t *offset = HDva_arg(arguments, const hsize_t *); uint32_t data_size_32 = HDva_arg(arguments, uint32_t); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cbd1901..c1ac44c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -242,6 +242,7 @@ set (H5_TESTS page_buffer dtypes dsets + chunk_info cmpd_dset filter_fail extend diff --git a/test/Makefile.am b/test/Makefile.am index ff6d1c6..a19079d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -58,9 +58,9 @@ TEST_PROG= testhdf5 \ cache cache_api cache_image cache_tagging lheap ohdr \ stab gheap evict_on_close farray earray btree2 fheap \ pool accum hyperslab istore bittests dt_arith page_buffer \ - dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \ - objcopy links unlink twriteorder big mtime fillval mount flush1 \ - flush2 app_ref enum set_extent ttsafe enc_dec_plist \ + dtypes dsets chunk_info cmpd_dset filter_fail extend direct_chunk \ + external efc objcopy links unlink twriteorder big mtime fillval mount \ + flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ dangle dtransform reserved cross_read freespace mf vds file_image \ unregister cache_logging cork swmr vol diff --git a/test/chunk_info.c b/test/chunk_info.c new file mode 100644 index 0000000..9a4660c --- /dev/null +++ b/test/chunk_info.c @@ -0,0 +1,1937 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Pedro Vicente + * April 7, 2008 + * + * Purpose: Tests chunk query API functions + * + * Modification: + * Many tests were added for HDFFV-10677. -BMR, August 2019 + * + * Test structure: + * main() + * test_get_chunk_info_highest18() + * test_get_chunk_info_110() + * test_chunk_info_single_chunk() + * test_chunk_info_implicit() + * test_chunk_info_fixed_array() + * test_chunk_info_extensible_array() + * test_chunk_info_version2_btrees() + * test_failed_attempts() + * test_filter_mask_with_skip_compress() + * + */ +#define H5D_FRIEND +#define H5D_TESTING /* to use H5D__ functions */ +#include "H5Dpkg.h" + +#include "testhdf5.h" +#include "zlib.h" + +/* Used to make certain an offset is as expected */ +#define VERIFY_VAR(_x, _val, where, var) do { \ + long __x = (long)_x, __val = (long)_val; \ + if(VERBOSE_HI) { \ + print_func(" Call to routine: %15s at line %4d in %s had value " \ + "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ + } \ + if((__x) != (__val)) { \ + TestErrPrintf("*** UNEXPECTED VALUE from %s, %s should be %ld," \ + " but is %ld at line %4d in %s\n", \ + (where), (var), __val, __x, (int)__LINE__, __FILE__); \ + H5Eprint2(H5E_DEFAULT, stdout); \ + } \ +} while(0) + +/* Test file names, using H5F_libver_t as indices */ +const char *FILENAME[] = { + "tchunk_info_earliest", + "tchunk_info_18", + "tchunk_info_110", + "tchunk_info_112", + NULL +}; +#define FILTERMASK_FILE "tfilter_mask.h5" + +/* From original test */ +#define DATASETNAME "2d" + +/* Parameters for testing chunk querying */ +#define RANK 2 +#define FILENAME_BUF_SIZE 1024 +#define DSET_SIMPLE_CHUNKED "Chunked Dataset" +#define DSET_CONTIGUOUS "Contiguous Dataset" +#define DSET_EMPTY "Empty Dataset" +#define DSET_EMPTY_ALLOC "Empty Dataset with ALLOC_TIME_EARLY" +#define DSET_SINGLE_CHUNK "Single Chunk Index Dataset" +#define DSET_IMPLICIT_INDEX "Implicit Index Dataset" +#define DSET_FIXED_ARR_INDEX "Fixed Array Index Dataset" +#define DSET_EXT_ARR_INDEX "Extensible Array Index Dataset" +#define DSET_V2_BTREE_INDEX "Version 2 B-Tree Index Dataset" +#define DATASETNAME2 "skip_one_filter" +#define NX 24 +#define NY 16 +#define CHUNK_NX 6 +#define CHUNK_NY 4 +#define SINGLE_CHUNK_SIZE (NX*NY*sizeof(int)) +#define CHUNK_SIZE 96 +#define NUM_CHUNKS 16 +#define NUM_CHUNKS_WRITTEN 4 +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) + +/* Utility function to initialize arguments */ +void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); + +/*------------------------------------------------------------------------- + * Function: read_each_chunk (helper function) + * + * Purpose: Reads the chunk specified by its offset and verifies that + * it contains the same data as what was written. This function + * is used in test_get_chunk_info. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: September 2018 + * + *------------------------------------------------------------------------- + */ +//EIP - May be this function should take a pointer to an array of chunk dimensions +//EIP and its size, so it is not restricted to 2 dims only? +static herr_t read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, void *direct_buf) +{ + int read_buf[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {offset1, offset2}; + unsigned read_flt_msk = 0; + herr_t ret; /* Return value */ + + HDmemset(&read_buf, 0, sizeof(read_buf)); + + /* Read the chunk specified by its offset */ + ret = H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf); + if(ret < 0) return(FAIL); + + /* Verify that read chunk is the same as the corresponding written one */ + if(HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0) + { + HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset1, offset2); + return(FAIL); + } + + return(SUCCEED); +} + +/*------------------------------------------------------------------------- + * Function: reinit_vars (helper function) + * + * Purpose: Helper function to wipe out variables for the next use, + * used in test_get_chunk_info. + * + * Return: Won't fail + * + * Date: September 2018 + * + *------------------------------------------------------------------------- + */ +void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size) +{ + if(read_flt_msk) + *read_flt_msk = 0; + if(addr) + *addr = 0; + if(size) + *size = 0; +} + +/*------------------------------------------------------------------------- + * Function: test_get_chunk_info_highest18 + * + * Purpose: Test getting various chunk information + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Description: + * This function tests the new API functions added for EED-343: + * H5Dget_num_chunks, H5Dget_chunk_info, and + * H5Dget_chunk_info_by_coord for high bound up to 1.8. + * + * Date: September 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_chunk_info_highest18(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t out_offset[2]; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int out_buf[NX][NY]; /* Buffer to read data in */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + int fillvalue = -1; /* Fill value */ + int aggression = 9; /* Compression aggression setting */ + H5F_libver_t low, high; /* File format bounds */ + hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ + int n; /* Used on buffer, to avoid conversion warning */ + hsize_t ii, jj; + const Bytef *z_src = (const Bytef*)(direct_buf); + Bytef *z_dst; /*destination buffer */ + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); + uLong z_src_nbytes = (uLong)buf_size; + void *outbuf = NULL; /* Pointer to new buffer */ + + herr_t ret; + + TESTING("getting chunk information in file with version prior to 1.10"); + + /* Create the file */ + h5_fixname(FILENAME[H5F_LIBVER_V18], fapl, filename, sizeof filename); + + /* Set high bound to V18 to test chunked dataset that use B-tree v1 + structures to index chunks */ + high = H5F_LIBVER_V18; + + /* Low bound can be anything below 1.10, which was when the new chunk storage + was introduced */ + low = H5F_LIBVER_EARLIEST; + + /* Set version bounds for creating the file */ + if(H5Pset_libver_bounds(fapl, low, high) < 0) + TEST_ERROR + + chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if(chunkfile < 0) + TEST_ERROR + + /* Create the file and memory dataspaces */ + if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + TEST_ERROR + + /* Set dset creation properties with chunking, compression, and fillvalue */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR + +#ifdef H5_HAVE_FILTER_DEFLATE + if(H5Pset_deflate(cparms, (unsigned)aggression) < 0) TEST_ERROR +#endif /* end H5_HAVE_FILTER_DEFLATE */ + + /* Set fill value */ + if(H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_SIMPLE_CHUNKED, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Allocate output (compressed) buffer */ + outbuf = malloc(z_dst_nbytes); + z_dst = (Bytef *)outbuf; + + /* Perform compression from the source to the destination buffer */ + ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression); + + /* Check for various zlib errors */ + if(Z_BUF_ERROR == ret) { + fprintf(stderr, "overflow"); + TEST_ERROR + } else if(Z_MEM_ERROR == ret) { + fprintf(stderr, "deflate memory error"); + TEST_ERROR + } else if(Z_OK != ret) { + fprintf(stderr, "other deflate error"); + TEST_ERROR + } + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + if(ret < 0) TEST_ERROR + } + + /* Read each chunk and verify the values */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + TEST_ERROR + + /* Free the read buffer */ + if(outbuf) + HDfree(outbuf); + + if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) + TEST_ERROR + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_SIMPLE_CHUNKED, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + + /* Go through all written chunks, get their info and verify the values */ + chk_index = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, chk_index++) { + int kk; + + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], ii * CHUNK_NX, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], jj * CHUNK_NY, "H5Dget_chunk_info, offset"); + + /* Reset variables to pass in to the next call */ + reinit_vars(&read_flt_msk, &addr, &size); + + /* Copy offsets to pass in to the next call */ + for(kk = 0; kk < RANK; kk++) + offset[kk] = out_offset[kk]; + + /* Get info of the chunk at the specified offsets and verify its info */ + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + } + + /* Get and verify info of the last chunk, passing in H5S_ALL */ + chk_index = 3; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + ret = H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size); + if(ret < 0) TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + + /* Attempt to get info of a non-existing chunk, should fail */ + chk_index = 5; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.") + + /* Attempt to get info of empty chunks, verify the returned addr and size */ + offset[0] = 0; + offset[1] = 0; + ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); + if(ret < 0) TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + offset[0] = 3 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); + if(ret < 0) TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + /* Read each chunk and verify the values */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + TEST_ERROR + + /* Close the first dataset */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Create an empty dataset and close it */ + dset = H5Dcreate2(chunkfile, DSET_EMPTY, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Reopen the empty dataset to verify the chunk query functions on it */ + if((dset = H5Dopen2(chunkfile, DSET_EMPTY, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Verify that the number of chunks is 0 */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 0) TEST_ERROR + + /* Attempt to get info of a chunk from an empty dataset, should fail */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.") + + /* Attempt to get info of a chunk given its coords from an empty dataset, + should succeed with the returned address as HADDR_UNDEF and size as 0 */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + if(H5Dclose(dset) < 0) TEST_ERROR + + /************************************************************************ + * Test empty dataset with H5D_ALLOC_TIME_EARLY * + ************************************************************************/ + + /* Set space allocation to early so that chunk query functions will + retrieve chunk information even though the dataset is empty */ + if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) + TEST_ERROR + + /* Create an empty dataset and close it */ + dset = H5Dcreate2(chunkfile, DSET_EMPTY_ALLOC, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Reopen the empty dataset to verify the chunk query functions on it */ + if((dset = H5Dopen2(chunkfile, DSET_EMPTY_ALLOC, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Verify that the number of chunks is NUM_CHUNKS */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS) TEST_ERROR + + /* Attempt to get info of a chunk from an empty dataset, verify the + returned address and size in the case of H5D_ALLOC_TIME_EARLY */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + if(ret < 0) TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ + if(addr == HADDR_UNDEF) + FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); + if(size == 0) + FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + + chk_index = 10; + reinit_vars(&read_flt_msk, &addr, &size); + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + if(ret < 0) TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ + if(addr == HADDR_UNDEF) + FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); + if(size == 0) + FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + + /* Attempt to get info of a chunk given its coords from an empty dataset, + verify the returned address and size */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ + if(addr == HADDR_UNDEF) + FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); + if(size == 0) + FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Close/release resources. */ + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Pclose(cparms) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_get_chunk_info_highest18() */ + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_single_chunk + * + * Purpose: Test getting various chunk information when Single Chunk + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_single_chunk(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */ + int in_buf[NX][NY]; /* Input buffer */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int ii, jj; +herr_t ret = 0; + + TESTING(" Single Chunk index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR + + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) + TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_SINGLE_CHUNK, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(dset, &idx_type) < 0) + TEST_ERROR + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("Should be using Single Chunk index type"); + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions on a single empty + chunk */ + if((dset = H5Dopen2(chunkfile, DSET_SINGLE_CHUNK, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get the number of chunks and verify that no chunk has been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 0) TEST_ERROR + + /* Initialize the array of chunk data for the single chunk */ + for(ii = 0; ii < NX; ii++) + for(jj = 0; jj < NY; jj++) + in_buf[ii][jj] = (ii*jj); + + /* Write the chunk */ + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + TEST_ERROR + + /* Get and verify that one chunk had been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 1) TEST_ERROR + + /* Get and verify info of the first and only chunk */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 0, "H5Dget_chunk_info, offset"); + + /* Get info of the chunk at logical coordinates (0,0) */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Attempt to get chunk info given an invalid chunk index and verify + * that failure occurs */ + chk_index = 3; + reinit_vars(&read_flt_msk, &addr, &size); + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + TEST_ERROR + + /* Get info of the chunk at logical coordinates (0,0) */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_single_chunk() */ + + + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_implicit + * + * Purpose: Test getting various chunk information when Implicit + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_implicit(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int read_direct_chunk[CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int out_buf[NX][NY]; /* Buffer to read data in */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int aggression = 9; /* Compression aggression setting */ + int n; /* Used on buffer, to avoid conversion warning*/ + hsize_t ii, jj; + herr_t ret; + + TESTING(" Implicit index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR + + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) + TEST_ERROR + + if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) + TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_IMPLICIT_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(dset, &idx_type) < 0) + TEST_ERROR + + if(idx_type != H5D_CHUNK_IDX_NONE) /* Implicit: No Index */ + FAIL_PUTS_ERROR("Should be using Implicit index type"); + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get and verify the number of chunks */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + + /* All chunks because of H5D_ALLOC_TIME_EARLY */ + if(nchunks != NUM_CHUNKS) TEST_ERROR + + /* Get and verify the number of chunks again, passing in H5S_ALL */ + if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS) TEST_ERROR + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + if(ret < 0) TEST_ERROR + } + + if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0) + TEST_ERROR + + if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR + + /* Go through all chunks, and get their info and verify the values */ + chk_index = 0; + for(ii = 0; ii < NX/CHUNK_NX; ii++) + for(jj = 0; jj < NY/CHUNK_NY; jj++, chk_index++) { + int kk; + + if(H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], ii * CHUNK_NX, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], jj * CHUNK_NY, "H5Dget_chunk_info, offset"); + + /* Reset variables to pass in to the next call */ + reinit_vars(&read_flt_msk, &addr, &size); + + /* Copy offsets to pass in to the next call */ + for(kk = 0; kk < RANK; kk++) + offset[kk] = out_offset[kk]; + + /* Get info of a chunk and verify its information. Note that + all chunks in this dataset are allocated because of the property + H5D_ALLOC_TIME_EARLY */ + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + } + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Pclose(cparms) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_implicit() */ + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_fixed_array + * + * Purpose: Test getting various chunk information when Fixed Array + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_fixed_array(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int out_buf[NX][NY]; /* Buffer to read data in */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int n; /* Used on buffer, to avoid conversion warning */ + hsize_t ii, jj; + herr_t ret; + + TESTING(" Fixed Array index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR + + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) + TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_FIXED_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(dset, &idx_type) < 0) + TEST_ERROR + if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("Should be using Fixed Array index type"); + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_FIXED_ARR_INDEX, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get the number of chunks and verify that no chunk has been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 0) TEST_ERROR + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + if(ret < 0) TEST_ERROR + } + + /* Read the entire dataset back */ + if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0) + TEST_ERROR + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + + /* Get and verify info of the first chunk */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + + /* Get and verify info of the second chunk */ + chk_index = 1; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + + /* Get and verify info of the third chunk */ + chk_index = 2; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + + /* Get and verify info of the last chunk */ + chk_index = 3; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + + /* Attempt to get info of empty chunk, should fail */ + chk_index = 5; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); + + /* Get info of the chunk at logical coordinates (0,2) */ + offset[0] = 0; + offset[1] = 2 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Get info of the chunk at logical coordinates (1,3) */ + offset[0] = 1 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Attempt to get info of empty chunks, verify the returned address and size */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + offset[0] = 3 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + /* Read each chunk and verify the values */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + TEST_ERROR + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_fixed_array() */ + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_extensible_array + * + * Purpose: Test getting various chunk information when Extensible Array + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_extensible_array(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int out_buf[NX][NY]; /* Buffer to read data in */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int n; /* Used on buffer, to avoid conversion warning */ + hsize_t ii, jj; + herr_t ret; + + TESTING(" Extensible Array index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + TEST_ERROR + + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) + TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_EXT_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(dset, &idx_type) < 0) + TEST_ERROR + if(idx_type != H5D_CHUNK_IDX_EARRAY) + FAIL_PUTS_ERROR("Should be using Extensible Array index type"); + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_EXT_ARR_INDEX, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get the number of chunks and verify that no chunk has been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 0) TEST_ERROR + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + if(ret < 0) TEST_ERROR + } + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + + /* Get and verify info of the first chunk */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the second chunk */ + chk_index = 1; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the third chunk */ + chk_index = 2; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the last chunk */ + chk_index = 3; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + + /* Attempt to get info using an out-of-range index, should fail */ + chk_index = 5; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); + + /* Get info of the chunk at logical coordinates (0,2) */ + offset[0] = 0; + offset[1] = 2 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Get info of the chunk at logical coordinates (1,3) */ + offset[0] = 1 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Attempt to get info of empty chunks, verify the returned address and size */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + offset[0] = 3 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + /* Read each chunk and verify the values */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + TEST_ERROR + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_extensible_array() */ + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_version2_btrees + * + * Purpose: Test getting various chunk information when Version 2 B-trees + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_version2_btrees(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + int out_buf[NX][NY]; /* Buffer to read data in */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int n; /* Used on buffer, to avoid conversion warning */ + hsize_t ii, jj; + herr_t ret; + + TESTING(" Version 2 B-trees index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + TEST_ERROR + + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR + + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) + TEST_ERROR + + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, DSET_V2_BTREE_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Ensure we're using the correct chunk indexing scheme */ + if(H5D__layout_idx_type_test(dset, &idx_type) < 0) + TEST_ERROR + if(idx_type != H5D_CHUNK_IDX_BT2) + FAIL_PUTS_ERROR("Should be using Version 2 B-tree index type"); + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions */ + if((dset = H5Dopen2(chunkfile, DSET_V2_BTREE_INDEX, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get the number of chunks and verify that no chunk has been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != 0) TEST_ERROR + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + if(ret < 0) TEST_ERROR + } + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + + /* Get and verify info of the first chunk */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the second chunk */ + chk_index = 1; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the third chunk */ + chk_index = 2; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + + /* Get and verify info of the last chunk */ + chk_index = 3; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + + /* Attempt to provide out-of-range offsets, should fail */ + chk_index = 5; + reinit_vars(&read_flt_msk, &addr, &size); + out_offset[0] = out_offset[1] = 0; + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); + + /* Get info of the chunk at logical coordinates (0,2) */ + offset[0] = 0; + offset[1] = 2 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Get info of the chunk at logical coordinates (1,3) */ + offset[0] = 1 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Attempt to get info of empty chunks, verify the returned address and size */ + offset[0] = 0; + offset[1] = 0; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + offset[0] = 3 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + /* Read each chunk and verify the values */ + n = 0; + for(ii = 0; ii < 2; ii++) + for(jj = 2; jj < 4; jj++, n++) + if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + TEST_ERROR + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_version2_btrees() */ + +/*------------------------------------------------------------------------- + * Function: test_failed_attempts + * + * Purpose: Test attempting to use chunk query functions incorrectly. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_failed_attempts(char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */ + int in_buf[NX][NY]; /* Input buffer */ + unsigned filter_mask = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + int ii, jj; + herr_t ret = 0; + + TESTING(" Invalid Operations"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) + TEST_ERROR + + /* Create a contiguous dataset */ + dset = H5Dcreate2(chunkfile, DSET_CONTIGUOUS, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Initialize the array of data */ + for(ii = 0; ii < NX; ii++) + for(jj = 0; jj < NY; jj++) + in_buf[ii][jj] = (ii*jj); + + /* Write the data */ + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + TEST_ERROR + + /* Close the dataset then... */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* ...open it again to test the chunk query functions on contiguous dataset */ + if((dset = H5Dopen2(chunkfile, DSET_CONTIGUOUS, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Attempt to get the number of chunks on contiguous dataset, should fail */ + H5E_BEGIN_TRY { + ret = H5Dget_num_chunks(dset, dspace, &nchunks); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.") + + /* Attempt to get chunk info on contiguous data, should fail */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.") + + /* Attempt to get chunk info at logical coordinates (0,0) on contiguous + * dataset, should fail */ + offset[0] = 0; + offset[1] = 0; + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempt a chunk query function on a contiguous dataset.") + + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_failed_attempts() */ + +/*------------------------------------------------------------------------- + * Function: test_get_chunk_info_110 + * + * Purpose: Test getting various chunk information in version 1.10. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Description: + * This function tests the new API functions added for EED-343: + * H5Dget_num_chunks, H5Dget_chunk_info, and H5Dget_chunk_info_by_coord + * for low bound beyond 1.8. + * + * Date: October 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_chunk_info_110(hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + char filename[FILENAME_BUF_SIZE]; + H5F_libver_t low, high; /* File format bounds */ + + TESTING("getting chunk information in file with versions 1.10 and later"); + HDprintf("\n"); /* to list sub-tests */ + + /* Set high bound to the current latest version */ + high = H5F_LIBVER_LATEST; + + /* Test getting info of chunked datasets in version combo up to 1.10 */ + for(low = H5F_LIBVER_V110; low <= H5F_LIBVER_LATEST; low++) { + /* Set version bounds for creating file */ + if(H5Pset_libver_bounds(fapl, low, high) < 0) + TEST_ERROR + + /* Create the file */ + h5_fixname(FILENAME[low], fapl, filename, sizeof filename); + chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if(chunkfile < 0) TEST_ERROR + + /* Close the file, individual tests will re-open the file with different + libvers via the fapl */ + if(H5Fclose(chunkfile) < 0) TEST_ERROR + + /* Test getting chunk info when Single Chunk index type is used */ + if(test_chunk_info_single_chunk(filename, fapl) < 0) + TEST_ERROR + + /* Test getting chunk info when Implicit index type is used */ + if(test_chunk_info_implicit(filename, fapl) < 0) + TEST_ERROR + + /* Test getting chunk info when Fixed Array index type is used */ + if(test_chunk_info_fixed_array(filename, fapl) < 0) + TEST_ERROR + + /* Test getting chunk info when Extensible Array index type is used */ + if(test_chunk_info_extensible_array(filename, fapl) < 0) + TEST_ERROR + + /* Test getting chunk info when Version 2 B-trees index type is used */ + if(test_chunk_info_version2_btrees(filename, fapl) < 0) + TEST_ERROR + + /* Test various attempts to use the functions incorrectly */ + if(test_failed_attempts(filename, fapl) < 0) + TEST_ERROR + + } /* for low libver bound */ + + return SUCCEED; + +error: + H5_FAILED(); + return FAIL; +} /* test_get_chunk_info_110() */ + +/*------------------------------------------------------------------------- + * Function: test_filter_mask_with_skip_compress + * + * Purpose: Test getting chunk info when compression filter is skipped. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 (based on direct_chunk.c/test_skip_compress_write1) + * + *------------------------------------------------------------------------- + */ +static herr_t +test_filter_mask_with_skip_compress(hid_t fapl) +{ + hid_t filter_file = H5I_INVALID_HID; /* File for filter mask */ + char filename[FILENAME_BUF_SIZE]; + hid_t dataspace = -1, dataset = -1; + hid_t mem_space = -1; + hid_t cparms = -1, dxpl = -1; + hsize_t dims[2] = {NX, NY}; + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; + unsigned filter_mask = 0; + unsigned read_flt_msk = 0; + int direct_buf[CHUNK_NX][CHUNK_NY]; + int check_chunk[CHUNK_NX][CHUNK_NY]; + hsize_t offset[2] = {0, 0}; + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); + int aggression = 9; /* Compression aggression setting */ + unsigned read_filter_mask = 0; /* filter mask after direct read */ + int read_direct_buf[CHUNK_NX][CHUNK_NY]; + hsize_t read_buf_size = 0; /* buf size */ + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + int ii, jj, n; + herr_t status; + + TESTING("getting filter mask when compression filter is skipped"); + + /* Create the file */ + h5_fixname(FILTERMASK_FILE, fapl, filename, sizeof filename); + + /* Create a new file. */ + if((filter_file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create file data space with unlimited dimensions. */ + if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + TEST_ERROR; + + /* Create memory data space. */ + if((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) + TEST_ERROR; + + /* Create dataset create property list with chunking and compression + enabled. */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) + TEST_ERROR; + + if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + TEST_ERROR; + + if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) + TEST_ERROR; + + /* Create a new dataset using cparms creation properties. */ + if((dataset = H5Dcreate2(filter_file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Create transfer property list for writing */ + if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) + TEST_ERROR; + + /* Initialize data for one chunk */ + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) { + direct_buf[ii][jj] = n++; + } + + /* Indicate the compression filter is to be skipped. */ + filter_mask = 0x00000001; + + /* Write the uncompressed data chunk repeatedly to fill the dataset, + using the direct writing function. */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + TEST_ERROR; + + if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + TEST_ERROR; + + /* Close and re-open the dataset */ + if(H5Dclose(dataset) < 0) + TEST_ERROR; + if((dataset = H5Dopen2(filter_file, DATASETNAME2, H5P_DEFAULT)) < 0) + TEST_ERROR; + + /* Select hyperslab for the chunk just written in the file */ + start[0] = CHUNK_NX; start[1] = CHUNK_NY; + stride[0] = 1; stride[1] = 1; + count[0] = 1; count[1] = 1; + block[0] = CHUNK_NX; block[1] = CHUNK_NY; + if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + TEST_ERROR; + + /* Read the chunk back */ + if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + TEST_ERROR; + + /* Check that the values read are the same as the values written */ + for(ii = 0; ii < CHUNK_NX; ii++) { + for(jj = 0; jj < CHUNK_NY; jj++) { + if(direct_buf[ii][jj] != check_chunk[ii][jj]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", ii, jj); + HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[ii][jj], check_chunk[ii][jj]); + TEST_ERROR; + } + } + } + + /* Query chunk storage size */ + if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) + TEST_ERROR; + if(read_buf_size != buf_size) + TEST_ERROR; + + /* Read the raw chunk back with H5Dread_chunk */ + HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); + if((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) + TEST_ERROR; + if(read_filter_mask != filter_mask) + TEST_ERROR; + + /* Check that the direct chunk read is the same as the chunk written */ + for(ii = 0; ii < CHUNK_NX; ii++) { + for(jj = 0; jj < CHUNK_NY; jj++) { + if(direct_buf[ii][jj] != read_direct_buf[ii][jj]) { + HDprintf(" 1. Read different values than written."); + HDprintf(" At index %d,%d\n", ii, jj); + HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[ii][jj], read_direct_buf[ii][jj]); + TEST_ERROR; + } + } + } + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dataset, H5S_ALL, &nchunks) < 0) TEST_ERROR + if(nchunks != 1) TEST_ERROR + + /* Get and verify info of the first and only chunk */ + chk_index = 0; + reinit_vars(&read_flt_msk, &addr, &size); + if(H5Dget_chunk_info(dataset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, buf_size, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], CHUNK_NX, "H5Dget_chunk_info, offset"); + VERIFY(out_offset[1], CHUNK_NY, "H5Dget_chunk_info, offset"); + + /* Get info of the chunk at the specified offsets and verify its info */ + if(H5Dget_chunk_info_by_coord(dataset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, buf_size, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Release resourse */ + if(H5Dclose(dataset) < 0) TEST_ERROR + if(H5Sclose(mem_space) < 0) TEST_ERROR + if(H5Sclose(dataspace) < 0) TEST_ERROR + if(H5Pclose(cparms) < 0) TEST_ERROR + if(H5Pclose(dxpl) < 0) TEST_ERROR + if(H5Fclose(filter_file) < 0) TEST_ERROR + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dataset); + H5Sclose(mem_space); + H5Sclose(dataspace); + H5Pclose(cparms); + H5Pclose(dxpl); + H5Fclose(filter_file); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_filter_mask_with_skip_compress() */ + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Tests functions related to chunk information + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Binh-Minh Ribler + * November 5, 2018 + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + int nerrors = 0; /* Number of errors so far */ + + h5_reset(); + + /* Create a copy of file access property list */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + + /* Tests getting chunk information of version 1.8 and prior */ + nerrors += test_get_chunk_info_highest18(fapl) < 0 ? 1 : 0; + + /* Tests getting chunk information of version 1.10 */ + nerrors += test_get_chunk_info_110(fapl) < 0 ? 1 : 0; + + /* Tests getting filter mask when compression filter is skipped */ + nerrors += test_filter_mask_with_skip_compress(fapl) < 0 ? 1 : 0; + + if(nerrors) + TEST_ERROR + + HDprintf("All chunk query tests passed.\n"); + + h5_cleanup(FILENAME, fapl); + + return SUCCEED; + +error: + nerrors = MAX(1, nerrors); + HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n", + nerrors, 1 == nerrors ? "" : "S"); + return FAIL; +} + +/**************************************************************************** + Additional tests to be added: +- create/write to a dataset, do the query before closing the dataset +- do the query when extending the dataset (shrink or expand) +- verify that invalid input parameters are handled properly +- do the query on a non-chunked dataset... +- test for filter or non-filter + +****************************************************************************/ -- cgit v0.12 From 43ff3fdc33acfb46badb63d00971644821cbad25 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 28 Aug 2019 10:19:03 -0500 Subject: fix get gethostname for windows --- test/h5test.c | 2 +- testpar/CMakeLists.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/h5test.c b/test/h5test.c index 7cb5345..dd8d906 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1193,7 +1193,7 @@ h5_show_hostname(void) #endif #ifdef H5_HAVE_GETHOSTNAME - if (gethostname(hostname, (size_t)80) < 0) + if (HDgethostname(hostname, (size_t)80) < 0) HDprintf(" gethostname failed\n"); else HDprintf(" hostname=%s\n", hostname); diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 47a0e15..51c3420 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -47,11 +47,13 @@ MACRO (ADD_H5P_EXE file) TARGET_C_PROPERTIES (${file} STATIC) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} "$<$:${MPI_C_LIBRARIES}>" + $<$,$>:ws2_32.lib> ) else () TARGET_C_PROPERTIES (${file} SHARED) target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} "$<$:${MPI_C_LIBRARIES}>" + $<$,$>:ws2_32.lib> ) endif () set_target_properties (${file} PROPERTIES FOLDER test/par) -- cgit v0.12 From 6858ee6495a91929b6608c9eba486fe34399a98d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 28 Aug 2019 10:33:31 -0500 Subject: Added notes about HDFFV-10677 and HDFFV-10661 --- release_docs/RELEASE.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 202d39d..acec111 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -226,6 +226,17 @@ New Features (DER - 2019/03/15, HDFFV-2714, HDFFV-3914, HDFFV-3895, HDFFV-8237, HDFFV-10413, HDFFV-10691) + - Added new chunk query functions + + The following public functions were added to discover information about + the chunks in an HDF5 file. + herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks) + herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size) + herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size) + + (BMR - 2019/08/28, HDFFV-10677) + + Parallel Library: ----------------- - Changed the default behavior in parallel when reading the same dataset in its entirely @@ -492,6 +503,16 @@ Bug Fixes since HDF5-1.10.3 release (DER - 2019/06/18, HDFFV-10829) + - Some oversights in the index iterating area of the library caused + a callback function to continue iterating even though it's supposed + to stop. + + Added the returned value check to the for loop's conditions in + H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). The + iteration now stops when it should. + + (BMR - 2019/08/28, HDFFV-10661 and HDFFV-10677) + Java Library: ---------------- - JNI native library dependencies -- cgit v0.12 From 8cc3c58f9d1cd4094dc25022fb71578eee4424db Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 28 Aug 2019 10:36:40 -0500 Subject: Fixed typo --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index acec111..4a4b2d3 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -511,7 +511,7 @@ Bug Fixes since HDF5-1.10.3 release H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). The iteration now stops when it should. - (BMR - 2019/08/28, HDFFV-10661 and HDFFV-10677) + (BMR - 2019/08/28, HDFFV-10661) Java Library: ---------------- -- cgit v0.12 From 1efd23ff02b9bc1a3d303d53395245d1366588be Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 28 Aug 2019 11:11:32 -0500 Subject: Whitespace and HD prefix changes --- testpar/t_mdset.c | 592 +++++++++++++++++++++++++++--------------------------- 1 file changed, 294 insertions(+), 298 deletions(-) diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index e9f4101..63ac8d3 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -852,18 +852,18 @@ void collective_group_write_independent_group_read(void) */ void collective_group_write(void) { - int mpi_rank, mpi_size, size; - int i, j, m; - char gname[64], dname[32]; + int mpi_rank, mpi_size, size; + int i, j, m; + char gname[64], dname[32]; hid_t fid, gid, did, plist, dcpl, memspace, filespace; - DATATYPE * outme = NULL; - hsize_t chunk_origin[DIM]; - hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; - hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */ - herr_t ret1, ret2; + DATATYPE *outme = NULL; + hsize_t chunk_origin[DIM]; + hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; + hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */ + herr_t ret1, ret2; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -920,8 +920,7 @@ void collective_group_write(void) for(j = 0; j < size; j++) outme[(i * size) + j] =(i + j) * 1000 + mpi_rank; - H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, - outme); + H5Dwrite(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, outme); H5Dclose(did); H5Gclose(gid); @@ -951,7 +950,7 @@ void independent_group_read(void) hid_t plist, fid; const H5Ptest_param_t *pt; char *filename; - int ngroups; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -1071,16 +1070,16 @@ group_dataset_read(hid_t fid, int mpi_rank, int m) */ void multiple_group_write(void) { - int mpi_rank, mpi_size, size; - int m; - char gname[64]; - hid_t fid, gid, plist, memspace, filespace; + int mpi_rank, mpi_size, size; + int m; + char gname[64]; + hid_t fid, gid, plist, memspace, filespace; hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; - herr_t ret; + herr_t ret; const H5Ptest_param_t *pt; - char *filename; - int ngroups; + char *filename; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -1162,11 +1161,11 @@ void multiple_group_write(void) static void write_dataset(hid_t memspace, hid_t filespace, hid_t gid) { - int i, j, n, size; - int mpi_rank, mpi_size; - char dname[32]; - DATATYPE * outme = NULL; - hid_t did; + int i, j, n, size; + int mpi_rank, mpi_size; + char dname[32]; + DATATYPE *outme = NULL; + hid_t did; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1248,7 +1247,7 @@ void multiple_group_read(void) hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; const H5Ptest_param_t *pt; char *filename; - int ngroups; + int ngroups; pt = GetTestParameters(); filename = pt->name; @@ -1323,10 +1322,10 @@ void multiple_group_read(void) static int read_dataset(hid_t memspace, hid_t filespace, hid_t gid) { - int i, j, n, mpi_rank, mpi_size, size, attr_errors=0, vrfy_errors=0; - char dname[32]; + int i, j, n, mpi_rank, mpi_size, size, attr_errors=0, vrfy_errors=0; + char dname[32]; DATATYPE *outdata = NULL, *indata = NULL; - hid_t did; + hid_t did; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -1344,8 +1343,7 @@ read_dataset(hid_t memspace, hid_t filespace, hid_t gid) did = H5Dopen2(gid, dname, H5P_DEFAULT); VRFY((did>0), dname); - H5Dread(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, - indata); + H5Dread(did, H5T_NATIVE_INT, memspace, filespace, H5P_DEFAULT, indata); /* this is the original value */ for(i=0; i MAX_ERR_REPORT && !VERBOSE_MED) HDprintf("[more errors ...]\n"); if(err_num) @@ -1740,8 +1738,8 @@ void io_mode_confusion(void) status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); VRFY((status >= 0 ), "H5Pset_dxpl_mpio() failed"); if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - status = H5Pset_dxpl_mpio_collective_opt(plist_id, H5FD_MPIO_INDIVIDUAL_IO); - VRFY((status>= 0),"set independent IO collectively succeeded"); + status = H5Pset_dxpl_mpio_collective_opt(plist_id, H5FD_MPIO_INDIVIDUAL_IO); + VRFY((status>= 0),"set independent IO collectively succeeded"); } @@ -1967,10 +1965,10 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) int steps_done = 0; /* test bed related variables */ - const char * fcn_name = "rr_obj_hdr_flush_confusion_writer"; - const hbool_t verbose = FALSE; - const H5Ptest_param_t * pt; - char * filename; + const char *fcn_name = "rr_obj_hdr_flush_confusion_writer"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t *pt; + char *filename; /* * setup test bed related variables: @@ -2067,19 +2065,19 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) } for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, - NULL, disk_count, NULL); + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + NULL, disk_count, NULL); VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); mem_space[i] = H5Screate_simple(1, mem_size, NULL); - VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); - err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, - mem_start, NULL, mem_count, NULL); + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + mem_start, NULL, mem_count, NULL); VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); - err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], - disk_space[i], dxpl_id, data); + err = H5Dwrite(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + disk_space[i], dxpl_id, data); VRFY((err >= 0), "H5Dwrite(1) failed.\n"); for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - data[j] *= 10.0; + data[j] *= 10.0; } /* @@ -2127,7 +2125,7 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) for ( i = 0; i < NUM_DATA_SETS; i++ ) { att_space[i] = H5Screate_simple(1, att_size, NULL); VRFY((att_space[i] >= 0), "H5Screate_simple(3) failed.\n"); - att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, + att_id[i] = H5Acreate2(dataset[i], att_name[i], H5T_NATIVE_DOUBLE, att_space[i], H5P_DEFAULT, H5P_DEFAULT); VRFY((att_id[i] >= 0), "H5Acreate(1) failed.\n"); err = H5Awrite(att_id[i], H5T_NATIVE_DOUBLE, att); @@ -2146,7 +2144,6 @@ void rr_obj_hdr_flush_confusion_writer(MPI_Comm comm) mpi_rank, fcn_name); for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sclose(att_space[i]); VRFY((err >= 0), "H5Sclose(att_space[i]) failed.\n"); err = H5Aclose(att_id[i]); @@ -2350,20 +2347,20 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* MPI variables */ /* world communication size and rank */ - int mpi_world_size; - int mpi_world_rank; + int mpi_world_size; + int mpi_world_rank; /* private communicator size and rank */ - int mpi_size; - int mpi_rank; - int mrc; /* mpi error code */ + int mpi_size; + int mpi_rank; + int mrc; /* mpi error code */ int steps = -1; /* How far (steps) to verify the file */ int steps_done = -1; /* How far (steps) have been verified */ /* test bed related variables */ - const char * fcn_name = "rr_obj_hdr_flush_confusion_reader"; - const hbool_t verbose = FALSE; - const H5Ptest_param_t * pt; - char * filename; + const char *fcn_name = "rr_obj_hdr_flush_confusion_reader"; + const hbool_t verbose = FALSE; + const H5Ptest_param_t *pt; + char *filename; /* * setup test bed related variables: @@ -2380,291 +2377,290 @@ void rr_obj_hdr_flush_confusion_reader(MPI_Comm comm) /* Repeatedly re-open the file and verify its contents until it is */ /* told to end (when steps=0). */ while (steps_done != 0){ - Reader_wait(mrc, steps); - VRFY((mrc >= 0), "Reader_wait failed"); - steps_done = 0; + Reader_wait(mrc, steps); + VRFY((mrc >= 0), "Reader_wait failed"); + steps_done = 0; - if (steps > 0 ){ - /* - * Set up file access property list with parallel I/O access - */ + if (steps > 0 ){ + /* + * Set up file access property list with parallel I/O access + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Setting up property list.\n", - mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up property list.\n", + mpi_rank, fcn_name); - fapl_id = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); - err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); - VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id != -1), "H5Pcreate(H5P_FILE_ACCESS) failed"); + err = H5Pset_fapl_mpio(fapl_id, comm, MPI_INFO_NULL); + VRFY((err >= 0 ), "H5Pset_fapl_mpio() failed"); - /* - * Create a new file collectively and release property list identifier. - */ + /* + * Create a new file collectively and release property list identifier. + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", - mpi_rank, fcn_name, filename); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Re-open file \"%s\".\n", + mpi_rank, fcn_name, filename); - file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); - VRFY((file_id >= 0 ), "H5Fopen() failed"); - err = H5Pclose(fapl_id); - VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); + file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl_id); + VRFY((file_id >= 0 ), "H5Fopen() failed"); + err = H5Pclose(fapl_id); + VRFY((err >= 0 ), "H5Pclose(fapl_id) failed"); #if 1 - if (steps >= 1){ - /*=====================================================* - * Step 1: open the data sets and read data. - *=====================================================*/ + if (steps >= 1){ + /*=====================================================* + * Step 1: open the data sets and read data. + *=====================================================*/ - if(verbose ) - HDfprintf(stdout, "%0d:%s: opening the datasets.\n", - mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: opening the datasets.\n", + mpi_rank, fcn_name); - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - dataset[i] = -1; - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = -1; + } - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT); - VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n"); - disk_space[i] = H5Dget_space(dataset[i]); - VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n"); - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + dataset[i] = H5Dopen2(file_id, dataset_name[i], H5P_DEFAULT); + VRFY((dataset[i] >= 0), "H5Dopen(1) failed.\n"); + disk_space[i] = H5Dget_space(dataset[i]); + VRFY((disk_space[i] >= 0), "H5Dget_space failed.\n"); + } - /* - * setup data transfer property list - */ + /* + * setup data transfer property list + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Setting up dxpl.\n", mpi_rank, fcn_name); - dxpl_id = H5Pcreate(H5P_DATASET_XFER); - VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); - err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); - VRFY((err >= 0), - "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); + dxpl_id = H5Pcreate(H5P_DATASET_XFER); + VRFY((dxpl_id != -1), "H5Pcreate(H5P_DATASET_XFER) failed.\n"); + err = H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE); + VRFY((err >= 0), + "H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) failed.\n"); - /* - * read data from the data sets - */ + /* + * read data from the data sets + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: Reading datasets.\n", mpi_rank, fcn_name); - disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); - disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); + disk_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + disk_start[0] = (hsize_t)(LOCAL_DATA_SIZE * mpi_rank); - mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_size[0] = (hsize_t)(LOCAL_DATA_SIZE); - mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); - mem_start[0] = (hsize_t)(0); + mem_count[0] = (hsize_t)(LOCAL_DATA_SIZE); + mem_start[0] = (hsize_t)(0); - /* set up expected data for verification */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { - data[j] = (double)(mpi_rank + 1); - } + /* set up expected data for verification */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + data[j] = (double)(mpi_rank + 1); + } - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, - NULL, disk_count, NULL); - VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); - mem_space[i] = H5Screate_simple(1, mem_size, NULL); - VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); - err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, - mem_start, NULL, mem_count, NULL); - VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); - err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], - disk_space[i], dxpl_id, data_read); - VRFY((err >= 0), "H5Dread(1) failed.\n"); - - /* compare read data with expected data */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (data_read[j] != data[j]){ - HDfprintf(stdout, - "%0d:%s: Reading datasets value failed in " - "Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, data[j], data_read[j]); - nerrors++; - } - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - data[j] *= 10.0; - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sselect_hyperslab(disk_space[i], H5S_SELECT_SET, disk_start, + NULL, disk_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(1) failed.\n"); + mem_space[i] = H5Screate_simple(1, mem_size, NULL); + VRFY((mem_space[i] >= 0), "H5Screate_simple(2) failed.\n"); + err = H5Sselect_hyperslab(mem_space[i], H5S_SELECT_SET, + mem_start, NULL, mem_count, NULL); + VRFY((err >= 0), "H5Sselect_hyperslab(2) failed.\n"); + err = H5Dread(dataset[i], H5T_NATIVE_DOUBLE, mem_space[i], + disk_space[i], dxpl_id, data_read); + VRFY((err >= 0), "H5Dread(1) failed.\n"); + + /* compare read data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (data_read[j] != data[j]){ + HDfprintf(stdout, + "%0d:%s: Reading datasets value failed in " + "Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, data[j], data_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + data[j] *= 10.0; + } - /* - * close the data spaces - */ + /* + * close the data spaces + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dataspaces.\n", mpi_rank, fcn_name); - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - err = H5Sclose(disk_space[i]); - VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); - err = H5Sclose(mem_space[i]); - VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); - } - steps_done++; - } - /* End of Step 1: open the data sets and read data. */ + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + err = H5Sclose(disk_space[i]); + VRFY((err >= 0), "H5Sclose(disk_space[i]) failed.\n"); + err = H5Sclose(mem_space[i]); + VRFY((err >= 0), "H5Sclose(mem_space[i]) failed.\n"); + } + steps_done++; + } + /* End of Step 1: open the data sets and read data. */ #endif #if 1 - /*=====================================================* - * Step 2: reading attributes from each dataset - *=====================================================*/ - - if (steps >= 2){ - if(verbose ) - HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name); - - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + /*=====================================================* + * Step 2: reading attributes from each dataset + *=====================================================*/ - att[j] = (double)(j + 1); - } + if (steps >= 2){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading attributes.\n", mpi_rank, fcn_name); - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - hid_t att_id, att_type; - - att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT); - VRFY((att_id >= 0), "H5Aopen failed.\n"); - att_type = H5Aget_type(att_id); - VRFY((att_type >= 0), "H5Aget_type failed.\n"); - tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE); - VRFY((tri_err >= 0), "H5Tequal failed.\n"); - if (tri_err==0){ - HDfprintf(stdout, - "%0d:%s: Mismatched Attribute type of Dataset %d.\n", - mpi_rank, fcn_name, i); - nerrors++; - }else{ - /* should verify attribute size before H5Aread */ - err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read); - VRFY((err >= 0), "H5Aread failed.\n"); - /* compare read attribute data with expected data */ - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) - if (att_read[j] != att[j]){ - HDfprintf(stdout, - "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, att[j], att_read[j]); - nerrors++; + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + att[j] = (double)(j + 1); } - for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { - att[j] /= 10.0; - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + hid_t att_id, att_type; + + att_id = H5Aopen(dataset[i], att_name[i], H5P_DEFAULT); + VRFY((att_id >= 0), "H5Aopen failed.\n"); + att_type = H5Aget_type(att_id); + VRFY((att_type >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(att_type, H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + } + else { + /* should verify attribute size before H5Aread */ + err = H5Aread(att_id, H5T_NATIVE_DOUBLE, att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) + if (att_read[j] != att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, att[j], att_read[j]); + nerrors++; + } + for ( j = 0; j < LOCAL_DATA_SIZE; j++ ) { + att[j] /= 10.0; + } + } + err = H5Aclose(att_id); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + steps_done++; } - err = H5Aclose(att_id); - VRFY((err >= 0), "H5Aclose failed.\n"); - } - steps_done++; - } - /* End of Step 2: reading attributes from each dataset */ + /* End of Step 2: reading attributes from each dataset */ #endif #if 1 - /*=====================================================* - * Step 3 or 4: read large attributes from each dataset. - * Step 4 has different attribute value from step 3. - *=====================================================*/ - - if (steps >= 3){ - if(verbose ) - HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name); + /*=====================================================* + * Step 3 or 4: read large attributes from each dataset. + * Step 4 has different attribute value from step 3. + *=====================================================*/ - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + if (steps >= 3){ + if(verbose ) + HDfprintf(stdout, "%0d:%s: reading large attributes.\n", mpi_rank, fcn_name); - lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2); - } - - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT); - VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n"); - lg_att_type[i] = H5Aget_type(lg_att_id[i]); - VRFY((err >= 0), "H5Aget_type failed.\n"); - tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE); - VRFY((tri_err >= 0), "H5Tequal failed.\n"); - if (tri_err==0){ - HDfprintf(stdout, - "%0d:%s: Mismatched Large attribute type of Dataset %d.\n", - mpi_rank, fcn_name, i); - nerrors++; - }else{ - /* should verify large attribute size before H5Aread */ - err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read); - VRFY((err >= 0), "H5Aread failed.\n"); - /* compare read attribute data with expected data */ - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) - if (lg_att_read[j] != lg_att[j]){ - HDfprintf(stdout, - "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", - mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); - nerrors++; + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + lg_att[j] = (steps==3) ? (double)(j + 1) : (double)(j+2); } - for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { - lg_att[j] /= 10.0; - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + lg_att_id[i] = H5Aopen(dataset[i], lg_att_name[i], H5P_DEFAULT); + VRFY((lg_att_id[i] >= 0), "H5Aopen(2) failed.\n"); + lg_att_type[i] = H5Aget_type(lg_att_id[i]); + VRFY((err >= 0), "H5Aget_type failed.\n"); + tri_err = H5Tequal(lg_att_type[i], H5T_NATIVE_DOUBLE); + VRFY((tri_err >= 0), "H5Tequal failed.\n"); + if (tri_err==0){ + HDfprintf(stdout, + "%0d:%s: Mismatched Large attribute type of Dataset %d.\n", + mpi_rank, fcn_name, i); + nerrors++; + } + else{ + /* should verify large attribute size before H5Aread */ + err = H5Aread(lg_att_id[i], H5T_NATIVE_DOUBLE, lg_att_read); + VRFY((err >= 0), "H5Aread failed.\n"); + /* compare read attribute data with expected data */ + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) + if (lg_att_read[j] != lg_att[j]){ + HDfprintf(stdout, + "%0d:%s: Mismatched large attribute data read in Dataset %d, at position %d: expect %f, got %f.\n", + mpi_rank, fcn_name, i, j, lg_att[j], lg_att_read[j]); + nerrors++; + } + for ( j = 0; j < LARGE_ATTR_SIZE; j++ ) { + + lg_att[j] /= 10.0; + } + } + err = H5Tclose(lg_att_type[i]); + VRFY((err >= 0), "H5Tclose failed.\n"); + err = H5Aclose(lg_att_id[i]); + VRFY((err >= 0), "H5Aclose failed.\n"); + } + /* Both step 3 and 4 use this same read checking code. */ + steps_done = (steps==3) ? 3 : 4; } - err = H5Tclose(lg_att_type[i]); - VRFY((err >= 0), "H5Tclose failed.\n"); - err = H5Aclose(lg_att_id[i]); - VRFY((err >= 0), "H5Aclose failed.\n"); - } - /* Both step 3 and 4 use this same read checking code. */ - steps_done = (steps==3) ? 3 : 4; - } - /* End of Step 3 or 4: read large attributes from each dataset */ + /* End of Step 3 or 4: read large attributes from each dataset */ #endif - /*=====================================================* - * Step 5: read all objects from the file - *=====================================================*/ - if (steps>=5){ - /* nothing extra to verify. The file is closed normally. */ - /* Just increment steps_done */ - steps_done++; - } + /*=====================================================* + * Step 5: read all objects from the file + *=====================================================*/ + if (steps>=5){ + /* nothing extra to verify. The file is closed normally. */ + /* Just increment steps_done */ + steps_done++; + } - /* - * Close the data sets - */ + /* + * Close the data sets + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing datasets again.\n", - mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing datasets again.\n", + mpi_rank, fcn_name); - for ( i = 0; i < NUM_DATA_SETS; i++ ) { - if ( dataset[i] >= 0 ) { - err = H5Dclose(dataset[i]); - VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); - } - } + for ( i = 0; i < NUM_DATA_SETS; i++ ) { + if ( dataset[i] >= 0 ) { + err = H5Dclose(dataset[i]); + VRFY((err >= 0), "H5Dclose(dataset[i])1 failed.\n"); + } + } - /* - * close the data transfer property list. - */ + /* + * close the data transfer property list. + */ - if(verbose ) - HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); + if(verbose ) + HDfprintf(stdout, "%0d:%s: closing dxpl .\n", mpi_rank, fcn_name); - err = H5Pclose(dxpl_id); - VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); + err = H5Pclose(dxpl_id); + VRFY((err >= 0), "H5Pclose(dxpl_id) failed.\n"); - /* - * Close the file - */ - if(verbose) - HDfprintf(stdout, "%0d:%s: closing file again.\n", - mpi_rank, fcn_name); - err = H5Fclose(file_id); - VRFY((err >= 0 ), "H5Fclose(1) failed"); + /* + * Close the file + */ + if(verbose) + HDfprintf(stdout, "%0d:%s: closing file again.\n", + mpi_rank, fcn_name); + err = H5Fclose(file_id); + VRFY((err >= 0 ), "H5Fclose(1) failed"); - } /* else if (steps_done==0) */ - Reader_result(mrc, steps_done); + } /* else if (steps_done==0) */ + Reader_result(mrc, steps_done); } /* end while(1) */ if(verbose ) -- cgit v0.12 From 3adadb92e26b4f8263dd7bbca2007496e67032d4 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 28 Aug 2019 18:06:51 -0500 Subject: Re-ordered items w.r.t. date. --- release_docs/RELEASE.txt | 99 ++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4a4b2d3..37dec3e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -191,10 +191,15 @@ New Features Library: -------- - - Add new API H5M for map objects. Currently not supported by native - library, can be supported by VOL connectors. + - Added new chunk query functions - (NAF - 2019/03/01) + The following public functions were added to discover information about + the chunks in an HDF5 file. + herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks) + herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size) + herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size) + + (BMR - 2019/06/11, HDFFV-10677) - Improved the performance of virtual dataset I/O @@ -204,19 +209,6 @@ New Features (NAF - 2019/05/31, HDFFV-10693) - - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. - - Rather than always running H5detect and generating H5Tinit.c and - H5make_libsettings.c, supply a location for those files. - - (ADB - 2018/09/18, HDFFV-10332) - - - Remove H5I_REFERENCE from the library - - This ID class was never used by the library and has been removed. - - (DER - 2018/12/08, HDFFV-10252) - - Added the ability to open files with UTF-8 file names on Windows. The POSIX open(2) API call on Windows is limited to ASCII @@ -226,15 +218,23 @@ New Features (DER - 2019/03/15, HDFFV-2714, HDFFV-3914, HDFFV-3895, HDFFV-8237, HDFFV-10413, HDFFV-10691) - - Added new chunk query functions + - Add new API H5M for map objects. Currently not supported by native + library, can be supported by VOL connectors. - The following public functions were added to discover information about - the chunks in an HDF5 file. - herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks) - herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size) - herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size) + (NAF - 2019/03/01) + + - Remove H5I_REFERENCE from the library + + This ID class was never used by the library and has been removed. - (BMR - 2019/08/28, HDFFV-10677) + (DER - 2018/12/08, HDFFV-10252) + + - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used. + + Rather than always running H5detect and generating H5Tinit.c and + H5make_libsettings.c, supply a location for those files. + + (ADB - 2018/09/18, HDFFV-10332) Parallel Library: @@ -268,17 +268,17 @@ New Features C++ Library: ------------ - - Added new wrapper for H5Ovisit2() - H5Object::visit() - - (BMR - 2019/02/14, HDFFV-10532) - - Added new wrappers for H5Pset/get_create_intermediate_group() LinkCreatPropList::setCreateIntermediateGroup() LinkCreatPropList::getCreateIntermediateGroup() (BMR - 2019/04/22, HDFFV-10622) + - Added new wrapper for H5Ovisit2() + H5Object::visit() + + (BMR - 2019/02/14, HDFFV-10532) + Java Library: ---------------- @@ -384,6 +384,18 @@ Bug Fixes since HDF5-1.10.3 release (VC - 2019/6/25, HDFFV-10808) + - When iterating over an old-style group (i.e., when not using the latest + file format) of size 0, a NULL pointer representing the empty links + table would be sent to qsort(3) for sorting, which is undefined behavior. + + Iterating over an empty group is explicitly tested in the links test. + This has not caused any failures to date and was flagged by gcc's + -fsanitize=undefined. + + The library no longer attempts to sort an empty array. + + (DER - 2019/06/18, HDFFV-10829) + - Fixed an issue where copying a version 1.8 dataset between files using H5Ocopy fails due to an incompatible fill version @@ -397,6 +409,16 @@ Bug Fixes since HDF5-1.10.3 release (VC - 2019/6/14, HDFFV-10800) + - Some oversights in the index iterating area of the library caused + a callback function to continue iterating even though it's supposed + to stop. + + Added the returned value check to the for loop's conditions in + H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). The + iteration now stops when it should. + + (BMR - 2019/06/11, HDFFV-10661) + - Fixed a bug that would cause an error or cause fill values to be incorrectly read from a chunked dataset using the "single chunk" index if the data was held in cache and there was no data on disk. @@ -491,27 +513,6 @@ Bug Fixes since HDF5-1.10.3 release (JTH - 2018/08/25, HDFFV-10501) - - When iterating over an old-style group (i.e., when not using the latest - file format) of size 0, a NULL pointer representing the empty links - table would be sent to qsort(3) for sorting, which is undefined behavior. - - Iterating over an empty group is explicitly tested in the links test. - This has not caused any failures to date and was flagged by gcc's - -fsanitize=undefined. - - The library no longer attempts to sort an empty array. - - (DER - 2019/06/18, HDFFV-10829) - - - Some oversights in the index iterating area of the library caused - a callback function to continue iterating even though it's supposed - to stop. - - Added the returned value check to the for loop's conditions in - H5EA_iterate(), H5FA_iterate(), and H5D__none_idx_iterate(). The - iteration now stops when it should. - - (BMR - 2019/08/28, HDFFV-10661) Java Library: ---------------- -- cgit v0.12 From a633e333346eef38bf689b6a8edb817c732298c0 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 29 Aug 2019 00:53:40 -0500 Subject: Code cleanup and refactor --- src/H5Dchunk.c | 4 -- test/chunk_info.c | 115 ++++++++++++++++++++++-------------------------------- 2 files changed, 47 insertions(+), 72 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4976075..86639e6 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -7143,8 +7143,6 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */ H5D_rdcc_ent_t *ent; /* Cache entry index */ hsize_t ii = 0; /* Dimension index */ - hsize_t nchunks = 0; /* Number of chunks in this dset */ - hsize_t scaled[H5S_MAX_RANK]; herr_t ret_value = SUCCEED;/* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) @@ -7279,8 +7277,6 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* H5D_rdcc_ent_t *ent; /* Cache entry index */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_info_iter_ud_t udata; /* User data for callback */ - H5D_chunk_ud_t udata2; - hsize_t scaled[H5S_MAX_RANK]; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) diff --git a/test/chunk_info.c b/test/chunk_info.c index 9a4660c..bdc9bbc 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -40,21 +40,6 @@ #include "testhdf5.h" #include "zlib.h" -/* Used to make certain an offset is as expected */ -#define VERIFY_VAR(_x, _val, where, var) do { \ - long __x = (long)_x, __val = (long)_val; \ - if(VERBOSE_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, __x); \ - } \ - if((__x) != (__val)) { \ - TestErrPrintf("*** UNEXPECTED VALUE from %s, %s should be %ld," \ - " but is %ld at line %4d in %s\n", \ - (where), (var), __val, __x, (int)__LINE__, __FILE__); \ - H5Eprint2(H5E_DEFAULT, stdout); \ - } \ -} while(0) - /* Test file names, using H5F_libver_t as indices */ const char *FILENAME[] = { "tchunk_info_earliest", @@ -63,10 +48,9 @@ const char *FILENAME[] = { "tchunk_info_112", NULL }; -#define FILTERMASK_FILE "tfilter_mask.h5" -/* From original test */ -#define DATASETNAME "2d" +/* File to be used in test_failed_attempts */ +#define FILTERMASK_FILE "tfilter_mask.h5" /* Parameters for testing chunk querying */ #define RANK 2 @@ -193,7 +177,6 @@ test_get_chunk_info_highest18(hid_t fapl) hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ @@ -499,6 +482,38 @@ error: return FAIL; } /* test_get_chunk_info_highest18() */ + +/*------------------------------------------------------------------------- + * Function: verify_idx_type + * + * Purpose: Helper function to ensure that the correct chunk indexing + * scheme is being used. + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static htri_t +verify_idx_type(hid_t dset, H5D_chunk_index_t expected_idx_type) +{ + H5D_chunk_index_t idx_type; + + /* Get the chunk indexing type of the dataset */ + if(H5Dget_chunk_index_type(dset, &idx_type) < 0) + TEST_ERROR + + /* Simply return FALSE, not FAIL, if the dataset's indexing type is + not as expected */ + if(idx_type != expected_idx_type) + return FALSE; + + /* Indicating that the correct chunk indexing type is used */ + return TRUE; + +error: + return FAIL; +} + /*------------------------------------------------------------------------- * Function: test_chunk_info_single_chunk * @@ -519,16 +534,15 @@ error: static herr_t test_chunk_info_single_chunk(char *filename, hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ - hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */ int in_buf[NX][NY]; /* Input buffer */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -536,7 +550,7 @@ test_chunk_info_single_chunk(char *filename, hid_t fapl) haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ int ii, jj; -herr_t ret = 0; + herr_t ret = 0; TESTING(" Single Chunk index"); @@ -560,9 +574,7 @@ herr_t ret = 0; if(dset < 0) TEST_ERROR /* Ensure we're using the correct chunk indexing scheme */ - if(H5D__layout_idx_type_test(dset, &idx_type) < 0) - TEST_ERROR - if(idx_type != H5D_CHUNK_IDX_SINGLE) + if(verify_idx_type(dset, H5D_CHUNK_IDX_SINGLE) == FALSE) FAIL_PUTS_ERROR("Should be using Single Chunk index type"); /* Close the dataset then... */ @@ -620,14 +632,6 @@ herr_t ret = 0; if(ret != FAIL) TEST_ERROR - /* Get info of the chunk at logical coordinates (0,0) */ - offset[0] = 0; - offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR if(H5Sclose(dspace) < 0) TEST_ERROR @@ -677,19 +681,15 @@ test_chunk_info_implicit(char *filename, hid_t fapl) hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int read_direct_chunk[CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int aggression = 9; /* Compression aggression setting */ int n; /* Used on buffer, to avoid conversion warning*/ hsize_t ii, jj; herr_t ret; @@ -719,10 +719,7 @@ test_chunk_info_implicit(char *filename, hid_t fapl) if(dset < 0) TEST_ERROR /* Ensure we're using the correct chunk indexing scheme */ - if(H5D__layout_idx_type_test(dset, &idx_type) < 0) - TEST_ERROR - - if(idx_type != H5D_CHUNK_IDX_NONE) /* Implicit: No Index */ + if(verify_idx_type(dset, H5D_CHUNK_IDX_NONE) == FALSE) FAIL_PUTS_ERROR("Should be using Implicit index type"); /* Close the dataset then... */ @@ -853,7 +850,6 @@ test_chunk_info_fixed_array(char *filename, hid_t fapl) size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -886,9 +882,7 @@ test_chunk_info_fixed_array(char *filename, hid_t fapl) if(dset < 0) TEST_ERROR /* Ensure we're using the correct chunk indexing scheme */ - if(H5D__layout_idx_type_test(dset, &idx_type) < 0) - TEST_ERROR - if(idx_type != H5D_CHUNK_IDX_FARRAY) + if(verify_idx_type(dset, H5D_CHUNK_IDX_FARRAY) == FALSE) FAIL_PUTS_ERROR("Should be using Fixed Array index type"); /* Close the dataset then... */ @@ -1066,11 +1060,9 @@ test_chunk_info_extensible_array(char *filename, hid_t fapl) hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -1103,9 +1095,7 @@ test_chunk_info_extensible_array(char *filename, hid_t fapl) if(dset < 0) TEST_ERROR /* Ensure we're using the correct chunk indexing scheme */ - if(H5D__layout_idx_type_test(dset, &idx_type) < 0) - TEST_ERROR - if(idx_type != H5D_CHUNK_IDX_EARRAY) + if(verify_idx_type(dset, H5D_CHUNK_IDX_EARRAY) == FALSE) FAIL_PUTS_ERROR("Should be using Extensible Array index type"); /* Close the dataset then... */ @@ -1287,11 +1277,9 @@ test_chunk_info_version2_btrees(char *filename, hid_t fapl) hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -1324,9 +1312,7 @@ test_chunk_info_version2_btrees(char *filename, hid_t fapl) if(dset < 0) TEST_ERROR /* Ensure we're using the correct chunk indexing scheme */ - if(H5D__layout_idx_type_test(dset, &idx_type) < 0) - TEST_ERROR - if(idx_type != H5D_CHUNK_IDX_BT2) + if(verify_idx_type(dset, H5D_CHUNK_IDX_BT2) == FALSE) FAIL_PUTS_ERROR("Should be using Version 2 B-tree index type"); /* Close the dataset then... */ @@ -1502,13 +1488,9 @@ test_failed_attempts(char *filename, hid_t fapl) hid_t chunkfile = H5I_INVALID_HID; /* File ID */ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ - hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */ int in_buf[NX][NY]; /* Input buffer */ - unsigned filter_mask = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ @@ -1765,11 +1747,10 @@ test_filter_mask_with_skip_compress(hid_t fapl) /* Indicate the compression filter is to be skipped. */ filter_mask = 0x00000001; - /* Write the uncompressed data chunk repeatedly to fill the dataset, - using the direct writing function. */ + /* Write a chunk of uncompressed data */ offset[0] = CHUNK_NX; offset[1] = CHUNK_NY; - if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0) + if((status = H5Dwrite_chunk(dataset, H5P_DEFAULT, filter_mask, offset, buf_size, direct_buf)) < 0) TEST_ERROR; if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) @@ -1931,7 +1912,5 @@ error: - create/write to a dataset, do the query before closing the dataset - do the query when extending the dataset (shrink or expand) - verify that invalid input parameters are handled properly -- do the query on a non-chunked dataset... -- test for filter or non-filter ****************************************************************************/ -- cgit v0.12 From fa540a3af8a5ad3d201223aa0baf26819437e108 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 29 Aug 2019 10:36:12 -0500 Subject: Add 32-bit cross-compile toolchain --- MANIFEST | 1 + config/toolchain/build32.cmake | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 config/toolchain/build32.cmake diff --git a/MANIFEST b/MANIFEST index 1232411..622c339 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3263,6 +3263,7 @@ ./java/lib/ext/slf4j-simple-1.7.25.jar # CMake-specific Files +./config/toolchain/build32.cmake ./config/toolchain/crayle.cmake ./config/toolchain/GCC.cmake ./config/toolchain/intel.cmake diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake new file mode 100644 index 0000000..99b3013 --- /dev/null +++ b/config/toolchain/build32.cmake @@ -0,0 +1,37 @@ +if (WIN32) + set (CMAKE_SYSTEM_NAME Windows) + set (CMAKE_GENERATOR_PLATFORM "x86") +else () + set (CMAKE_SYSTEM_NAME Linux) + + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -msse2" CACHE STRING "c++ flags") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -msse2" CACHE STRING "c flags") + + set (LIB32 /usr/lib) # Fedora + + if (EXISTS /usr/lib32) + set (LIB32 /usr/lib32) # Arch, Solus + endif () + + set (CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE) + set (CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE) + + # this is probably unlikely to be needed, but just in case + set (CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE) + set (CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE) + set (CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE) + + # on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have + # to include the regular system .pc files as well (at the end), because some + # are not always present in the 32 bit directory + if (EXISTS ${LIB32}/pkgconfig) + set (ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) + endif () +# where is the target environment + set (CMAKE_FIND_ROOT_PATH ${LIB32}) +# search for programs in the build host directories + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif () \ No newline at end of file -- cgit v0.12 From ed4cbbcc9bbda6c81f19fb4e7c04e948b46ce6fc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 29 Aug 2019 13:18:35 -0500 Subject: Update settings --- config/toolchain/build32.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake index 99b3013..3d9197d 100644 --- a/config/toolchain/build32.cmake +++ b/config/toolchain/build32.cmake @@ -1,11 +1,13 @@ if (WIN32) set (CMAKE_SYSTEM_NAME Windows) set (CMAKE_GENERATOR_PLATFORM "x86") +elseif(APPLE) + set (CMAKE_OSX_ARCHITECTURES "i386") else () set (CMAKE_SYSTEM_NAME Linux) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -msse2" CACHE STRING "c++ flags") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -msse2" CACHE STRING "c flags") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") set (LIB32 /usr/lib) # Fedora -- cgit v0.12 From 0b6f5e88cd9215ff9daafda865ebe6d4794a6012 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 29 Aug 2019 14:43:35 -0500 Subject: Fix EXISTS test syntax --- config/cmake/CMakeFindJavaCommon.cmake | 2 +- config/cmake/UseJava.cmake | 2 +- config/cmake/jrunTest.cmake | 10 +++++----- config/cmake/vfdTest.cmake | 8 ++++---- config/cmake/volTest.cmake | 8 ++++---- config/cmake_ext_mod/grepTest.cmake | 8 ++++---- config/cmake_ext_mod/runTest.cmake | 10 +++++----- config/toolchain/build32.cmake | 4 ++-- src/CMakeLists.txt | 2 +- test/flushrefreshTest.cmake | 14 +++++++------- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/config/cmake/CMakeFindJavaCommon.cmake b/config/cmake/CMakeFindJavaCommon.cmake index eabb622..528791d 100644 --- a/config/cmake/CMakeFindJavaCommon.cmake +++ b/config/cmake/CMakeFindJavaCommon.cmake @@ -16,7 +16,7 @@ else() set(_JAVA_HOME_EXPLICIT 1) else() set(_CMD_JAVA_HOME "") - if(APPLE AND EXISTS /usr/libexec/java_home) + if(APPLE AND EXISTS "/usr/libexec/java_home") execute_process(COMMAND /usr/libexec/java_home OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE) endif() diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 1f6b04c..8efee11 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -634,7 +634,7 @@ function(add_jar _TARGET_NAME) ) else () # create an empty java_class_filelist - if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) + if (NOT EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist") file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") endif() endif () diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index fa687f5..e736b7a 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -33,11 +33,11 @@ if (NOT TEST_CLASSPATH) message (STATUS "Require TEST_CLASSPATH to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -73,7 +73,7 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") @@ -123,7 +123,7 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}") # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") if (WIN32 OR MINGW) configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) @@ -254,7 +254,7 @@ if (TEST_GREP_COMPARE) string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (TEST_EXPECT) - # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match + # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (TEST_RESULT) message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 3556d07..12ee40b 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -23,11 +23,11 @@ if (NOT TEST_VFD) message (FATAL_ERROR "Require TEST_VFD to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -54,7 +54,7 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) +if (ERROR_APPEND AND EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") endif () @@ -62,7 +62,7 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM) message (STATUS "Output USING ${TEST_VFD}:\n${TEST_STREAM}") endif () diff --git a/config/cmake/volTest.cmake b/config/cmake/volTest.cmake index 6554f00..1dcd2b1 100644 --- a/config/cmake/volTest.cmake +++ b/config/cmake/volTest.cmake @@ -23,11 +23,11 @@ if (NOT TEST_VOL) message (FATAL_ERROR "Require TEST_VOL to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -54,7 +54,7 @@ execute_process ( message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +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}.out "${TEST_STREAM}") endif () @@ -62,7 +62,7 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.out) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.out") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.out TEST_STREAM) message (STATUS "Output USING ${TEST_VOL}:\n${TEST_STREAM}") endif () diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake index ab00e70..78ee0da 100644 --- a/config/cmake_ext_mod/grepTest.cmake +++ b/config/cmake_ext_mod/grepTest.cmake @@ -35,11 +35,11 @@ if (NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -84,7 +84,7 @@ endif () # if the TEST_ERRREF exists grep the error output with the error reference if (TEST_ERRREF) # if the .err file exists grep the error output with the error reference before comparing stdout - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_ERR_STREAM) # TEST_ERRREF should always be matched @@ -97,7 +97,7 @@ if (TEST_ERRREF) #always compare output file to reference unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") if (WIN32 OR MINGW) configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 21c8c18..e601653 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -27,11 +27,11 @@ if (NOT TEST_EXPECT) message (STATUS "Require TEST_EXPECT to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -88,7 +88,7 @@ endif () message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the .err file exists and ERRROR_APPEND is enabled -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") @@ -113,7 +113,7 @@ endif () # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) message (STATUS "Output :\n${TEST_STREAM}") endif () @@ -204,7 +204,7 @@ endif () # compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) - if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE}) + if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}") if (WIN32 OR MINGW) configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF) file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE}) diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake index 3d9197d..d078956 100644 --- a/config/toolchain/build32.cmake +++ b/config/toolchain/build32.cmake @@ -11,7 +11,7 @@ else () set (LIB32 /usr/lib) # Fedora - if (EXISTS /usr/lib32) + if (EXISTS "/usr/lib32") set (LIB32 /usr/lib32) # Arch, Solus endif () @@ -26,7 +26,7 @@ else () # on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have # to include the regular system .pc files as well (at the end), because some # are not always present in the 32 bit directory - if (EXISTS ${LIB32}/pkgconfig) + if (EXISTS "${LIB32}/pkgconfig") set (ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) endif () # where is the target environment diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 313d231..97ae847 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -990,7 +990,7 @@ if (LOCAL_BATCH_TEST) endif () endif () -if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) +if (NOT EXISTS "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c") add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories (H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake index 01faad5..6faf37b 100644 --- a/test/flushrefreshTest.cmake +++ b/test/flushrefreshTest.cmake @@ -30,11 +30,11 @@ if (NOT PERL_EXECUTABLE) message (STATUS "Require PERL_EXECUTABLE to be defined") endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) endif () -if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}.err") file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) endif () @@ -69,10 +69,10 @@ endif () set (verification_done "0") while (verification_done LESS "1") message (STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") - if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) + if (EXISTS "${TEST_FOLDER}/${TEST_ERR}") # Error exit script set (verification_done "3") - elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + elseif (EXISTS "${TEST_FOLDER}/${TEST_ARGS1}") file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) message (STATUS "v1:${v1} len_v1:${len_v1}") @@ -112,10 +112,10 @@ endwhile () while (verification_done LESS "2") message (STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") - if (EXISTS ${TEST_FOLDER}/${TEST_ERR}) + if (EXISTS "${TEST_FOLDER}/${TEST_ERR}") # Error exit script set (verification_done "3") - elseif (EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + elseif (EXISTS "${TEST_FOLDER}/${TEST_ARGS1}") file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) list (LENGTH v1 len_v1) message (STATUS "v1:${v1} len_v1:${len_v1}") @@ -158,7 +158,7 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") # if the return value is !=${TEST_EXPECT} bail out if (NOT TEST_RESULT EQUAL TEST_EXPECT) if (NOT TEST_NOERRDISPLAY) - if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}") file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) message (STATUS "Output :\n${TEST_STREAM}") endif () -- cgit v0.12 From e6c11af8704c3ac923dd6afcefaf20c568157770 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 29 Aug 2019 16:22:21 -0500 Subject: Fix namespace usage --- config/cmake/hdf5-config.cmake.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index a0d6c49..afb2a5c 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -191,16 +191,16 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) else () set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp2}-${libtype} @HDF5_PACKAGE@::${hdf5_comp}-${libtype}) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF_PACKAGE_NAMESPACE@${hdf5_comp2}-${libtype} @HDF_PACKAGE_NAMESPACE@${hdf5_comp}-${libtype}) endif () elseif (comp STREQUAL "Java") set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp}) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF_PACKAGE_NAMESPACE@${hdf5_comp}) else () set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp}-${libtype}) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF_PACKAGE_NAMESPACE@${hdf5_comp}-${libtype}) endif () endif () endforeach () -- cgit v0.12 From fe3c4567f58a8558db098511ddafbc91e26015f1 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 30 Aug 2019 23:06:04 -0500 Subject: Move coll_md_read and coll_md_write fields in H5F_t to H5F_shared_t. --- src/H5Cmpio.c | 4 ++-- src/H5Fint.c | 12 ++++++------ src/H5Fpkg.h | 10 ++++++---- src/H5Fprivate.h | 2 +- src/H5Fquery.c | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 84ec16c..e784487 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -222,7 +222,7 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(f->coll_md_write) { + if(f->shared->coll_md_write) { /* Sanity check */ HDassert(NULL == cache_ptr->coll_write_list); @@ -386,7 +386,7 @@ H5C_apply_candidate_list(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed") /* If we've deferred writing to do it collectively, take care of that now */ - if(f->coll_md_write) { + if(f->shared->coll_md_write) { /* Sanity check */ HDassert(cache_ptr->coll_write_list); diff --git a/src/H5Fint.c b/src/H5Fint.c index c56bd10..a28d6c9 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -246,9 +246,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL - if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") - if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) @@ -1020,9 +1020,9 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if(NULL == (f->shared->efc = H5F__efc_create(efc_size))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") #ifdef H5_HAVE_PARALLEL - if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") - if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) @@ -1653,7 +1653,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(page_buf_size) { #ifdef H5_HAVE_PARALLEL /* Collective metadata writes are not supported with page buffering */ - if(file->coll_md_write) + if(file->shared->coll_md_write) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "collective metadata writes are not supported with page buffering") /* Temporary: fail file create when page buffering feature is enabled for parallel */ @@ -3174,7 +3174,7 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) /* Sanity check */ HDassert(f); - f->coll_md_read = cmr; + f->shared->coll_md_read = cmr; FUNC_LEAVE_NOAPI_VOID } /* H5F_set_coll_md_read() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7e89111..1436c13 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -358,6 +358,12 @@ struct H5F_shared_t { /* Object flush info */ H5F_object_flush_t object_flush; /* Information for object flush callback */ hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */ + +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + hbool_t coll_md_write; /* Do all metadata writes collectively */ +#endif /* H5_HAVE_PARALLEL */ + }; /* @@ -376,10 +382,6 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ -#ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ - hbool_t coll_md_write; /* Do all metadata writes collectively */ -#endif /* H5_HAVE_PARALLEL */ }; /*****************************/ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0a7daa0..1441931 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -323,7 +323,7 @@ typedef struct H5F_t H5F_t; #define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR))) #ifdef H5_HAVE_PARALLEL -#define H5F_COLL_MD_READ(F) ((F)->coll_md_read) +#define H5F_COLL_MD_READ(F) ((F)->shared->coll_md_read) #endif /* H5_HAVE_PARALLEL */ #define H5F_USE_MDC_LOGGING(F) ((F)->shared->use_mdc_logging) #define H5F_START_MDC_LOG_ON_ACCESS(F) ((F)->shared->start_mdc_log_on_access) diff --git a/src/H5Fquery.c b/src/H5Fquery.c index c885561..70a8c9f 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1095,7 +1095,7 @@ H5F_coll_md_read(const H5F_t *f) HDassert(f); - FUNC_LEAVE_NOAPI(f->coll_md_read) + FUNC_LEAVE_NOAPI(f->shared->coll_md_read) } /* end H5F_coll_md_read() */ #endif /* H5_HAVE_PARALLEL */ -- cgit v0.12 From eef0cf26941072f449a8e332babcf21ee9eea128 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Sat, 31 Aug 2019 01:24:38 -0500 Subject: Move ext_path field in H5F_t to H5F_shared_t. Remove unused routine H5F_set_coll_md_read(). --- src/H5Fint.c | 36 +++++++----------------------------- src/H5Fpkg.h | 3 ++- src/H5Fprivate.h | 2 +- src/H5Fquery.c | 4 ++-- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index a28d6c9..5e2cf26 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1387,6 +1387,9 @@ H5F__dest(H5F_t *f, hbool_t flush) f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); f->shared->mtab.nalloc = 0; + /* Free the external link file */ + f->shared->extpath = (char *)H5MM_xfree(f->shared->extpath); + /* Clean up the metadata retries array */ for(actype = 0; actype < (int)H5AC_NTYPES; actype++) if(f->shared->retries[actype]) @@ -1407,7 +1410,6 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Free the non-shared part of the file */ f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); - f->extpath = (char *)H5MM_xfree(f->extpath); if(H5FO_top_dest(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") f->shared = NULL; @@ -1753,8 +1755,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ /* Formulate the absolute path for later search of target file for external links */ - if(H5_build_extpath(name, &file->extpath) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") + if(shared->nrefs == 1) { + if(H5_build_extpath(name, &file->shared->extpath) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") + } /* Formulate the actual file name, after following symlinks, etc. */ if(H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) @@ -2227,7 +2231,6 @@ H5F__reopen(H5F_t *f) /* Duplicate old file's names */ ret_value->open_name = H5MM_xstrdup(f->open_name); ret_value->actual_name = H5MM_xstrdup(f->actual_name); - ret_value->extpath = H5MM_xstrdup(f->extpath); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3155,31 +3158,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_max_eof_eoa() */ -#ifdef H5_HAVE_PARALLEL - -/*------------------------------------------------------------------------- - * Function: H5F_set_coll_md_read - * - * Purpose: Set the coll_md_read field with a new value. - * - * Return: SUCCEED/FAIL - *------------------------------------------------------------------------- - */ -void -H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - /* Sanity check */ - HDassert(f); - - f->shared->coll_md_read = cmr; - - FUNC_LEAVE_NOAPI_VOID -} /* H5F_set_coll_md_read() */ -#endif /* H5_HAVE_PARALLEL */ - /*------------------------------------------------------------------------- * Function: H5F_get_metadata_read_retry_info diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 1436c13..6cd2d3c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -359,6 +359,8 @@ struct H5F_shared_t { H5F_object_flush_t object_flush; /* Information for object flush callback */ hbool_t crt_dset_min_ohdr_flag; /* flag to minimize created dataset object header */ + char *extpath; /* Path for searching target external link file */ + #ifdef H5_HAVE_PARALLEL H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ hbool_t coll_md_write; /* Do all metadata writes collectively */ @@ -374,7 +376,6 @@ struct H5F_shared_t { struct H5F_t { char *open_name; /* Name used to open file */ char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */ - char *extpath; /* Path for searching target external link file */ H5F_shared_t *shared; /* The shared file info */ unsigned nopen_objs; /* Number of open object headers */ H5FO_t *obj_count; /* # of time each object is opened through top file structure */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 1441931..8c70663 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -282,7 +282,7 @@ typedef struct H5F_t H5F_t; #define H5F_INTENT(F) ((F)->shared->flags) #define H5F_OPEN_NAME(F) ((F)->open_name) #define H5F_ACTUAL_NAME(F) ((F)->actual_name) -#define H5F_EXTPATH(F) ((F)->extpath) +#define H5F_EXTPATH(F) ((F)->shared->extpath) #define H5F_SHARED(F) ((F)->shared) #define H5F_SAME_SHARED(F1, F2) ((F1)->shared == (F2)->shared) #define H5F_NOPEN_OBJS(F) ((F)->nopen_objs) diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 70a8c9f..f36f348 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -229,9 +229,9 @@ H5F_get_extpath(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(f); - HDassert(f->extpath); + HDassert(f->shared->extpath); - FUNC_LEAVE_NOAPI(f->extpath) + FUNC_LEAVE_NOAPI(f->shared->extpath) } /* end H5F_get_extpath() */ -- cgit v0.12 From b679d11bccb5ff5b8460871079c4e36126d96fa4 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 1 Sep 2019 01:13:08 -0500 Subject: Updated based on reviews and refactored test code --- src/H5D.c | 4 +- src/H5Dchunk.c | 5 +- src/H5VLnative_dataset.c | 7 +- test/chunk_info.c | 1608 ++++++++++++++++++++++++---------------------- 4 files changed, 830 insertions(+), 794 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 9c3a096..a22f173 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1167,7 +1167,7 @@ herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size) { H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */ - hsize_t nchunks= 0; + hsize_t nchunks = 0; herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -1186,7 +1186,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of /* Check range for chunk index */ if(chk_index >= nchunks) - HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "chunk index is out of range") + HGOTO_ERROR(H5E_IO, H5E_DATASET, FAIL, "chunk index is out of range") /* Call private function to get the chunk info given the chunk's index */ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 86639e6..e3bbd59 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -7124,8 +7124,8 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Purpose: Iterate over the chunks in the dataset to get the info * of the desired chunk. * - * Note: Currently, this function only gets the number of all written - * chunks, regardless the dataspace. + * Note: Currently, the domain of the index in this function is of all + * the written chunks, regardless the dataspace. * * Return: Success: SUCCEED * Failure: FAIL @@ -7293,7 +7293,6 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* HDassert(rdcc); HDassert(H5D_CHUNKED == layout->type); -/* Is this expensive? */ /* Search for cached chunks that haven't been written out */ for(ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 631eb19..4f7f2b5 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -509,15 +509,12 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, dset = (H5D_t *)obj; HDassert(dset); HDassert(dset->shared); + HDassert(dset->shared->space); /* When default dataspace is given, use the dataset's dataspace */ if(space_id == H5S_ALL) - { space = dset->shared->space; - if(NULL == space) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain a dataspace") - } /* otherwise, use the given space ID */ - else + else /* otherwise, use the given space ID */ if(NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID") diff --git a/test/chunk_info.c b/test/chunk_info.c index bdc9bbc..081c833 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -12,8 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Pedro Vicente - * April 7, 2008 * * Purpose: Tests chunk query API functions * @@ -22,15 +20,17 @@ * * Test structure: * main() - * test_get_chunk_info_highest18() - * test_get_chunk_info_110() + * test_get_chunk_info_highest_v18() + * test_get_chunk_info_v110() * test_chunk_info_single_chunk() * test_chunk_info_implicit() * test_chunk_info_fixed_array() * test_chunk_info_extensible_array() * test_chunk_info_version2_btrees() * test_failed_attempts() - * test_filter_mask_with_skip_compress() + * test_flt_msk_with_skip_compress() + * + * Helper functions: * */ #define H5D_FRIEND @@ -43,47 +43,95 @@ /* Test file names, using H5F_libver_t as indices */ const char *FILENAME[] = { "tchunk_info_earliest", - "tchunk_info_18", - "tchunk_info_110", - "tchunk_info_112", + "tchunk_info_v18", + "tchunk_info_v110", + "tchunk_info_v112", NULL }; /* File to be used in test_failed_attempts */ -#define FILTERMASK_FILE "tfilter_mask.h5" +#define FILTERMASK_FILE "tflt_msk" +#define BASIC_FILE "basic_query" /* Parameters for testing chunk querying */ -#define RANK 2 -#define FILENAME_BUF_SIZE 1024 -#define DSET_SIMPLE_CHUNKED "Chunked Dataset" -#define DSET_CONTIGUOUS "Contiguous Dataset" -#define DSET_EMPTY "Empty Dataset" -#define DSET_EMPTY_ALLOC "Empty Dataset with ALLOC_TIME_EARLY" -#define DSET_SINGLE_CHUNK "Single Chunk Index Dataset" -#define DSET_IMPLICIT_INDEX "Implicit Index Dataset" -#define DSET_FIXED_ARR_INDEX "Fixed Array Index Dataset" -#define DSET_EXT_ARR_INDEX "Extensible Array Index Dataset" -#define DSET_V2_BTREE_INDEX "Version 2 B-Tree Index Dataset" -#define DATASETNAME2 "skip_one_filter" +#define SIMPLE_CHUNKED_DSET_NAME "Chunked Dataset" +#define CONTIGUOUS_DSET_NAME "Contiguous Dataset" +#define EMPTY_DSET_NAME "Empty Dataset" +#define EMPTY_EARLY_ALLOC_DSET_NAME "Empty Dataset with ALLOC_TIME_EARLY" +#define SINGLE_CHUNK_DSET_NAME "Single Chunk Index Dataset" +#define IMPLICIT_INDEX_DSET_NAME "Implicit Index Dataset" +#define FIXED_ARR_INDEX_DSET_NAME "Fixed Array Index Dataset" +#define EXT_ARR_INDEX_DSET_NAME "Extensible Array Index Dataset" +#define V2_BTREE_INDEX_DSET_NAME "Version 2 B-Tree Index Dataset" +#define SKIP_FILTER_DSET_NAME "Dataset with Skipping One Filter" +#define FILENAME_BUF_SIZE 256 /* Size for file names */ +#define RANK 2 /* Rank for datasets */ + +/* Dimension of the dataset */ #define NX 24 #define NY 16 + +/* Dimension of the chunk */ #define CHUNK_NX 6 #define CHUNK_NY 4 -#define SINGLE_CHUNK_SIZE (NX*NY*sizeof(int)) -#define CHUNK_SIZE 96 -#define NUM_CHUNKS 16 + +/* X/Y coords of first chunk written */ +#define START_CHK_X 0 +#define START_CHK_Y 2 + +/* X/Y coord of last chunk written */ +#define END_CHK_X 2 +#define END_CHK_Y 4 + +/* X and Y coords of an empty chunk */ +#define EMPTY_CHK_X 0 +#define EMPTY_CHK_Y 0 + +/* Size of a chunk when the entire dataset is a one single chunk */ +#define SINGLE_CHK_SIZE (NX*NY*sizeof(int)) + +/* Size of a chunk */ +#define CHK_SIZE (CHUNK_NX*CHUNK_NY*sizeof(int)) + +/* Size of an empty chunk */ +#define EMPTY_CHK_SIZE 0 + +/* Number of maximum chunks without extending */ +#define NUM_CHUNKS ((NX/CHUNK_NX)*(NY/CHUNK_NY)) + +/* Number of chunks that have been written */ #define NUM_CHUNKS_WRITTEN 4 +#define ONE_CHUNK_WRITTEN 1 +#define TWO_CHUNKS_WRITTEN 2 +#define NO_CHUNK_WRITTEN 0 + +/* For testing invalid arguments */ +#define NONEXIST_CHK_INDEX 3 +#define OUTOFRANGE_CHK_INDEX 5 +#define INVALID_CHK_INDEX 5 + +/* For compressed data */ #define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12) +/* For use in error reporting */ +#define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY." +#define MSG_CHK_SIZE "Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY." + /* Utility function to initialize arguments */ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); +/* Helper function containing common code that verifies indexing type + and number of chunks */ +static int verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks, unsigned flt_msk); +static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk); +static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk); + /*------------------------------------------------------------------------- * Function: read_each_chunk (helper function) * * Purpose: Reads the chunk specified by its offset and verifies that * it contains the same data as what was written. This function - * is used in test_get_chunk_info. + * is used in various test_get_chunk_info... functions. * * Return: Success: SUCCEED * Failure: FAIL @@ -92,36 +140,31 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); * *------------------------------------------------------------------------- */ -//EIP - May be this function should take a pointer to an array of chunk dimensions -//EIP and its size, so it is not restricted to 2 dims only? -static herr_t read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, void *direct_buf) +static herr_t read_each_chunk(hid_t dset_id, hsize_t *offset, void *direct_buf) { int read_buf[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {offset1, offset2}; unsigned read_flt_msk = 0; - herr_t ret; /* Return value */ HDmemset(&read_buf, 0, sizeof(read_buf)); /* Read the chunk specified by its offset */ - ret = H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf); - if(ret < 0) return(FAIL); + if(H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf) < 0) + return FAIL; /* Verify that read chunk is the same as the corresponding written one */ if(HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0) { - HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset1, offset2); - return(FAIL); + HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset[0], offset[1]); + return FAIL; } - return(SUCCEED); + return SUCCEED; } /*------------------------------------------------------------------------- * Function: reinit_vars (helper function) * - * Purpose: Helper function to wipe out variables for the next use, - * used in test_get_chunk_info. + * Purpose: Wipes out variables for the next use, used in various tests. * * Return: Won't fail * @@ -140,7 +183,218 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size) } /*------------------------------------------------------------------------- - * Function: test_get_chunk_info_highest18 + * Function: verify_get_chunk_info (helper function) + * + * Purpose: Verifies that H5Dget_chunk_info returns correct + * values for a chunk. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static int +verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk) +{ + unsigned read_flt_msk = 0; /* Read filter mask */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + + if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); + VERIFY(size, exp_chk_size, "H5Dget_chunk_info, chunk size"); + VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info, filter mask"); + VERIFY(out_offset[0], exp_offset[0], "H5Dget_chunk_info, offset[0]"); + VERIFY(out_offset[1], exp_offset[1], "H5Dget_chunk_info, offset[1]"); + return SUCCEED; + +error: + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: verify_get_chunk_info_by_coord (helper function) + * + * Purpose: Verifies that H5Dget_chunk_info_by_coord returns correct + * values for a chunk. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static int +verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk) +{ + unsigned read_flt_msk = 0; /* Read filter mask */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + + /* Get info of the chunk at logical coordinates specified by offset */ + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); + VERIFY(size, exp_chk_size, "H5Dget_chunk_info_by_coord, chunk size"); + VERIFY(read_flt_msk, exp_flt_msk, "H5Dget_chunk_info_by_coord, filter mask"); + return SUCCEED; + +error: + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: verify_empty_chunk_info (helper function) + * + * Purpose: Verifies that H5Dget_chunk_info_by_coord returns correct + * values for an empty chunk. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2018 + * + *------------------------------------------------------------------------- + */ +static int +verify_empty_chunk_info(hid_t dset, hsize_t *offset) +{ + unsigned read_flt_msk = 0; /* Read filter mask */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + + /* Get info of the chunk at logical coordinates specified by offset */ + if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + TEST_ERROR + VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); + VERIFY(size, EMPTY_CHK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); + return SUCCEED; + +error: + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: index_type_str (helper function) + * + * Purpose: Returns the string containing the text associated with the + * given indexing scheme. For use in error messages. + * + * Return: Success: a valid indexing scheme string + * Failure: a note indicating the indexing type is invalid + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static const char* +index_type_str(H5D_chunk_index_t idx_type) +{ + switch (idx_type) { + case H5D_CHUNK_IDX_SINGLE: + return("Single Chunk index type"); + case H5D_CHUNK_IDX_NONE: + return("Implicit index type"); + case H5D_CHUNK_IDX_FARRAY: + return("Fixed Array index type"); + case H5D_CHUNK_IDX_EARRAY: + return("Extensible Array index type"); + case H5D_CHUNK_IDX_BT2: + return("Version 2 B-tree index type"); + case H5D_CHUNK_IDX_BTREE: + return("Version 1 B-tree index type (default)"); + case H5D_CHUNK_IDX_NTYPES: + default: + return("invalid index type"); + } +} /* index_type_str */ + +/*------------------------------------------------------------------------- + * Function: verify_and_write (helper function) + * + * Purpose: Verifies that chunk indexing scheme and number of chunks of + * the dataset matches the expected values, then write data to + * a subset of chunks. This function opens the dataset then + * closes it after writing. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static int +verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks, unsigned flt_msk) +{ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + hsize_t ii, jj; /* Array indices */ + int n; /* Used as chunk index, but int to avoid conversion warning */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + + /* Open the dataset */ + if((dset = H5Dopen2(chunkfile, dset_name, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get the chunk indexing type of the dataset */ + if(H5Dget_chunk_index_type(dset, &idx_type) < 0) + TEST_ERROR + + /* Ensure the correct chunk indexing scheme is used */ + if(idx_type != exp_idx_type) + { + char msg[256]; + sprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); + FAIL_PUTS_ERROR(msg); + } + + /* Get and verify the number of chunks */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks"); + + /* Get and verify the number of chunks again, passing in H5S_ALL */ + if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR + VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks"); + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; + + /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + n = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, (void*)direct_buf[n]) < 0) + TEST_ERROR + } + + /* Close the dataset */ + if(H5Dclose(dset) < 0) TEST_ERROR + + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + } H5E_END_TRY; + return FAIL; +} /* verify_and_write */ + +/*------------------------------------------------------------------------- + * Function: test_get_chunk_info_highest_v18 * * Purpose: Test getting various chunk information * @@ -161,61 +415,51 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size) *------------------------------------------------------------------------- */ static herr_t -test_get_chunk_info_highest18(hid_t fapl) +test_get_chunk_info_highest_v18(hid_t fapl) { - char filename[FILENAME_BUF_SIZE]; - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY]; /* Data in chunks */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */ hsize_t out_offset[2]; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ - unsigned filter_mask = 0; /* Filter mask */ + unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ int fillvalue = -1; /* Fill value */ int aggression = 9; /* Compression aggression setting */ - H5F_libver_t low, high; /* File format bounds */ - hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ - int n; /* Used on buffer, to avoid conversion warning */ - hsize_t ii, jj; + hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ const Bytef *z_src = (const Bytef*)(direct_buf); Bytef *z_dst; /*destination buffer */ - uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size); - uLong z_src_nbytes = (uLong)buf_size; + uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); + uLong z_src_nbytes = (uLong)CHK_SIZE; void *outbuf = NULL; /* Pointer to new buffer */ - - herr_t ret; + hsize_t ii, jj; /* Array indices */ + int n; /* Used as chunk index, but int to avoid conversion warning */ + herr_t ret; /* Temporary returned value for verifying failure */ TESTING("getting chunk information in file with version prior to 1.10"); /* Create the file */ h5_fixname(FILENAME[H5F_LIBVER_V18], fapl, filename, sizeof filename); - /* Set high bound to V18 to test chunked dataset that use B-tree v1 - structures to index chunks */ - high = H5F_LIBVER_V18; - - /* Low bound can be anything below 1.10, which was when the new chunk storage - was introduced */ - low = H5F_LIBVER_EARLIEST; - - /* Set version bounds for creating the file */ - if(H5Pset_libver_bounds(fapl, low, high) < 0) + /* Set version bounds for creating the file. High bound to V18 to test + chunked dataset that use B-tree v1 structures to index chunks. */ + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_EARLIEST, H5F_LIBVER_V18) < 0) TEST_ERROR chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); if(chunkfile < 0) TEST_ERROR - /* Create the file and memory dataspaces */ + /* Create the file and memory dataspace */ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR @@ -231,7 +475,7 @@ test_get_chunk_info_highest18(hid_t fapl) if(H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_SIMPLE_CHUNKED, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ @@ -262,21 +506,19 @@ test_get_chunk_info_highest18(hid_t fapl) /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: (0,2) (0,3) (1,2) (1,3) */ n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - { + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, (void*)direct_buf[n]); if(ret < 0) TEST_ERROR } - /* Read each chunk and verify the values */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) - TEST_ERROR + /* Read each chunk in the subset of chunks and verify the values */ + /* if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) + if(read_each_chunk(dset) == FAIL) + TEST_ERROR + */ /* Free the read buffer */ if(outbuf) @@ -285,122 +527,88 @@ test_get_chunk_info_highest18(hid_t fapl) if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_SIMPLE_CHUNKED, H5P_DEFAULT)) < 0) + if((dset = H5Dopen2(chunkfile, SIMPLE_CHUNKED_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR - - /* Go through all written chunks, get their info and verify the values */ - chk_index = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, chk_index++) { - int kk; - - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], ii * CHUNK_NX, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], jj * CHUNK_NY, "H5Dget_chunk_info, offset"); - - /* Reset variables to pass in to the next call */ - reinit_vars(&read_flt_msk, &addr, &size); - - /* Copy offsets to pass in to the next call */ - for(kk = 0; kk < RANK; kk++) - offset[kk] = out_offset[kk]; - - /* Get info of the chunk at the specified offsets and verify its info */ - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - } + VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Get and verify info of the last chunk, passing in H5S_ALL */ - chk_index = 3; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - ret = H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size); - if(ret < 0) TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + /* Get and verify info of the last written chunk again, passing in H5S_ALL + this time */ + offset[0] = 6; + offset[1] = 12; + if(verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN-1, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); /* Attempt to get info of a non-existing chunk, should fail */ - chk_index = 5; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; + chk_index = OUTOFRANGE_CHK_INDEX; H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size); } H5E_END_TRY; if(ret != FAIL) - FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.") + FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk."); /* Attempt to get info of empty chunks, verify the returned addr and size */ offset[0] = 0; offset[1] = 0; - ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); - if(ret < 0) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + if(verify_empty_chunk_info(dset, offset) == FAIL) + TEST_ERROR offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; - ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size); - if(ret < 0) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + if(verify_empty_chunk_info(dset, offset) == FAIL) + TEST_ERROR - /* Read each chunk and verify the values */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) - TEST_ERROR + /* Go through all written chunks, get their info and verify the values */ + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + + if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + + /* Use the same offset to pass into the next ...by_coord function */ + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + } /* Close the first dataset */ if(H5Dclose(dset) < 0) TEST_ERROR /* Create an empty dataset and close it */ - dset = H5Dcreate2(chunkfile, DSET_EMPTY, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, EMPTY_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR /* Reopen the empty dataset to verify the chunk query functions on it */ - if((dset = H5Dopen2(chunkfile, DSET_EMPTY, H5P_DEFAULT)) < 0) + if((dset = H5Dopen2(chunkfile, EMPTY_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify that the number of chunks is 0 */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 0) TEST_ERROR + VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); /* Attempt to get info of a chunk from an empty dataset, should fail */ - chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); + chk_index = OUTOFRANGE_CHK_INDEX; H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); } H5E_END_TRY; if(ret != FAIL) - FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk.") + FAIL_PUTS_ERROR(" Attempt to get info of a non-existing chunk."); /* Attempt to get info of a chunk given its coords from an empty dataset, should succeed with the returned address as HADDR_UNDEF and size as 0 */ - offset[0] = 0; - offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + offset[0] = EMPTY_CHK_X; + offset[1] = EMPTY_CHK_Y; + if(verify_empty_chunk_info(dset, offset) == FAIL) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); if(H5Dclose(dset) < 0) TEST_ERROR @@ -414,29 +622,29 @@ test_get_chunk_info_highest18(hid_t fapl) TEST_ERROR /* Create an empty dataset and close it */ - dset = H5Dcreate2(chunkfile, DSET_EMPTY_ALLOC, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR if(H5Dclose(dset) < 0) TEST_ERROR /* Reopen the empty dataset to verify the chunk query functions on it */ - if((dset = H5Dopen2(chunkfile, DSET_EMPTY_ALLOC, H5P_DEFAULT)) < 0) + if((dset = H5Dopen2(chunkfile, EMPTY_EARLY_ALLOC_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR /* Verify that the number of chunks is NUM_CHUNKS */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS) TEST_ERROR + VERIFY(nchunks, NUM_CHUNKS, "H5Dget_num_chunks, number of chunks"); /* Attempt to get info of a chunk from an empty dataset, verify the returned address and size in the case of H5D_ALLOC_TIME_EARLY */ - chk_index = 0; + chk_index = NONEXIST_CHK_INDEX; reinit_vars(&read_flt_msk, &addr, &size); ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); if(ret < 0) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); - if(size == 0) - FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + FAIL_PUTS_ERROR(MSG_CHK_ADDR); + if(size == EMPTY_CHK_SIZE) + FAIL_PUTS_ERROR(MSG_CHK_SIZE); chk_index = 10; reinit_vars(&read_flt_msk, &addr, &size); @@ -444,9 +652,9 @@ test_get_chunk_info_highest18(hid_t fapl) if(ret < 0) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); - if(size == 0) - FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + FAIL_PUTS_ERROR(MSG_CHK_ADDR); + if(size == EMPTY_CHK_SIZE) + FAIL_PUTS_ERROR(MSG_CHK_SIZE); /* Attempt to get info of a chunk given its coords from an empty dataset, verify the returned address and size */ @@ -456,9 +664,9 @@ test_get_chunk_info_highest18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if(addr == HADDR_UNDEF) - FAIL_PUTS_ERROR("Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."); + FAIL_PUTS_ERROR(MSG_CHK_ADDR); if(size == 0) - FAIL_PUTS_ERROR("Chunk size should not be 0 because of H5D_ALLOC_TIME_EARLY."); + FAIL_PUTS_ERROR(MSG_CHK_SIZE); if(H5Dclose(dset) < 0) TEST_ERROR @@ -480,39 +688,7 @@ error: H5_FAILED(); return FAIL; -} /* test_get_chunk_info_highest18() */ - - -/*------------------------------------------------------------------------- - * Function: verify_idx_type - * - * Purpose: Helper function to ensure that the correct chunk indexing - * scheme is being used. - * - * Return: Success: TRUE/FALSE - * Failure: FAIL - *------------------------------------------------------------------------- - */ -static htri_t -verify_idx_type(hid_t dset, H5D_chunk_index_t expected_idx_type) -{ - H5D_chunk_index_t idx_type; - - /* Get the chunk indexing type of the dataset */ - if(H5Dget_chunk_index_type(dset, &idx_type) < 0) - TEST_ERROR - - /* Simply return FALSE, not FAIL, if the dataset's indexing type is - not as expected */ - if(idx_type != expected_idx_type) - return FALSE; - - /* Indicating that the correct chunk indexing type is used */ - return TRUE; - -error: - return FAIL; -} +} /* test_get_chunk_info_highest_v18() */ /*------------------------------------------------------------------------- * Function: test_chunk_info_single_chunk @@ -532,7 +708,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_chunk_info_single_chunk(char *filename, hid_t fapl) +test_chunk_info_single_chunk(const char *filename, hid_t fapl) { hid_t chunkfile = H5I_INVALID_HID; /* File ID */ hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ @@ -540,8 +716,9 @@ test_chunk_info_single_chunk(char *filename, hid_t fapl) hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */ - int in_buf[NX][NY]; /* Input buffer */ - unsigned filter_mask = 0; /* Filter mask */ + int data_buf[NX][NY]; /* Input buffer */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -549,8 +726,8 @@ test_chunk_info_single_chunk(char *filename, hid_t fapl) hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int ii, jj; - herr_t ret = 0; + hsize_t ii, jj; /* Array indices */ + herr_t ret; /* Temporary returned value for verifying failure */ TESTING(" Single Chunk index"); @@ -570,61 +747,55 @@ test_chunk_info_single_chunk(char *filename, hid_t fapl) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_SINGLE_CHUNK, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Ensure we're using the correct chunk indexing scheme */ - if(verify_idx_type(dset, H5D_CHUNK_IDX_SINGLE) == FALSE) - FAIL_PUTS_ERROR("Should be using Single Chunk index type"); - - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR /* ...open it again to test the chunk query functions on a single empty chunk */ - if((dset = H5Dopen2(chunkfile, DSET_SINGLE_CHUNK, H5P_DEFAULT)) < 0) + if((dset = H5Dopen2(chunkfile, SINGLE_CHUNK_DSET_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Ensure the correct chunk indexing scheme is used */ + if(H5Dget_chunk_index_type(dset, &idx_type) < 0) TEST_ERROR + if(idx_type != H5D_CHUNK_IDX_SINGLE) + FAIL_PUTS_ERROR("Should be using Single Chunk index type"); /* Get the number of chunks and verify that no chunk has been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 0) TEST_ERROR + VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); /* Initialize the array of chunk data for the single chunk */ for(ii = 0; ii < NX; ii++) for(jj = 0; jj < NY; jj++) - in_buf[ii][jj] = (ii*jj); + data_buf[ii][jj] = (int)(ii*jj); /* Write the chunk */ - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0) TEST_ERROR /* Get and verify that one chunk had been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 1) TEST_ERROR + VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Get and verify info of the first and only chunk */ - chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 0, "H5Dget_chunk_info, offset"); - - /* Get info of the chunk at logical coordinates (0,0) */ + /* Offset of the only chunk */ offset[0] = 0; offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, SINGLE_CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + + /* Get and verify info of the first and only chunk */ + if(verify_get_chunk_info(dset, H5S_ALL, 0, SINGLE_CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); + + /* Get and verify info of the chunk at logical coordinates (0,0) */ + if(verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); /* Attempt to get chunk info given an invalid chunk index and verify * that failure occurs */ - chk_index = 3; + chk_index = INVALID_CHK_INDEX; reinit_vars(&read_flt_msk, &addr, &size); H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); @@ -651,8 +822,6 @@ error: H5_FAILED(); return FAIL; } /* test_chunk_info_single_chunk() */ - - /*------------------------------------------------------------------------- * Function: test_chunk_info_implicit @@ -674,25 +843,15 @@ error: static herr_t test_chunk_info_implicit(char *filename, hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ - hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ - hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ - unsigned filter_mask = 0; /* Filter mask */ - unsigned read_flt_msk = 0; /* Filter mask after direct read */ - hsize_t offset[2]; /* Offset coordinates of a chunk */ - hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ - hsize_t size = 0; /* Size of an allocated/written chunk */ - hsize_t nchunks = 0; /* Number of chunks */ - haddr_t addr = 0; /* Address of an allocated/written chunk */ - hsize_t chk_index = 0; /* Index of a chunk */ - int n; /* Used on buffer, to avoid conversion warning*/ - hsize_t ii, jj; - herr_t ret; + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + unsigned flt_msk = 0; /* Filter mask */ + hsize_t chk_index = 0; /* Index of a chunk */ + hsize_t ii, jj; /* Array indices */ TESTING(" Implicit index"); @@ -711,91 +870,40 @@ test_chunk_info_implicit(char *filename, hid_t fapl) if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR + /* Set allocation time to early */ if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_IMPLICIT_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Ensure we're using the correct chunk indexing scheme */ - if(verify_idx_type(dset, H5D_CHUNK_IDX_NONE) == FALSE) - FAIL_PUTS_ERROR("Should be using Implicit index type"); - - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Get and verify the number of chunks */ - if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - - /* All chunks because of H5D_ALLOC_TIME_EARLY */ - if(nchunks != NUM_CHUNKS) TEST_ERROR - - /* Get and verify the number of chunks again, passing in H5S_ALL */ - if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS) TEST_ERROR - - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; - - /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: - (0,2) (0,3) (1,2) (1,3) */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); - if(ret < 0) TEST_ERROR - } - - if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR + /* Verify chunk indexing scheme and number of chunks, and write data to a + subset of chunks. */ + if(verify_and_write(chunkfile, IMPLICIT_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_NONE, NUM_CHUNKS, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Close the dataset then... */ - if(H5Dclose(dset) < 0) TEST_ERROR - - /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0) + /* Open the dataset again to test getting chunk info */ + if((dset = H5Dopen2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR - /* Go through all chunks, and get their info and verify the values */ chk_index = 0; for(ii = 0; ii < NX/CHUNK_NX; ii++) for(jj = 0; jj < NY/CHUNK_NY; jj++, chk_index++) { - int kk; - - if(H5Dget_chunk_info(dset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], ii * CHUNK_NX, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], jj * CHUNK_NY, "H5Dget_chunk_info, offset"); + hsize_t offset[2] = {ii * CHUNK_NX, jj * CHUNK_NY}; - /* Reset variables to pass in to the next call */ - reinit_vars(&read_flt_msk, &addr, &size); - - /* Copy offsets to pass in to the next call */ - for(kk = 0; kk < RANK; kk++) - offset[kk] = out_offset[kk]; + if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); /* Get info of a chunk and verify its information. Note that all chunks in this dataset are allocated because of the property H5D_ALLOC_TIME_EARLY */ - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); } /* Release resourse */ @@ -837,18 +945,16 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_chunk_info_fixed_array(char *filename, hid_t fapl) +test_chunk_info_fixed_array(const char *filename, hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ - hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - int out_buf[NX][NY]; /* Buffer to read data in */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ - unsigned filter_mask = 0; /* Filter mask */ + unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -856,9 +962,9 @@ test_chunk_info_fixed_array(char *filename, hid_t fapl) hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int n; /* Used on buffer, to avoid conversion warning */ - hsize_t ii, jj; - herr_t ret; + hsize_t ii, jj; /* Array indices */ + int n; /* Used as chunk index, but int to avoid conversion warning */ + herr_t ret; /* Temporary returned value for verifying failure */ TESTING(" Fixed Array index"); @@ -878,23 +984,52 @@ test_chunk_info_fixed_array(char *filename, hid_t fapl) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_FIXED_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Ensure we're using the correct chunk indexing scheme */ - if(verify_idx_type(dset, H5D_CHUNK_IDX_FARRAY) == FALSE) - FAIL_PUTS_ERROR("Should be using Fixed Array index type"); - - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_FIXED_ARR_INDEX, H5P_DEFAULT)) < 0) + /* Verify chunk indexing scheme and number of chunks, and write data + to a subset of chunks */ + if(verify_and_write(chunkfile, FIXED_ARR_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_FARRAY, NO_CHUNK_WRITTEN, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Open the dataset again to test getting chunk info */ + if((dset = H5Dopen2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR - /* Get the number of chunks and verify that no chunk has been written */ + /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 0) TEST_ERROR + VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + + /* Get and verify info of each written chunk */ + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + } + + /* Attempt to get info using an out-of-range index, chk_index is now > NUM_CHUNKS_WRITTEN. should fail */ + H5E_BEGIN_TRY { + ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); + } H5E_END_TRY; + if(ret != FAIL) + FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); + + /* Attempt to get info of empty chunks, verify the returned address and size */ + offset[0] = 0; + offset[1] = 0; + if(verify_empty_chunk_info(dset, offset) == FAIL) + TEST_ERROR + + offset[0] = 3 * CHUNK_NX; + offset[1] = 3 * CHUNK_NY; + if(verify_empty_chunk_info(dset, offset) == FAIL) + TEST_ERROR /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ for(n = 0; n < NUM_CHUNKS; n++) @@ -902,115 +1037,163 @@ test_chunk_info_fixed_array(char *filename, hid_t fapl) for(jj = 0; jj < CHUNK_NY; jj++) direct_buf[n][ii][jj] = n + 1; - /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: - (0,2) (0,3) (1,2) (1,3) */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - { + /* Read each chunk and verify the values */ + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); - if(ret < 0) TEST_ERROR + + if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) + TEST_ERROR } - /* Read the entire dataset back */ - if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0) - TEST_ERROR + /* Release resourse */ + if(H5Dclose(dset) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR + if(H5Fclose(chunkfile) < 0) TEST_ERROR - /* Get and verify the number of chunks written */ - if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + PASSED(); + return SUCCEED; - /* Get and verify info of the first chunk */ - chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) +error: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(dspace); + H5Pclose(cparms); + H5Fclose(chunkfile); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; +} /* test_chunk_info_fixed_array() */ + +/*------------------------------------------------------------------------- + * Function: test_chunk_info_extensible_array + * + * Purpose: Test getting various chunk information when Extensible Array + * index type is used + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Note: Note that the dataspace argument in these new functions are + * currently not used. The functionality involved the dataspace + * will be implemented in the next version. + * + * Date: November 2018 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_chunk_info_extensible_array(const char *filename, hid_t fapl) +{ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ + int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + unsigned flt_msk = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ + hsize_t size = 0; /* Size of an allocated/written chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + haddr_t addr = 0; /* Address of an allocated/written chunk */ + hsize_t chk_index = 0; /* Index of a chunk */ + hsize_t ii, jj; /* Array indices */ + int n; /* Used as chunk index, but int to avoid conversion warning */ + herr_t ret; /* Temporary returned value for verifying failure */ + + TESTING(" Extensible Array index"); + + /* Open the file for reading/writing */ + if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Create dataspace */ + if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - /* Get and verify info of the second chunk */ - chk_index = 1; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + /* Enable chunking */ + if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - /* Get and verify info of the third chunk */ - chk_index = 2; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) + if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - /* Get and verify info of the last chunk */ - chk_index = 3; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); + /* Create a new dataset using cparms creation properties */ + dset = H5Dcreate2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + if(dset < 0) TEST_ERROR + + /* Close the dataset */ + if(H5Dclose(dset) < 0) TEST_ERROR + + /* Verify chunk indexing scheme and number of chunks, and write data + to a subset of chunks */ + if(verify_and_write(chunkfile, EXT_ARR_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_EARRAY, NO_CHUNK_WRITTEN, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Open the dataset again to test getting chunk info */ + if((dset = H5Dopen2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Get and verify the number of chunks written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); + + /* Get and verify info of each written chunk */ + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + + if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + } - /* Attempt to get info of empty chunk, should fail */ - chk_index = 5; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; + /* Attempt to get info using an out-of-range index, should fail */ + chk_index = OUTOFRANGE_CHK_INDEX; H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); } H5E_END_TRY; if(ret != FAIL) FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); - /* Get info of the chunk at logical coordinates (0,2) */ - offset[0] = 0; - offset[1] = 2 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - - /* Get info of the chunk at logical coordinates (1,3) */ - offset[0] = 1 * CHUNK_NX; - offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - /* Attempt to get info of empty chunks, verify the returned address and size */ offset[0] = 0; offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + if(verify_empty_chunk_info(dset, offset) == FAIL) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + if(verify_empty_chunk_info(dset, offset) == FAIL) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = n + 1; /* Read each chunk and verify the values */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + + if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) TEST_ERROR + } /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR @@ -1030,12 +1213,12 @@ error: H5_FAILED(); return FAIL; -} /* test_chunk_info_fixed_array() */ - +} /* test_chunk_info_extensible_array() */ + /*------------------------------------------------------------------------- - * Function: test_chunk_info_extensible_array + * Function: test_chunk_info_version2_btrees * - * Purpose: Test getting various chunk information when Extensible Array + * Purpose: Test getting various chunk information when Version 2 B-trees * index type is used * * Return: Success: SUCCEED @@ -1050,18 +1233,17 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_chunk_info_extensible_array(char *filename, hid_t fapl) +test_chunk_info_version2_btrees(const char *filename, hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ - unsigned filter_mask = 0; /* Filter mask */ + unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -1069,11 +1251,10 @@ test_chunk_info_extensible_array(char *filename, hid_t fapl) hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int n; /* Used on buffer, to avoid conversion warning */ - hsize_t ii, jj; - herr_t ret; + hsize_t ii, jj; /* Array indices */ + herr_t ret; /* Temporary returned value for verifying failure */ - TESTING(" Extensible Array index"); + TESTING(" Version 2 B-trees index"); /* Open the file for reading/writing */ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) @@ -1091,143 +1272,68 @@ test_chunk_info_extensible_array(char *filename, hid_t fapl) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_EXT_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Ensure we're using the correct chunk indexing scheme */ - if(verify_idx_type(dset, H5D_CHUNK_IDX_EARRAY) == FALSE) - FAIL_PUTS_ERROR("Should be using Extensible Array index type"); - - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_EXT_ARR_INDEX, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Get the number of chunks and verify that no chunk has been written */ - if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 0) TEST_ERROR - - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; + /* Verify chunk indexing scheme and number of chunks, and write data + to a subset of chunks */ + if(verify_and_write(chunkfile, V2_BTREE_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_BT2, NO_CHUNK_WRITTEN, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: - (0,2) (0,3) (1,2) (1,3) */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); - if(ret < 0) TEST_ERROR - } + /* Open the dataset again to test getting chunk info */ + if((dset = H5Dopen2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) + TEST_ERROR /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR + VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Get and verify info of the first chunk */ + /* Go through all written chunks, get their info and verify the values */ chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); - - /* Get and verify info of the second chunk */ - chk_index = 1; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; - /* Get and verify info of the third chunk */ - chk_index = 2; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); - /* Get and verify info of the last chunk */ - chk_index = 3; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + } - /* Attempt to get info using an out-of-range index, should fail */ - chk_index = 5; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; + /* Attempt to provide out-of-range offsets, should fail */ + chk_index = OUTOFRANGE_CHK_INDEX; H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); } H5E_END_TRY; if(ret != FAIL) FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); - /* Get info of the chunk at logical coordinates (0,2) */ - offset[0] = 0; - offset[1] = 2 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - - /* Get info of the chunk at logical coordinates (1,3) */ - offset[0] = 1 * CHUNK_NX; - offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - /* Attempt to get info of empty chunks, verify the returned address and size */ offset[0] = 0; offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + if(verify_empty_chunk_info(dset, offset) == FAIL) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) + if(verify_empty_chunk_info(dset, offset) == FAIL) TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); /* Read each chunk and verify the values */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) + chk_index = 0; + for(ii = START_CHK_X; ii < END_CHK_X; ii++) + for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + + if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) TEST_ERROR + } /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR @@ -1247,13 +1353,13 @@ error: H5_FAILED(); return FAIL; -} /* test_chunk_info_extensible_array() */ +} /* test_chunk_info_version2_btrees() */ /*------------------------------------------------------------------------- - * Function: test_chunk_info_version2_btrees + * Function: test_basic_query * - * Purpose: Test getting various chunk information when Version 2 B-trees - * index type is used + * Purpose: Tests basic operations to ensure the chunk query functions + * work properly. * * Return: Success: SUCCEED * Failure: FAIL @@ -1262,23 +1368,22 @@ error: * currently not used. The functionality involved the dataspace * will be implemented in the next version. * - * Date: November 2018 + * Date: August 2019 * *------------------------------------------------------------------------- */ static herr_t -test_chunk_info_version2_btrees(char *filename, hid_t fapl) +test_basic_query(hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - hid_t cparms = H5I_INVALID_HID; /* Creation plist */ - hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t basicfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */ - unsigned filter_mask = 0; /* Filter mask */ + int direct_buf[CHUNK_NX][CHUNK_NY];/* Data in chunks */ + unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -1286,18 +1391,20 @@ test_chunk_info_version2_btrees(char *filename, hid_t fapl) hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int n; /* Used on buffer, to avoid conversion warning */ - hsize_t ii, jj; - herr_t ret; + hsize_t ii, jj; /* Array indices */ + herr_t ret; /* Temporary returned value for verifying failure */ - TESTING(" Version 2 B-trees index"); + TESTING("basic operations"); + + /* Create the file */ + h5_fixname(BASIC_FILE, fapl, filename, sizeof filename); + + /* Create a new file. */ + if((basicfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; - /* Open the file for reading/writing */ - if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - /* Create dataspace */ - if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0) TEST_ERROR /* Enable chunking */ @@ -1308,148 +1415,92 @@ test_chunk_info_version2_btrees(char *filename, hid_t fapl) TEST_ERROR /* Create a new dataset using cparms creation properties */ - dset = H5Dcreate2(chunkfile, DSET_V2_BTREE_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + dset = H5Dcreate2(basicfile, SIMPLE_CHUNKED_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT); if(dset < 0) TEST_ERROR - /* Ensure we're using the correct chunk indexing scheme */ - if(verify_idx_type(dset, H5D_CHUNK_IDX_BT2) == FALSE) - FAIL_PUTS_ERROR("Should be using Version 2 B-tree index type"); - - /* Close the dataset then... */ - if(H5Dclose(dset) < 0) TEST_ERROR - - /* ...open it again to test the chunk query functions */ - if((dset = H5Dopen2(chunkfile, DSET_V2_BTREE_INDEX, H5P_DEFAULT)) < 0) - TEST_ERROR - /* Get the number of chunks and verify that no chunk has been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != 0) TEST_ERROR + VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; + /* Initialize the array of chunk data for the single chunk */ + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[ii][jj] = (int)(ii*jj); - /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: - (0,2) (0,3) (1,2) (1,3) */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]); - if(ret < 0) TEST_ERROR - } + /* Write the chunk of data */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0) + TEST_ERROR; - /* Get and verify the number of chunks written */ + /* Get and verify that one chunk had been written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR - - /* Get and verify info of the first chunk */ - chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Get and verify info of the second chunk */ - chk_index = 1; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 0, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); - - /* Get and verify info of the third chunk */ - chk_index = 2; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 8, "H5Dget_chunk_info, offset"); + /* Get and verify info of the first and only chunk */ + if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); - /* Get and verify info of the last chunk */ - chk_index = 3; - reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; - if(H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], 6, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], 12, "H5Dget_chunk_info, offset"); + /* Get and verify info of the chunk at the offset (CHUNK_NX,CHUNK_NY) */ + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); - /* Attempt to provide out-of-range offsets, should fail */ - chk_index = 5; + /* Attempt to get chunk info given an invalid chunk index and verify + * that failure occurs */ + chk_index = INVALID_CHK_INDEX; reinit_vars(&read_flt_msk, &addr, &size); - out_offset[0] = out_offset[1] = 0; H5E_BEGIN_TRY { ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); } H5E_END_TRY; if(ret != FAIL) - FAIL_PUTS_ERROR(" Attempted to get info of a chunk using an out-of-range index."); - - /* Get info of the chunk at logical coordinates (0,2) */ - offset[0] = 0; - offset[1] = 2 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - - /* Get info of the chunk at logical coordinates (1,3) */ - offset[0] = 1 * CHUNK_NX; - offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, CHUNK_SIZE, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); - /* Attempt to get info of empty chunks, verify the returned address and size */ + /* Write the chunk of data to another location */ offset[0] = 0; offset[1] = 0; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0) + TEST_ERROR; - offset[0] = 3 * CHUNK_NX; - offset[1] = 3 * CHUNK_NY; - if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - VERIFY(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord, chunk address"); - VERIFY(size, 0, "H5Dget_chunk_info_by_coord, chunk size"); + /* Get and verify that two chunks had been written */ + if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR + VERIFY(nchunks, TWO_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); - /* Read each chunk and verify the values */ - n = 0; - for(ii = 0; ii < 2; ii++) - for(jj = 2; jj < 4; jj++, n++) - if(read_each_chunk(dset, ii*CHUNK_NX, jj*CHUNK_NY, (void*)direct_buf[n]) < 0) - TEST_ERROR + /* Get and verify info of the first written chunk in the dataset, its + offset should be (0,0) */ + if(verify_get_chunk_info(dset, H5S_ALL, 0, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); + + /* Get and verify info of the chunk at the offset (0,0) */ + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + + /* Get and verify info of the second written chunk in the dataset, its + offset should be (CHUNK_NX, CHUNK_NY) */ + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + if(verify_get_chunk_info(dset, H5S_ALL, 1, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification H5Dget_chunk_info failed\n"); + + /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + + /* Get and verify info of an empty chunk, at offset + (2*CHUNK_NX, 2*CHUNK_NY) */ + offset[0] = 2*CHUNK_NX; + offset[1] = 2*CHUNK_NY; + /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ + if(verify_empty_chunk_info(dset, offset) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR if(H5Sclose(dspace) < 0) TEST_ERROR - if(H5Fclose(chunkfile) < 0) TEST_ERROR + if(H5Pclose(cparms) < 0) TEST_ERROR + if(H5Fclose(basicfile) < 0) TEST_ERROR + + /* Remove the test file */ + remove(filename); PASSED(); return SUCCEED; @@ -1459,12 +1510,12 @@ error: H5Dclose(dset); H5Sclose(dspace); H5Pclose(cparms); - H5Fclose(chunkfile); + H5Fclose(basicfile); } H5E_END_TRY; H5_FAILED(); return FAIL; -} /* test_chunk_info_version2_btrees() */ +} /* test_basic_query() */ /*------------------------------------------------------------------------- * Function: test_failed_attempts @@ -1483,13 +1534,13 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_failed_attempts(char *filename, hid_t fapl) +test_failed_attempts(const char *filename, hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ - int in_buf[NX][NY]; /* Input buffer */ + int data_buf[NX][NY]; /* Input buffer */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ @@ -1497,8 +1548,8 @@ test_failed_attempts(char *filename, hid_t fapl) hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ - int ii, jj; - herr_t ret = 0; + hsize_t ii, jj; /* Array indices */ + herr_t ret; /* Temporary returned value for verifying failure */ TESTING(" Invalid Operations"); @@ -1511,23 +1562,23 @@ test_failed_attempts(char *filename, hid_t fapl) TEST_ERROR /* Create a contiguous dataset */ - dset = H5Dcreate2(chunkfile, DSET_CONTIGUOUS, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + dset = H5Dcreate2(chunkfile, CONTIGUOUS_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if(dset < 0) TEST_ERROR /* Initialize the array of data */ for(ii = 0; ii < NX; ii++) for(jj = 0; jj < NY; jj++) - in_buf[ii][jj] = (ii*jj); + data_buf[ii][jj] = (int)(ii*jj); /* Write the data */ - if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0) + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_buf) < 0) TEST_ERROR - /* Close the dataset then... */ + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* ...open it again to test the chunk query functions on contiguous dataset */ - if((dset = H5Dopen2(chunkfile, DSET_CONTIGUOUS, H5P_DEFAULT)) < 0) + /* Open it again to test the chunk query functions on contiguous dataset */ + if((dset = H5Dopen2(chunkfile, CONTIGUOUS_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR /* Attempt to get the number of chunks on contiguous dataset, should fail */ @@ -1576,7 +1627,7 @@ error: } /* test_failed_attempts() */ /*------------------------------------------------------------------------- - * Function: test_get_chunk_info_110 + * Function: test_get_chunk_info_v110 * * Purpose: Test getting various chunk information in version 1.10. * @@ -1588,20 +1639,20 @@ error: * will be implemented in the next version. * * Description: - * This function tests the new API functions added for EED-343: - * H5Dget_num_chunks, H5Dget_chunk_info, and H5Dget_chunk_info_by_coord - * for low bound beyond 1.8. + * This function tests the new API functions added for HDFFV-10677: + * H5Dget_num_chunks, H5Dget_chunk_info, and + * H5Dget_chunk_info_by_coord for low bound beyond 1.8. * * Date: October 2018 * *------------------------------------------------------------------------- */ static herr_t -test_get_chunk_info_110(hid_t fapl) +test_get_chunk_info_v110(hid_t fapl) { - hid_t chunkfile = H5I_INVALID_HID; /* File ID */ - char filename[FILENAME_BUF_SIZE]; - H5F_libver_t low, high; /* File format bounds */ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t chunkfile = H5I_INVALID_HID; /* File ID */ + H5F_libver_t low, high; /* File format bounds */ TESTING("getting chunk information in file with versions 1.10 and later"); HDprintf("\n"); /* to list sub-tests */ @@ -1655,10 +1706,10 @@ test_get_chunk_info_110(hid_t fapl) error: H5_FAILED(); return FAIL; -} /* test_get_chunk_info_110() */ +} /* test_get_chunk_info_v110() */ /*------------------------------------------------------------------------- - * Function: test_filter_mask_with_skip_compress + * Function: test_flt_msk_with_skip_compress * * Purpose: Test getting chunk info when compression filter is skipped. * @@ -1670,37 +1721,33 @@ error: *------------------------------------------------------------------------- */ static herr_t -test_filter_mask_with_skip_compress(hid_t fapl) +test_flt_msk_with_skip_compress(hid_t fapl) { - hid_t filter_file = H5I_INVALID_HID; /* File for filter mask */ - char filename[FILENAME_BUF_SIZE]; - hid_t dataspace = -1, dataset = -1; - hid_t mem_space = -1; - hid_t cparms = -1, dxpl = -1; - hsize_t dims[2] = {NX, NY}; - hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; - hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY}; - unsigned filter_mask = 0; - unsigned read_flt_msk = 0; - int direct_buf[CHUNK_NX][CHUNK_NY]; - int check_chunk[CHUNK_NX][CHUNK_NY]; - hsize_t offset[2] = {0, 0}; - hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ - hsize_t size = 0; /* Size of an allocated/written chunk */ - hsize_t nchunks = 0; /* Number of chunks */ - haddr_t addr = 0; /* Address of an allocated/written chunk */ - hsize_t chk_index = 0; /* Index of a chunk */ - size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); - int aggression = 9; /* Compression aggression setting */ - unsigned read_filter_mask = 0; /* filter mask after direct read */ - int read_direct_buf[CHUNK_NX][CHUNK_NY]; - hsize_t read_buf_size = 0; /* buf size */ - hsize_t start[2]; /* Start of hyperslab */ - hsize_t stride[2]; /* Stride of hyperslab */ - hsize_t count[2]; /* Block count */ - hsize_t block[2]; /* Block sizes */ - int ii, jj, n; - herr_t status; + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t filter_file = H5I_INVALID_HID; /* File ID for filter mask */ + hid_t dspace = H5I_INVALID_HID; /* Dataspace ID */ + hid_t mem_space = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dset = H5I_INVALID_HID; /* Dataset ID */ + hid_t cparms = H5I_INVALID_HID; /* Creation plist */ + hid_t dxpl = H5I_INVALID_HID; /* Transfer plist */ + hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ + hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* 2 unlimited dims */ + hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ + int direct_buf[CHUNK_NX][CHUNK_NY]; /* One chunk of data */ + int check_chunk[CHUNK_NX][CHUNK_NY]; /* Buffer to read data in */ + int read_direct_buf[CHUNK_NX][CHUNK_NY]; /* Buffer to read a chunk */ + hsize_t read_buf_size = 0; /* buf size */ + unsigned flt_msk = 0; /* Filter mask */ + unsigned read_flt_msk = 0; /* Filter mask after direct read */ + hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ + hsize_t nchunks = 0; /* Number of chunks */ + hsize_t chk_index = 0; /* Index of a chunk */ + int aggression = 9; /* Compression aggression setting */ + hsize_t start[2]; /* Start of hyperslab */ + hsize_t stride[2]; /* Stride of hyperslab */ + hsize_t count[2]; /* Block count */ + hsize_t block[2]; /* Block sizes */ + int ii, jj; /* Array indices */ TESTING("getting filter mask when compression filter is skipped"); @@ -1712,7 +1759,7 @@ test_filter_mask_with_skip_compress(hid_t fapl) TEST_ERROR; /* Create file data space with unlimited dimensions. */ - if((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) + if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0) TEST_ERROR; /* Create memory data space. */ @@ -1724,14 +1771,14 @@ test_filter_mask_with_skip_compress(hid_t fapl) if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR; - if((status = H5Pset_chunk( cparms, RANK, chunk_dims)) < 0) + if(H5Pset_chunk( cparms, RANK, chunk_dims) < 0) TEST_ERROR; - if((status = H5Pset_deflate( cparms, (unsigned ) aggression)) < 0) + if(H5Pset_deflate( cparms, (unsigned ) aggression) < 0) TEST_ERROR; /* Create a new dataset using cparms creation properties. */ - if((dataset = H5Dcreate2(filter_file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) + if((dset = H5Dcreate2(filter_file, SKIP_FILTER_DSET_NAME, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create transfer property list for writing */ @@ -1740,26 +1787,25 @@ test_filter_mask_with_skip_compress(hid_t fapl) /* Initialize data for one chunk */ for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) { - direct_buf[ii][jj] = n++; - } + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[ii][jj] = (int)(ii*jj); /* Indicate the compression filter is to be skipped. */ - filter_mask = 0x00000001; + flt_msk = 0x00000001; /* Write a chunk of uncompressed data */ offset[0] = CHUNK_NX; offset[1] = CHUNK_NY; - if((status = H5Dwrite_chunk(dataset, H5P_DEFAULT, filter_mask, offset, buf_size, direct_buf)) < 0) + if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, direct_buf) < 0) TEST_ERROR; - if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0) + if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0) TEST_ERROR; /* Close and re-open the dataset */ - if(H5Dclose(dataset) < 0) + if(H5Dclose(dset) < 0) TEST_ERROR; - if((dataset = H5Dopen2(filter_file, DATASETNAME2, H5P_DEFAULT)) < 0) + if((dset = H5Dopen2(filter_file, SKIP_FILTER_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR; /* Select hyperslab for the chunk just written in the file */ @@ -1767,88 +1813,80 @@ test_filter_mask_with_skip_compress(hid_t fapl) stride[0] = 1; stride[1] = 1; count[0] = 1; count[1] = 1; block[0] = CHUNK_NX; block[1] = CHUNK_NY; - if((status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, start, stride, count, block)) < 0) + if(H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, stride, count, block) < 0) TEST_ERROR; /* Read the chunk back */ - if((status = H5Dread(dataset, H5T_NATIVE_INT, mem_space, dataspace, H5P_DEFAULT, check_chunk)) < 0) + if(H5Dread(dset, H5T_NATIVE_INT, mem_space, dspace, H5P_DEFAULT, check_chunk) < 0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for(ii = 0; ii < CHUNK_NX; ii++) { - for(jj = 0; jj < CHUNK_NY; jj++) { + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) if(direct_buf[ii][jj] != check_chunk[ii][jj]) { HDprintf(" 1. Read different values than written."); HDprintf(" At index %d,%d\n", ii, jj); HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[ii][jj], check_chunk[ii][jj]); TEST_ERROR; } - } - } /* Query chunk storage size */ - if((status = H5Dget_chunk_storage_size(dataset, offset, &read_buf_size)) < 0) + if(H5Dget_chunk_storage_size(dset, offset, &read_buf_size) < 0) TEST_ERROR; - if(read_buf_size != buf_size) + if(read_buf_size != CHK_SIZE) TEST_ERROR; /* Read the raw chunk back with H5Dread_chunk */ HDmemset(&read_direct_buf, 0, sizeof(read_direct_buf)); - if((status = H5Dread_chunk(dataset, H5P_DEFAULT, offset, &read_filter_mask, read_direct_buf)) < 0) + if(H5Dread_chunk(dset, H5P_DEFAULT, offset, &read_flt_msk, read_direct_buf) < 0) TEST_ERROR; - if(read_filter_mask != filter_mask) + if(read_flt_msk != flt_msk) TEST_ERROR; /* Check that the direct chunk read is the same as the chunk written */ - for(ii = 0; ii < CHUNK_NX; ii++) { - for(jj = 0; jj < CHUNK_NY; jj++) { + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) if(direct_buf[ii][jj] != read_direct_buf[ii][jj]) { HDprintf(" 1. Read different values than written."); HDprintf(" At index %d,%d\n", ii, jj); HDprintf(" direct_buf=%d, read_direct_buf=%d\n", direct_buf[ii][jj], read_direct_buf[ii][jj]); TEST_ERROR; } - } - } /* Get and verify the number of chunks written */ - if(H5Dget_num_chunks(dataset, H5S_ALL, &nchunks) < 0) TEST_ERROR - if(nchunks != 1) TEST_ERROR + if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR + VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); /* Get and verify info of the first and only chunk */ chk_index = 0; - reinit_vars(&read_flt_msk, &addr, &size); - if(H5Dget_chunk_info(dataset, H5S_ALL, chk_index, out_offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info"); - VERIFY(size, buf_size, "H5Dget_chunk_info, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info, filter mask"); - VERIFY(out_offset[0], CHUNK_NX, "H5Dget_chunk_info, offset"); - VERIFY(out_offset[1], CHUNK_NY, "H5Dget_chunk_info, offset"); + offset[0] = CHUNK_NX; + offset[1] = CHUNK_NY; + if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); /* Get info of the chunk at the specified offsets and verify its info */ - if(H5Dget_chunk_info_by_coord(dataset, offset, &read_flt_msk, &addr, &size) < 0) - TEST_ERROR - CHECK(addr, HADDR_UNDEF, "H5Dget_chunk_info_by_coord"); - VERIFY(size, buf_size, "H5Dget_chunk_info_by_coord, chunk size"); - VERIFY(read_flt_msk, filter_mask, "H5Dget_chunk_info_by_coord, filter mask"); + if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); /* Release resourse */ - if(H5Dclose(dataset) < 0) TEST_ERROR + if(H5Dclose(dset) < 0) TEST_ERROR if(H5Sclose(mem_space) < 0) TEST_ERROR - if(H5Sclose(dataspace) < 0) TEST_ERROR + if(H5Sclose(dspace) < 0) TEST_ERROR if(H5Pclose(cparms) < 0) TEST_ERROR if(H5Pclose(dxpl) < 0) TEST_ERROR if(H5Fclose(filter_file) < 0) TEST_ERROR + /* Remove the test file */ + remove(filename); + PASSED(); return SUCCEED; error: H5E_BEGIN_TRY { - H5Dclose(dataset); + H5Dclose(dset); H5Sclose(mem_space); - H5Sclose(dataspace); + H5Sclose(dspace); H5Pclose(cparms); H5Pclose(dxpl); H5Fclose(filter_file); @@ -1856,7 +1894,7 @@ error: H5_FAILED(); return FAIL; -} /* test_filter_mask_with_skip_compress() */ +} /* test_flt_msk_with_skip_compress() */ /*------------------------------------------------------------------------- * Function: main @@ -1882,14 +1920,17 @@ main(void) /* Create a copy of file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR + /* Test basic operations on the chunk query functions */ + nerrors += test_basic_query(fapl) < 0 ? 1 : 0; + /* Tests getting chunk information of version 1.8 and prior */ - nerrors += test_get_chunk_info_highest18(fapl) < 0 ? 1 : 0; + nerrors += test_get_chunk_info_highest_v18(fapl) < 0 ? 1 : 0; /* Tests getting chunk information of version 1.10 */ - nerrors += test_get_chunk_info_110(fapl) < 0 ? 1 : 0; + nerrors += test_get_chunk_info_v110(fapl) < 0 ? 1 : 0; /* Tests getting filter mask when compression filter is skipped */ - nerrors += test_filter_mask_with_skip_compress(fapl) < 0 ? 1 : 0; + nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0; if(nerrors) TEST_ERROR @@ -1909,7 +1950,6 @@ error: /**************************************************************************** Additional tests to be added: -- create/write to a dataset, do the query before closing the dataset - do the query when extending the dataset (shrink or expand) - verify that invalid input parameters are handled properly -- cgit v0.12 From bde9257f0228d71fdf23cb6743e79882f1975a74 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Sun, 1 Sep 2019 01:25:59 -0500 Subject: Updated comments --- test/chunk_info.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index 081c833..18c73d7 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -10,7 +10,6 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - /* * * Purpose: Tests chunk query API functions @@ -20,6 +19,7 @@ * * Test structure: * main() + * test_basic_query() * test_get_chunk_info_highest_v18() * test_get_chunk_info_v110() * test_chunk_info_single_chunk() @@ -31,6 +31,12 @@ * test_flt_msk_with_skip_compress() * * Helper functions: + * read_each_chunk() + * verify_and_write() + * verify_get_chunk_info() + * verify_get_chunk_info_by_coord() + * verify_empty_chunk_info() + * index_type_str() * */ #define H5D_FRIEND @@ -125,6 +131,8 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); static int verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks, unsigned flt_msk); static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk); static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk); +static int verify_empty_chunk_info(hid_t dset, hsize_t *offset); +static const char* index_type_str(H5D_chunk_index_t idx_type); /*------------------------------------------------------------------------- * Function: read_each_chunk (helper function) -- cgit v0.12 From 62750441cdfbf17f7fa5db3bbf1320c1dc5be838 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 2 Sep 2019 12:59:48 -0500 Subject: Add comment to add tests later to verify conflicting values for MPI-specific properties on multiple opens. --- testpar/t_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testpar/t_file.c b/testpar/t_file.c index f1aff19..204095b 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -736,6 +736,11 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, return nerrors; } +/* + * NOTE: See HDFFV-10894 and add tests later to verify MPI-specific properties in the + * incoming fapl that could conflict with the existing values in H5F_shared_t on + * multiple opens of the same file. + */ void test_file_properties(void) { -- cgit v0.12 From daecf8f06d382cd34091c3ccc06c38fb81d9beb6 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 3 Sep 2019 08:03:28 -0500 Subject: Changed H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR to H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD per a review comment. --- src/H5D.c | 2 +- src/H5VLnative.h | 2 +- src/H5VLnative_dataset.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index a22f173..107ac55 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1236,7 +1236,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") /* Call private function to get the chunk info given the chunk's index */ - if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR, offset, filter_mask, addr, size) < 0) + if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, offset, filter_mask, addr, size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates") done: diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 73c6189..a8d5720 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -38,7 +38,7 @@ typedef int H5VL_native_dataset_optional_t; #define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */ #define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */ #define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */ -#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR 5 /* H5Dget_chunk_info_by_coord */ +#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */ #define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */ #define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */ diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c index 4f7f2b5..676d859 100644 --- a/src/H5VLnative_dataset.c +++ b/src/H5VLnative_dataset.c @@ -528,7 +528,7 @@ H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } - case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COOR: + case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: { /* H5Dget_chunk_info_by_coord */ hsize_t *offset = HDva_arg(arguments, hsize_t *); unsigned *filter_mask = HDva_arg(arguments, unsigned *); -- cgit v0.12 From 96dab622e3bbe75d85b0cef3ca2bd5288cf4ac32 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 3 Sep 2019 11:00:29 -0500 Subject: Fixed error code and error messages Tested on Jelly (very minor) --- src/H5D.c | 2 +- test/chunk_info.c | 52 ++++++++++++++++++++++++++-------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 107ac55..96dce3f 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1186,7 +1186,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of /* Check range for chunk index */ if(chk_index >= nchunks) - HGOTO_ERROR(H5E_IO, H5E_DATASET, FAIL, "chunk index is out of range") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range") /* Call private function to get the chunk info given the chunk's index */ if(H5VL_dataset_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, fspace_id, chk_index, offset, filter_mask, addr, size) < 0) diff --git a/test/chunk_info.c b/test/chunk_info.c index 18c73d7..a28ca84 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -551,7 +551,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) offset[0] = 6; offset[1] = 12; if(verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN-1, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Attempt to get info of a non-existing chunk, should fail */ chk_index = OUTOFRANGE_CHK_INDEX; @@ -565,12 +565,12 @@ test_get_chunk_info_highest_v18(hid_t fapl) offset[0] = 0; offset[1] = 0; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); /* Go through all written chunks, get their info and verify the values */ chk_index = 0; @@ -580,11 +580,11 @@ test_get_chunk_info_highest_v18(hid_t fapl) offset[1] = jj * CHUNK_NY; if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Use the same offset to pass into the next ...by_coord function */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); } /* Close the first dataset */ @@ -616,7 +616,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) offset[0] = EMPTY_CHK_X; offset[1] = EMPTY_CHK_Y; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); if(H5Dclose(dset) < 0) TEST_ERROR @@ -799,7 +799,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify info of the chunk at logical coordinates (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, SINGLE_CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); /* Attempt to get chunk info given an invalid chunk index and verify * that failure occurs */ @@ -905,13 +905,13 @@ test_chunk_info_implicit(char *filename, hid_t fapl) hsize_t offset[2] = {ii * CHUNK_NX, jj * CHUNK_NY}; if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Get info of a chunk and verify its information. Note that all chunks in this dataset are allocated because of the property H5D_ALLOC_TIME_EARLY */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); } /* Release resourse */ @@ -1018,7 +1018,7 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); } /* Attempt to get info using an out-of-range index, chk_index is now > NUM_CHUNKS_WRITTEN. should fail */ @@ -1032,12 +1032,12 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) offset[0] = 0; offset[1] = 0; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ for(n = 0; n < NUM_CHUNKS; n++) @@ -1161,10 +1161,10 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) offset[1] = jj * CHUNK_NY; if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); } /* Attempt to get info using an out-of-range index, should fail */ @@ -1179,12 +1179,12 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) offset[0] = 0; offset[1] = 0; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ for(n = 0; n < NUM_CHUNKS; n++) @@ -1307,10 +1307,10 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) offset[1] = jj * CHUNK_NY; if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); } /* Attempt to provide out-of-range offsets, should fail */ @@ -1325,12 +1325,12 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) offset[0] = 0; offset[1] = 0; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); offset[0] = 3 * CHUNK_NX; offset[1] = 3 * CHUNK_NY; if(verify_empty_chunk_info(dset, offset) == FAIL) - TEST_ERROR + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); /* Read each chunk and verify the values */ chk_index = 0; @@ -1451,7 +1451,7 @@ test_basic_query(hid_t fapl) /* Get and verify info of the chunk at the offset (CHUNK_NX,CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); /* Attempt to get chunk info given an invalid chunk index and verify * that failure occurs */ @@ -1480,7 +1480,7 @@ test_basic_query(hid_t fapl) /* Get and verify info of the chunk at the offset (0,0) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); /* Get and verify info of the second written chunk in the dataset, its offset should be (CHUNK_NX, CHUNK_NY) */ @@ -1491,7 +1491,7 @@ test_basic_query(hid_t fapl) /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); /* Get and verify info of an empty chunk, at offset (2*CHUNK_NX, 2*CHUNK_NY) */ @@ -1499,7 +1499,7 @@ test_basic_query(hid_t fapl) offset[1] = 2*CHUNK_NY; /* Get and verify info of the chunk at the offset (CHUNK_NX, CHUNK_NY) */ if(verify_empty_chunk_info(dset, offset) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR @@ -1870,11 +1870,11 @@ test_flt_msk_with_skip_compress(hid_t fapl) offset[0] = CHUNK_NX; offset[1] = CHUNK_NY; if(verify_get_chunk_info(dset, H5S_ALL, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Get info of the chunk at the specified offsets and verify its info */ if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification verify_get_chunk_info_by_coord failed\n"); + FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR -- cgit v0.12 From 781843da4b90d6d22f8a27b6abaad441631ab3d1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 3 Sep 2019 12:07:29 -0500 Subject: Fix CMake build of test needing compression libs --- test/CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c1ac44c..8184d7f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -242,7 +242,7 @@ set (H5_TESTS page_buffer dtypes dsets - chunk_info + chunk_info # compression lib link cmpd_dset filter_fail extend @@ -302,6 +302,7 @@ macro (ADD_H5_EXE file) endmacro () set (H5_TESTS_MULTIPLE + chunk_info direct_chunk testhdf5 cache_image @@ -318,6 +319,18 @@ endforeach () ### M U L T I P L E S O U R C E T E S T S ### ############################################################################## ######### Also special handling of link libs ############# +#-- Adding test for chunk_info +add_executable (chunk_info ${HDF5_TEST_SOURCE_DIR}/chunk_info.c) +target_include_directories (chunk_info PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (chunk_info STATIC) + target_link_libraries (chunk_info PRIVATE ${HDF5_TEST_LIB_TARGET} ${LINK_COMP_LIBS}) +else () + TARGET_C_PROPERTIES (chunk_info SHARED) + target_link_libraries (chunk_info PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${LINK_COMP_LIBS}) +endif () +set_target_properties (chunk_info PROPERTIES FOLDER test) + #-- Adding test for direct_chunk add_executable (direct_chunk ${HDF5_TEST_SOURCE_DIR}/direct_chunk.c) target_include_directories (direct_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -- cgit v0.12 From 714804b28018c8096f65debbbb9f57f7dab2a7f6 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 4 Sep 2019 02:03:32 -0500 Subject: Improvement of test code Description: Fixed tests to handle the case when a requested compression filter is not available. Platform tested Linux/64 (jelly) Darwin (osx1011test) --- test/chunk_info.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index a28ca84..0f61103 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -55,6 +55,11 @@ const char *FILENAME[] = { NULL }; + /* #ifdef H5_HAVE_FILTER_DEFLATE +#undef H5_HAVE_FILTER_DEFLATE +#endif + */ + /* File to be used in test_failed_attempts */ #define FILTERMASK_FILE "tflt_msk" #define BASIC_FILE "basic_query" @@ -449,6 +454,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE); uLong z_src_nbytes = (uLong)CHK_SIZE; void *outbuf = NULL; /* Pointer to new buffer */ + hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */ + void *chunk_ptr = z_src; /* Point to original chunk, and later, to the + compressed data chunk if compression occurs */ hsize_t ii, jj; /* Array indices */ int n; /* Used as chunk index, but int to avoid conversion warning */ herr_t ret; /* Temporary returned value for verifying failure */ @@ -492,6 +500,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) for(jj = 0; jj < CHUNK_NY; jj++) direct_buf[n][ii][jj] = n + 1; +#ifdef H5_HAVE_FILTER_DEFLATE /* Allocate output (compressed) buffer */ outbuf = malloc(z_dst_nbytes); z_dst = (Bytef *)outbuf; @@ -510,24 +519,26 @@ test_get_chunk_info_highest_v18(hid_t fapl) fprintf(stderr, "other deflate error"); TEST_ERROR } +#endif /* end H5_HAVE_FILTER_DEFLATE */ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: (0,2) (0,3) (1,2) (1,3) */ n = 0; for(ii = START_CHK_X; ii < END_CHK_X; ii++) for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { + +#ifdef H5_HAVE_FILTER_DEFLATE + /* Set chunk size to the compressed chunk size and the chunk point + to the compressed data chunk */ + chunk_size = (hsize_t)z_dst_nbytes; + chunk_ptr = (void *)z_dst; +#endif /* end H5_HAVE_FILTER_DEFLATE */ offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, (void*)direct_buf[n]); + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)chunk_ptr); if(ret < 0) TEST_ERROR } - /* Read each chunk in the subset of chunks and verify the values */ - /* if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) - if(read_each_chunk(dset) == FAIL) - TEST_ERROR - */ - /* Free the read buffer */ if(outbuf) HDfree(outbuf); @@ -550,7 +561,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) this time */ offset[0] = 6; offset[1] = 12; - if(verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN-1, CHK_SIZE, offset, flt_msk) == FAIL) + if(verify_get_chunk_info(dset, H5S_ALL, NUM_CHUNKS_WRITTEN-1, chunk_size, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Attempt to get info of a non-existing chunk, should fail */ @@ -579,11 +590,11 @@ test_get_chunk_info_highest_v18(hid_t fapl) offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - if(verify_get_chunk_info(dset, dspace, chk_index, CHK_SIZE, offset, flt_msk) == FAIL) + if(verify_get_chunk_info(dset, dspace, chk_index, chunk_size, offset, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info failed\n"); /* Use the same offset to pass into the next ...by_coord function */ - if(verify_get_chunk_info_by_coord(dset, offset, CHK_SIZE, flt_msk) == FAIL) + if(verify_get_chunk_info_by_coord(dset, offset, chunk_size, flt_msk) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord failed\n"); } -- cgit v0.12 From f651cb4747bafc6025b2a51cf96c065f353ab058 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:35:54 -0500 Subject: Fix build for tools library test --- tools/libtest/CMakeLists.txt | 19 ++++++++----------- tools/libtest/CMakeTests.cmake | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 105607d..dc72676 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -5,17 +5,14 @@ project (HDF5_TOOLS_LIBTEST C) # Add the h5tools_utils test executables #----------------------------------------------------------------------------- add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test_utils.c) -target_include_directories(h5tools_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -TARGET_C_PROPERTIES (h5tools_utils STATIC) -target_link_libraries (h5tools_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) -set_target_properties (h5tools_utils PROPERTIES FOLDER tools) - -if (BUILD_SHARED_LIBS) - add_executable (h5tools_utils-shared ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_utils.c) - target_include_directories(h5tools_utils-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5tools_utils-shared SHARED) - target_link_libraries (h5tools_utils-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - set_target_properties (h5tools_utils-shared PROPERTIES FOLDER tools) +target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5tools_test_utils STATIC) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +else () + TARGET_C_PROPERTIES (h5tools_test_utils SHARED) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () +set_target_properties (h5tools_utils PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/libtest/CMakeTests.cmake b/tools/libtest/CMakeTests.cmake index 403969d..4feee9b 100644 --- a/tools/libtest/CMakeTests.cmake +++ b/tools/libtest/CMakeTests.cmake @@ -34,7 +34,7 @@ if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5LIBTEST-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - add_test (NAME H5LIBTEST-${resultfile} COMMAND $ ${ARGN}) + add_test (NAME H5LIBTEST-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $ ${ARGN}) if (NOT "${resultcode}" STREQUAL "0") set_tests_properties (H5LIBTEST-${resultfile} PROPERTIES WILL_FAIL "true") endif () -- cgit v0.12 From 1ca73845326ab5ab4f63f684babe3549e1c90e63 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:45:25 -0500 Subject: Correct name and add mingw to 32bit toolchain --- config/toolchain/build32.cmake | 36 ++++++++++++++++++++++++++++++++++++ tools/libtest/CMakeLists.txt | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/config/toolchain/build32.cmake b/config/toolchain/build32.cmake index d078956..deb5899 100644 --- a/config/toolchain/build32.cmake +++ b/config/toolchain/build32.cmake @@ -3,6 +3,42 @@ if (WIN32) set (CMAKE_GENERATOR_PLATFORM "x86") elseif(APPLE) set (CMAKE_OSX_ARCHITECTURES "i386") +elseif(MINGW) + set (CMAKE_SYSTEM_NAME Windows) + set (CMAKE_C_COMPILER i686-w64-mingw32-gcc) + set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++) + set (CMAKE_RC_COMPILER i686-w64-mingw32-windres) + set (CMAKE_Fortran_COMPILER i686-w64-mingw32-gfortran) + + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "c++ flags") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "c flags") + + set (LIB32 /usr/lib) # Fedora + + if (EXISTS "/usr/lib32") + set (LIB32 /usr/lib32) # Arch, Solus + endif () + + set (CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE) + set (CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE) + + # this is probably unlikely to be needed, but just in case + set (CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE) + set (CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE) + set (CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE) + + # on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have + # to include the regular system .pc files as well (at the end), because some + # are not always present in the 32 bit directory + if (EXISTS "${LIB32}/pkgconfig") + set (ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig) + endif () + + set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) + set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set (CMAKE_CROSSCOMPILING_EMULATOR wine32) else () set (CMAKE_SYSTEM_NAME Linux) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index dc72676..8b63fd1 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -13,6 +13,6 @@ else () TARGET_C_PROPERTIES (h5tools_test_utils SHARED) target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) endif () -set_target_properties (h5tools_utils PROPERTIES FOLDER tools) +set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) include (CMakeTests.cmake) -- cgit v0.12 From a88f98ae8250972d230c43ba64d49efde8ae9561 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 09:50:42 -0500 Subject: special windows override --- config/cmake/ConfigureChecks.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index cb1eb48..24947f2 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,6 +159,9 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) + if (WIN32) + set(CURL_LIBRARY "-lcurl") + endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) if (${CURL_FOUND} AND ${OPENSSL_FOUND}) -- cgit v0.12 From d5de03225f9e7d653fbc0b4d1c72eb0d3f126818 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 11:43:00 -0500 Subject: add test library --- tools/libtest/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt index 8b63fd1..f3d28da 100644 --- a/tools/libtest/CMakeLists.txt +++ b/tools/libtest/CMakeLists.txt @@ -8,10 +8,10 @@ add_executable (h5tools_test_utils ${HDF5_TOOLS_LIBTEST_SOURCE_DIR}/h5tools_test target_include_directories(h5tools_test_utils PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") if (NOT ONLY_SHARED_LIBS) TARGET_C_PROPERTIES (h5tools_test_utils STATIC) - target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) else () TARGET_C_PROPERTIES (h5tools_test_utils SHARED) - target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_link_libraries (h5tools_test_utils PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) endif () set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools) -- cgit v0.12 From e3e9cf04b07310873c0916448229a0d45eb83c11 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 11:44:32 -0500 Subject: use h5test.h --- tools/libtest/h5tools_test_utils.c | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c index b4d66e0..7908519 100644 --- a/tools/libtest/h5tools_test_utils.c +++ b/tools/libtest/h5tools_test_utils.c @@ -16,40 +16,11 @@ * Jacob Smith 2017-11-10 */ -#include "hdf5.h" -#include "H5private.h" #include "h5tools_utils.h" -/* #include "h5test.h" */ /* linking failure */ +#include "h5test.h" #define UTIL_TEST_DEBUG 0 -#ifndef _H5TEST_ - -#define UTIL_AT() HDfprintf(stdout, " at %s:%d in %s()...\n", \ - __FILE__, __LINE__, FUNC); - -#define UTIL_FAILED(msg) { \ - HDfprintf(stdout, "*FAILED*"); AT() \ - if (msg == NULL) { \ - HDfprintf(stdout,"(NULL)\n"); \ - } else { \ - HDfprintf(stdout, "%s\n", msg); \ - } \ - HDfflush(stdout); \ -} - -#define UTIL_TESTING(msg) { \ - HDfprintf(stdout, "TESTING %-62s", (msg)); \ - HDfflush(stdout); \ -} - -#define UTIL_PASSED() { \ - HDfprintf(stdout, " PASSED\n"); \ - HDfflush(stdout); \ -} - -#endif /* ifndef _H5TEST_ */ - #ifndef __js_test__ #define __js_test__ 1L @@ -548,7 +519,7 @@ test_parse_tuple(void) - UTIL_TESTING("arbitrary-count tuple parsing"); + TESTING("arbitrary-count tuple parsing"); #if H5TOOLS_UTILS_TEST_DEBUG > 0 show_progress = TRUE; @@ -641,7 +612,7 @@ test_populate_ros3_fa(void) int bad_version = 0xf87a; /* arbitrarily wrong version number */ #endif /* H5_HAVE_ROS3_VFD */ - UTIL_TESTING("programmatic ros3 fapl population"); + TESTING("programmatic ros3 fapl population"); #ifndef H5_HAVE_ROS3_VFD HDputs(" -SKIP-"); @@ -1172,7 +1143,7 @@ test_set_configured_fapl(void) n_cases += 5; #endif /* H5_HAVE_LIBHDFS */ - UTIL_TESTING("programmatic fapl set"); + TESTING("programmatic fapl set"); for (unsigned i = 0; i < n_cases; i++) { int result; -- cgit v0.12 From 716125887d3954239d280890b4cbb13288f5eeaa Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 5 Sep 2019 14:14:19 -0500 Subject: Reworked the previously refactorred code. Platforms tested: Linux/64 (jelly) Linux/64 (platypus) Darwin (osx1011test) --- test/chunk_info.c | 311 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 161 insertions(+), 150 deletions(-) diff --git a/test/chunk_info.c b/test/chunk_info.c index 0f61103..d3e5751 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -31,8 +31,7 @@ * test_flt_msk_with_skip_compress() * * Helper functions: - * read_each_chunk() - * verify_and_write() + * verify_idx_nchunks() * verify_get_chunk_info() * verify_get_chunk_info_by_coord() * verify_empty_chunk_info() @@ -55,11 +54,6 @@ const char *FILENAME[] = { NULL }; - /* #ifdef H5_HAVE_FILTER_DEFLATE -#undef H5_HAVE_FILTER_DEFLATE -#endif - */ - /* File to be used in test_failed_attempts */ #define FILTERMASK_FILE "tflt_msk" #define BASIC_FILE "basic_query" @@ -133,48 +127,13 @@ void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size); /* Helper function containing common code that verifies indexing type and number of chunks */ -static int verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks, unsigned flt_msk); +static int verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks); static int verify_get_chunk_info(hid_t dset, hid_t dspace, hsize_t chk_index, hsize_t exp_chk_size, hsize_t *exp_offset, unsigned exp_flt_msk); static int verify_get_chunk_info_by_coord(hid_t dset, hsize_t *offset, hsize_t exp_chk_size, unsigned exp_flt_msk); static int verify_empty_chunk_info(hid_t dset, hsize_t *offset); static const char* index_type_str(H5D_chunk_index_t idx_type); /*------------------------------------------------------------------------- - * Function: read_each_chunk (helper function) - * - * Purpose: Reads the chunk specified by its offset and verifies that - * it contains the same data as what was written. This function - * is used in various test_get_chunk_info... functions. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Date: September 2018 - * - *------------------------------------------------------------------------- - */ -static herr_t read_each_chunk(hid_t dset_id, hsize_t *offset, void *direct_buf) -{ - int read_buf[CHUNK_NX][CHUNK_NY]; - unsigned read_flt_msk = 0; - - HDmemset(&read_buf, 0, sizeof(read_buf)); - - /* Read the chunk specified by its offset */ - if(H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf) < 0) - return FAIL; - - /* Verify that read chunk is the same as the corresponding written one */ - if(HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0) - { - HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset[0], offset[1]); - return FAIL; - } - - return SUCCEED; -} - -/*------------------------------------------------------------------------- * Function: reinit_vars (helper function) * * Purpose: Wipes out variables for the next use, used in various tests. @@ -328,7 +287,66 @@ index_type_str(H5D_chunk_index_t idx_type) } /* index_type_str */ /*------------------------------------------------------------------------- - * Function: verify_and_write (helper function) + * Function: verify_selected_chunks (helper function) + * + * Purpose: Reads the chunks within the boundery {start,end} and verify + * the values against the populated data. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static int +verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end) +{ + int read_buf[CHUNK_NX][CHUNK_NY]; + int expected_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Expected data */ + unsigned read_flt_msk = 0; /* Filter mask read back */ + hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ + hsize_t chk_index; /* Chunk index */ + hsize_t ii, jj; /* Array indices */ + int n; + + HDmemset(&read_buf, 0, sizeof(read_buf)); + + /* Initialize the array of chunk data for all NUM_CHUNKS chunks, this is + the same as the written data and will be used to verify the read data */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + expected_buf[n][ii][jj] = (int)(ii*jj) + 1; + + /* Read each chunk within the boundery of {start,end} and verify the + values against the expected data */ + chk_index = 0; + for(ii = start[0]; ii < end[0]; ii++) + for(jj = start[1]; jj < end[1]; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + + /* Read the current chunk */ + if(H5Dread_chunk(dset, plist, offset, &read_flt_msk, read_buf) < 0) + TEST_ERROR + + /* Verify that read chunk is the same as the corresponding written one */ + if(HDmemcmp(expected_buf[chk_index], read_buf, CHUNK_NX*CHUNK_NY) != 0) + { + HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset[0], offset[1]); + return FAIL; + } + } + + return SUCCEED; + +error: + return FAIL; +} /* verify_selected_chunks */ + +/*------------------------------------------------------------------------- + * Function: write_selected_chunks (helper function) * * Purpose: Verifies that chunk indexing scheme and number of chunks of * the dataset matches the expected values, then write data to @@ -343,19 +361,55 @@ index_type_str(H5D_chunk_index_t idx_type) *------------------------------------------------------------------------- */ static int -verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks, unsigned flt_msk) +write_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end, unsigned flt_msk) { - hid_t dset = H5I_INVALID_HID; /* Dataset ID */ - H5D_chunk_index_t idx_type; /* Dataset chunk index type */ - hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */ - hsize_t nchunks = 0; /* Number of chunks */ - hsize_t ii, jj; /* Array indices */ - int n; /* Used as chunk index, but int to avoid conversion warning */ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ + hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t chk_index; /* Chunk index */ + hsize_t ii, jj; /* Array indices */ + int n; - /* Open the dataset */ - if((dset = H5Dopen2(chunkfile, dset_name, H5P_DEFAULT)) < 0) - TEST_ERROR + /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ + for(n = 0; n < NUM_CHUNKS; n++) + for(ii = 0; ii < CHUNK_NX; ii++) + for(jj = 0; jj < CHUNK_NY; jj++) + direct_buf[n][ii][jj] = (int)(ii*jj) + 1; + + /* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + chk_index = 0; + for(ii = start[0]; ii < end[0]; ii++) + for(jj = start[1]; jj < end[1]; jj++, chk_index++) { + offset[0] = ii * CHUNK_NX; + offset[1] = jj * CHUNK_NY; + if(H5Dwrite_chunk(dset, plist, flt_msk, offset, CHK_SIZE, (void*)direct_buf[chk_index]) < 0) + TEST_ERROR + } + + return SUCCEED; + +error: + return FAIL; +} /* write_selected_chunks */ + +/*------------------------------------------------------------------------- + * Function: verify_idx_nchunks (helper function) + * + * Purpose: Verifies that chunk indexing scheme and number of chunks of + * the dataset match the expected values. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Date: August 2019 + * + *------------------------------------------------------------------------- + */ +static int +verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsize_t exp_num_chunks) +{ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + hsize_t nchunks = 0; /* Number of chunks */ /* Get the chunk indexing type of the dataset */ if(H5Dget_chunk_index_type(dset, &idx_type) < 0) @@ -377,34 +431,11 @@ verify_and_write(hid_t chunkfile, const char* dset_name, hid_t dspace, H5D_chunk if(H5Dget_num_chunks(dset, H5S_ALL, &nchunks) < 0) TEST_ERROR VERIFY(nchunks, exp_num_chunks, "H5Dget_num_chunks, number of chunks"); - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; - - /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords: - (0,2) (0,3) (1,2) (1,3) */ - n = 0; - for(ii = START_CHK_X; ii < END_CHK_X; ii++) - for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, n++) { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - if(H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, CHK_SIZE, (void*)direct_buf[n]) < 0) - TEST_ERROR - } - - /* Close the dataset */ - if(H5Dclose(dset) < 0) TEST_ERROR - return SUCCEED; error: - H5E_BEGIN_TRY { - H5Dclose(dset); - } H5E_END_TRY; return FAIL; -} /* verify_and_write */ +} /* verify_idx_nchunks */ /*------------------------------------------------------------------------- * Function: test_get_chunk_info_highest_v18 @@ -455,8 +486,6 @@ test_get_chunk_info_highest_v18(hid_t fapl) uLong z_src_nbytes = (uLong)CHK_SIZE; void *outbuf = NULL; /* Pointer to new buffer */ hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */ - void *chunk_ptr = z_src; /* Point to original chunk, and later, to the - compressed data chunk if compression occurs */ hsize_t ii, jj; /* Array indices */ int n; /* Used as chunk index, but int to avoid conversion warning */ herr_t ret; /* Temporary returned value for verifying failure */ @@ -498,7 +527,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) for(n = 0; n < NUM_CHUNKS; n++) for(ii = 0; ii < CHUNK_NX; ii++) for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; + direct_buf[n][ii][jj] = (int)(ii*jj) + 1; #ifdef H5_HAVE_FILTER_DEFLATE /* Allocate output (compressed) buffer */ @@ -531,11 +560,10 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Set chunk size to the compressed chunk size and the chunk point to the compressed data chunk */ chunk_size = (hsize_t)z_dst_nbytes; - chunk_ptr = (void *)z_dst; #endif /* end H5_HAVE_FILTER_DEFLATE */ offset[0] = ii * CHUNK_NX; offset[1] = jj * CHUNK_NY; - ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)chunk_ptr); + ret = H5Dwrite_chunk(dset, H5P_DEFAULT, flt_msk, offset, chunk_size, (void*)outbuf); if(ret < 0) TEST_ERROR } @@ -871,6 +899,8 @@ test_chunk_info_implicit(char *filename, hid_t fapl) unsigned flt_msk = 0; /* Filter mask */ hsize_t chk_index = 0; /* Index of a chunk */ hsize_t ii, jj; /* Array indices */ + hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */ + hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */ TESTING(" Implicit index"); @@ -900,15 +930,19 @@ test_chunk_info_implicit(char *filename, hid_t fapl) /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* Verify chunk indexing scheme and number of chunks, and write data to a - subset of chunks. */ - if(verify_and_write(chunkfile, IMPLICIT_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_NONE, NUM_CHUNKS, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Open the dataset again to test getting chunk info */ if((dset = H5Dopen2(chunkfile, IMPLICIT_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR + /* Verify chunk indexing scheme and number of chunks */ + if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_NONE, NUM_CHUNKS) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Writing to selected chunks failed\n"); + /* Go through all chunks, and get their info and verify the values */ chk_index = 0; for(ii = 0; ii < NX/CHUNK_NX; ii++) @@ -972,17 +1006,17 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) hid_t cparms = H5I_INVALID_HID; /* Creation plist */ hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */ + hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ hsize_t ii, jj; /* Array indices */ - int n; /* Used as chunk index, but int to avoid conversion warning */ herr_t ret; /* Temporary returned value for verifying failure */ TESTING(" Fixed Array index"); @@ -1009,15 +1043,19 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* Verify chunk indexing scheme and number of chunks, and write data - to a subset of chunks */ - if(verify_and_write(chunkfile, FIXED_ARR_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_FARRAY, NO_CHUNK_WRITTEN, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Open the dataset again to test getting chunk info */ if((dset = H5Dopen2(chunkfile, FIXED_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR + /* Verify chunk indexing scheme and number of chunks */ + if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_FARRAY, NO_CHUNK_WRITTEN) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Writing to selected chunks failed\n"); + /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); @@ -1050,22 +1088,8 @@ test_chunk_info_fixed_array(const char *filename, hid_t fapl) if(verify_empty_chunk_info(dset, offset) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; - - /* Read each chunk and verify the values */ - chk_index = 0; - for(ii = START_CHK_X; ii < END_CHK_X; ii++) - for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - - if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) - TEST_ERROR - } + /* Read and verify values of selected chunks */ + if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0) /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR @@ -1114,17 +1138,17 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) hsize_t dims[2] = {NX, NY}; /* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */ + hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ hsize_t nchunks = 0; /* Number of chunks */ haddr_t addr = 0; /* Address of an allocated/written chunk */ hsize_t chk_index = 0; /* Index of a chunk */ hsize_t ii, jj; /* Array indices */ - int n; /* Used as chunk index, but int to avoid conversion warning */ herr_t ret; /* Temporary returned value for verifying failure */ TESTING(" Extensible Array index"); @@ -1151,15 +1175,19 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* Verify chunk indexing scheme and number of chunks, and write data - to a subset of chunks */ - if(verify_and_write(chunkfile, EXT_ARR_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_EARRAY, NO_CHUNK_WRITTEN, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Open the dataset again to test getting chunk info */ if((dset = H5Dopen2(chunkfile, EXT_ARR_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR + /* Verify chunk indexing scheme and number of chunks */ + if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_EARRAY, NO_CHUNK_WRITTEN) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Writing to selected chunks failed\n"); + /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); @@ -1197,22 +1225,8 @@ test_chunk_info_extensible_array(const char *filename, hid_t fapl) if(verify_empty_chunk_info(dset, offset) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); - /* Initialize the array of chunk data for all NUM_CHUNKS chunks */ - for(n = 0; n < NUM_CHUNKS; n++) - for(ii = 0; ii < CHUNK_NX; ii++) - for(jj = 0; jj < CHUNK_NY; jj++) - direct_buf[n][ii][jj] = n + 1; - - /* Read each chunk and verify the values */ - chk_index = 0; - for(ii = START_CHK_X; ii < END_CHK_X; ii++) - for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - - if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) - TEST_ERROR - } + /* Read and verify values of selected chunks */ + if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0) /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR @@ -1261,10 +1275,11 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) hsize_t dims[2] = {NX, NY};/* Dataset dimensions */ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */ - int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */ unsigned flt_msk = 0; /* Filter mask */ unsigned read_flt_msk = 0; /* Filter mask after direct read */ hsize_t offset[2]; /* Offset coordinates of a chunk */ + hsize_t start[2] = {START_CHK_X, START_CHK_Y}; /* Start position */ + hsize_t end[2] = {END_CHK_X, END_CHK_Y}; /* End position */ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */ hsize_t size = 0; /* Size of an allocated/written chunk */ hsize_t nchunks = 0; /* Number of chunks */ @@ -1297,15 +1312,19 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR - /* Verify chunk indexing scheme and number of chunks, and write data - to a subset of chunks */ - if(verify_and_write(chunkfile, V2_BTREE_INDEX_DSET_NAME, dspace, H5D_CHUNK_IDX_BT2, NO_CHUNK_WRITTEN, flt_msk) == FAIL) - FAIL_PUTS_ERROR("Verification and write failed\n"); - /* Open the dataset again to test getting chunk info */ if((dset = H5Dopen2(chunkfile, V2_BTREE_INDEX_DSET_NAME, H5P_DEFAULT)) < 0) TEST_ERROR + /* Verify chunk indexing scheme and number of chunks */ + if(verify_idx_nchunks(dset, dspace, H5D_CHUNK_IDX_BT2, NO_CHUNK_WRITTEN) == FAIL) + FAIL_PUTS_ERROR("Verification and write failed\n"); + + /* Write NUM_CHUNKS_WRITTEN chunks at the following logical coords: + (0,2) (0,3) (1,2) (1,3) */ + if(write_selected_chunks(dset, H5P_DEFAULT, start, end, flt_msk) == FAIL) + FAIL_PUTS_ERROR("Writing to selected chunks failed\n"); + /* Get and verify the number of chunks written */ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR VERIFY(nchunks, NUM_CHUNKS_WRITTEN, "H5Dget_num_chunks, number of chunks"); @@ -1343,16 +1362,8 @@ test_chunk_info_version2_btrees(const char *filename, hid_t fapl) if(verify_empty_chunk_info(dset, offset) == FAIL) FAIL_PUTS_ERROR("Verification of H5Dget_chunk_info_by_coord on empty chunk failed\n"); - /* Read each chunk and verify the values */ - chk_index = 0; - for(ii = START_CHK_X; ii < END_CHK_X; ii++) - for(jj = START_CHK_Y; jj < END_CHK_Y; jj++, chk_index++) { - offset[0] = ii * CHUNK_NX; - offset[1] = jj * CHUNK_NY; - - if(read_each_chunk(dset, offset, (void*)direct_buf[chk_index]) < 0) - TEST_ERROR - } + /* Read and verify values of selected chunks */ + if(verify_selected_chunks(dset, H5P_DEFAULT, start, end) < 0) /* Release resourse */ if(H5Dclose(dset) < 0) TEST_ERROR -- cgit v0.12 From dcab85c83b72bd41fcefd8d989b3d17db8b44981 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:35:33 -0500 Subject: Add back missing java implementation --- java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java | 6 +- java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java | 20 +- java/src/jni/h5pFAPLImp.c | 328 +++++++++++++++++++++ java/src/jni/h5pFAPLImp.h | 36 +++ java/test/TestH5Pfaplhdfs.java | 69 +---- java/test/TestH5Pfapls3.java | 67 +---- src/H5FDros3.h | 20 +- 7 files changed, 417 insertions(+), 129 deletions(-) diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index c13473c..9fcff2e 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -23,14 +23,14 @@ import java.io.Serializable; * Used for the access of files hosted on the Hadoop Distributed File System. */ -@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly public class H5FD_hdfs_fapl_t implements Serializable { + private static final long serialVersionUID = 2072473407027648309L; - private long version; + private int version; private String namenode_name; + private int namenode_port; private String user_name; private String kerberos_ticket_cache; - private int namenode_port; private int stream_buffer_size; /* diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index 881aad3..a899e10 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -17,13 +17,14 @@ package hdf.hdf5lib.structs; import java.io.Serializable; /* - * Java representation of the ROS3 VFD file access property list (fapl) + * Java representation of the ROS3 VFD file access property list (fapl) * structure. * * Used for the access of files hosted remotely on S3 by Amazon. - * + * * For simplicity, implemented assuming that all ROS3 fapls have components: * - version + * - authenticate * - aws_region * - secret_id * - secret_key @@ -38,14 +39,15 @@ import java.io.Serializable; * H5FD_ros3_fapl_v2_t (extends super with Version 2 components) * and so on, for each version * - * "super" is passed around, and is version-checked and re-cast as + * "super" is passed around, and is version-checked and re-cast as * appropriate */ -@SuppressWarnings("serial") // mute default serialUID warnings until someone knowledgeable comes along or something breaks horribly public class H5FD_ros3_fapl_t implements Serializable { + private static final long serialVersionUID = 8985533001471224030L; - private long version; + private int version; + private boolean authenticate; private String aws_region; private String secret_id; private String secret_key; @@ -111,10 +113,10 @@ public class H5FD_ros3_fapl_t implements Serializable { @Override public String toString() { return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" + - "\n aws_region : " + this.aws_region + - "\n secret_id : " + this.secret_id + - "\n secret_key : " + this.secret_key + - "\n}\n"; + "\n aws_region : " + this.aws_region + + "\n secret_id : " + this.secret_id + + "\n secret_key : " + this.secret_key + + "\n}\n"; } } diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index acfc853..4241758 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -370,6 +370,176 @@ done: return (jlong)offset; } /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */ +/* Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs + (JNIEnv *env, jclass clss, jlong fapl_id) +{ +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_fapl_t fa; + jvalue args[5]; + jint j_namenode_port = 0; + jstring j_namenode_name = NULL; + jstring j_user_name = NULL; + jstring j_kerb_cache_path = NULL; + jint j_stream_buffer_size = 0; +#endif /* H5_HAVE_LIBHDFS */ + jobject ret_obj = NULL; + + UNUSED(clss); + +#ifdef H5_HAVE_LIBHDFS + if (H5Pget_fapl_hdfs((hid_t)fapl_id, &fa) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL != fa.namenode_name) { + if (NULL == (j_namenode_name = ENVPTR->NewStringUTF(ENVONLY, fa.namenode_name))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create namenode_name string"); + } + } + args[0].l = j_namenode_name; + + args[1].i = (jint)fa.namenode_port; + + if (NULL != fa.user_name) { + if (NULL == (j_user_name = ENVPTR->NewStringUTF(ENVONLY, fa.user_name))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create user_name string"); + } + } + args[2].l = j_user_name; + + if (NULL != fa.kerberos_ticket_cache) { + if (NULL == (j_kerb_cache_path = ENVPTR->NewStringUTF(ENVONLY, fa.kerberos_ticket_cache))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_hdfs: out of memory - can't create kerberos_ticket_cache string"); + } + } + args[3].l = j_kerb_cache_path; + + args[4].i = (jint)fa.stream_buffer_size; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj); + +done: +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs + (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) +{ +#ifdef H5_HAVE_LIBHDFS + H5FD_hdfs_fapl_t instance; + const char *str = NULL; + jfieldID fid; + jstring j_str; + jclass cls; +#endif /* H5_HAVE_LIBHDFS */ + + UNUSED(clss); + +#ifdef H5_HAVE_LIBHDFS + HDmemset(&instance, 0, sizeof(H5FD_hdfs_fapl_t)); + + if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_name", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); + + HDstrncpy(instance.namenode_name, str, H5FD__HDFS_NODE_NAME_SPACE + 1); + instance.namenode_name[H5FD__HDFS_NODE_NAME_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.namenode_name, 0, H5FD__HDFS_NODE_NAME_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "namenode_port", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.namenode_port = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "user_name", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); + + HDstrncpy(instance.user_name, str, H5FD__HDFS_USER_NAME_SPACE + 1); + instance.user_name[H5FD__HDFS_USER_NAME_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.user_name, 0, H5FD__HDFS_USER_NAME_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "kerberos_ticket_cache", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); + + HDstrncpy(instance.kerberos_ticket_cache, str, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + instance.kerberos_ticket_cache[H5FD__HDFS_KERB_CACHE_PATH_SPACE] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.kerberos_ticket_cache, 0, H5FD__HDFS_KERB_CACHE_PATH_SPACE + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "stream_buffer_size", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.stream_buffer_size = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (H5Pset_fapl_hdfs((hid_t) fapl_id, &instance) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ + /* * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_log @@ -617,6 +787,164 @@ done: */ /* + * Class: hdf5_hdf5lib_H5 + * Method: H5Pget_fapl_ros3 + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 + (JNIEnv *env, jclass clss, jlong fapl_id) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_fapl_t fa; + jvalue args[3]; + jstring j_aws = NULL; + jstring j_id = NULL; + jstring j_key = NULL; +#endif /* H5_HAVE_ROS3_VFD */ + jobject ret_obj = NULL; + + UNUSED(clss); + +#ifdef H5_HAVE_ROS3_VFD + /* pass fapl and fapl_t instance into library get_fapl */ + /* store fapl details in ros3_fapl_t instance `fa` */ + if (H5Pget_fapl_ros3((hid_t)loc_id, &fa) < 0) + H5_LIBRARY_ERROR(ENVONLY); + + if (NULL != fa.aws_region) { + if (NULL == (j_aws = ENVPTR->NewStringUTF(ENVONLY, fa.aws_region))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create aws_region string"); + } + } + args[0].l = j_aws; + + if (NULL != fa.secret_id) { + if (NULL == (j_id = ENVPTR->NewStringUTF(ENVONLY, fa.secret_id))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_id string"); + } + } + args[1].l = j_id; + + if (NULL != fa.secret_key) { + if (NULL == (j_key = ENVPTR->NewStringUTF(ENVONLY, fa.secret_key))) { + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_ros3: out of memory - can't create secret_key string"); + } + } + args[2].l = j_key; + + CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj); + +done: +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_ros3 + * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 + (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) +{ +#ifdef H5_HAVE_ROS3_VFD + H5FD_ros3_fapl_t instance; + const char *str = NULL; + jfieldID fid; + jstring j_str; + jclass cls; +#endif /* H5_HAVE_ROS3_VFD */ + + UNUSED(clss); + +#ifdef H5_HAVE_ROS3_VFD + HDmemset(&instance, 0, sizeof(H5FD_ros3_fapl_t)); + + if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, fapl_config))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + instance.version = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "aws_region", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); + + HDstrncpy(instance.aws_region, str, H5FD_ROS3_MAX_REGION_LEN + 1); + instance.aws_region[H5FD_ROS3_MAX_REGION_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.aws_region, 0, H5FD_ROS3_MAX_REGION_LEN + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_id", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); + + HDstrncpy(instance.secret_id, str, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + instance.secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.secret_id, 0, H5FD_ROS3_MAX_SECRET_ID_LEN + 1); + + if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "secret_key", "Ljava/lang/String;"))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + + if (j_str) { + PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); + + HDstrncpy(instance.secret_key, str, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + instance.secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN] = '\0'; + + UNPIN_JAVA_STRING(ENVONLY, j_str, str); + str = NULL; + } + else + HDmemset(instance.secret_key, 0, H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + + if (instance.aws_region[0] != '\0' && instance.secret_id[0] !='\0' && instance.secret_key[0] !='\0') + instance.authenticate = TRUE; + + if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0) + H5_LIBRARY_ERROR(ENVONLY); + +done: + if (str) + UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */ + +/* * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_split * Signature: (JLjava/lang/String;JLjava/lang/String;J)V diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h index 28b1d95..9b353e6 100644 --- a/java/src/jni/h5pFAPLImp.h +++ b/java/src/jni/h5pFAPLImp.h @@ -137,6 +137,24 @@ Java_hdf_hdf5lib_H5_H5Pget_1family_1offset /* * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_hdfs + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_hdfs_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_hdfs + * Signature: (JLhdf/hdf5lib/structs/H5FD_hdfs_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_log * Signature: (JLjava/lang/String;JJ)V */ @@ -188,6 +206,24 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi /* * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_ros3 + * Signature: (J)Lhdf/hdf5lib/structs/H5FD_ros3_fapl_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_ros3 + * Signature: (JLhdf/hdf5lib/structs/H5FD_ros3_fapl_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 * Method: H5Pset_fapl_split * Signature: (JLjava/lang/String;JLjava/lang/String;J)V */ diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index 30d326e..b0d42d8 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -19,18 +19,11 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; -import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; import org.junit.Before; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfaplhdfs { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfaplhdfs { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfaplhdfs { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,23 +89,11 @@ public class TestH5Pfaplhdfs { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testHDFS_fapl() - throws Exception + public void testHDFS_fapl() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -127,34 +104,17 @@ public class TestH5Pfaplhdfs { String kerbcache = "/dev/null"; int streamsize = 1024; - final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize - ); - assertTrue("setting fapl should succeed", - -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); + final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize); + assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); - assertEquals("driver types should match", - HDF5Constants.H5FD_HDFS, - H5.H5Pget_driver(fapl_id)); + assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id); - assertEquals("fapl contents should match", - new H5FD_hdfs_fapl_t( - nodename, - nodeport, - username, - kerbcache, - streamsize), - copy); + assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_hdfs_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -162,8 +122,7 @@ public class TestH5Pfaplhdfs { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_hdfs_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); @@ -172,9 +131,7 @@ public class TestH5Pfaplhdfs { /* TODO: for now, test against a sec2 fapl only */ H5.H5Pset_fapl_sec2(fapl_id); - assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id); } diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index 00a2a73..ba10524 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -19,17 +19,10 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.io.File; -import java.text.DecimalFormat; -import java.text.NumberFormat; - import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import hdf.hdf5lib.exceptions.HDF5PropertyListInterfaceException; -import hdf.hdf5lib.structs.H5AC_cache_config_t; -import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; import org.junit.After; @@ -41,11 +34,6 @@ import org.junit.rules.TestName; public class TestH5Pfapls3 { @Rule public TestName testname = new TestName(); - long H5fid = -1; - long H5dsid = -1; - long H5did = -1; - long H5Fdsid = -1; - long H5Fdid = -1; long fapl_id = -1; long plapl_id = -1; long dapl_id = -1; @@ -53,9 +41,9 @@ public class TestH5Pfapls3 { long btplist_id = -1; @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -89,7 +77,8 @@ public class TestH5Pfapls3 { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} if (plapl_id > 0) @@ -100,48 +89,32 @@ public class TestH5Pfapls3 { try {H5.H5Pclose(plist_id);} catch (Exception ex) {} if (btplist_id > 0) try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} - - if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} - if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} - if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} - if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} - if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} System.out.println(); } @Test - public void testH5Pset_fapl_ros3() - throws Exception + public void testH5Pset_fapl_ros3() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(); assertEquals("Default fapl has unexpected contents", - new H5FD_ros3_fapl_t("", "", ""), - config); + new H5FD_ros3_fapl_t("", "", ""), config); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); /* get_fapl_ros3 can throw exception in error cases */ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t("", "", ""), - copy); + new H5FD_ros3_fapl_t("", "", ""), copy); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_invalid_fapl_id() - throws Exception + public void testH5Pget_fapl_ros3_invalid_fapl_id() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -149,8 +122,7 @@ public class TestH5Pfapls3 { } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() - throws Exception + public void testH5Pget_fapl_ros3_fapl_id_of_wrong_driver_type() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); @@ -160,14 +132,12 @@ public class TestH5Pfapls3 { H5.H5Pset_fapl_sec2(fapl_id); assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id); } @Test - public void testH5Pset_fapl_ros3_specified() - throws Exception + public void testH5Pset_fapl_ros3_specified() throws Exception { if (HDF5Constants.H5FD_ROS3 < 0) return; @@ -176,19 +146,14 @@ public class TestH5Pfapls3 { String acc_id = "my_access_id"; String acc_key = "my_access_key"; - final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t( - region, - acc_id, - acc_key); + final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key); H5.H5Pset_fapl_ros3(fapl_id, config); assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, - H5.H5Pget_driver(fapl_id)); + HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t(region, acc_id, acc_key), - copy); + new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy); } } diff --git a/src/H5FDros3.h b/src/H5FDros3.h index 250c7cc..457326e 100644 --- a/src/H5FDros3.h +++ b/src/H5FDros3.h @@ -11,12 +11,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * Programmer: John Mainzer * 2017-10-10 * - * Purpose: The public header file for the ros3 driver. + * Purpose: The public header file for the ros3 driver. */ #ifndef H5FDros3_H #define H5FDros3_H @@ -35,16 +35,16 @@ * * Purpose: * - * H5FD_ros3_fapl_t is a public structure that is used to pass S3 - * authentication data to the appropriate S3 VFD via the FAPL. A pointer - * to an instance of this structure is a parameter to H5Pset_fapl_ros3() + * H5FD_ros3_fapl_t is a public structure that is used to pass S3 + * authentication data to the appropriate S3 VFD via the FAPL. A pointer + * to an instance of this structure is a parameter to H5Pset_fapl_ros3() * and H5Pget_fapl_ros3(). * * * * `version` (int32_t) * - * Version number of the H5FD_ros3_fapl_t structure. Any instance passed + * Version number of the H5FD_ros3_fapl_t structure. Any instance passed * to the above calls must have a recognized version number, or an error * will be flagged. * @@ -53,8 +53,8 @@ * `authenticate` (hbool_t) * * Flag TRUE or FALSE whether or not requests are to be authenticated - * with the AWS4 algorithm. - * If TRUE, `aws_region`, `secret_id`, and `secret_key` must be populated. + * with the AWS4 algorithm. + * If TRUE, `aws_region`, `secret_id`, and `secret_key` must be populated. * If FALSE, those three components are unused. * * `aws_region` (char[]) @@ -91,8 +91,8 @@ extern "C" { #endif H5_DLL hid_t H5FD_ros3_init(void); -H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa_out); -H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t * fa); +H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out); +H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa); #ifdef __cplusplus } -- cgit v0.12 From 3467de59f8e7a6bb3ec5164a99b3123d82e3a301 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:57:35 -0500 Subject: Correct label and var names --- java/src/jni/h5pFAPLImp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 4241758..69cdfdb 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -424,11 +424,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs args[4].i = (jint)fa.stream_buffer_size; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj); - -done: #else H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented"); #endif /* H5_HAVE_LIBHDFS */ + +done: return ret_obj; } /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs */ @@ -441,9 +441,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { + const char *str = NULL; #ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t instance; - const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -529,15 +529,15 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs instance.stream_buffer_size = ENVPTR->GetIntField(ENVONLY, fapl_config, fid); CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); - if (H5Pset_fapl_hdfs((hid_t) fapl_id, &instance) < 0) + if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0) H5_LIBRARY_ERROR(ENVONLY); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); +#endif /* H5_HAVE_LIBHDFS */ done: if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -#else - H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented"); -#endif /* H5_HAVE_LIBHDFS */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ /* @@ -809,7 +809,7 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 #ifdef H5_HAVE_ROS3_VFD /* pass fapl and fapl_t instance into library get_fapl */ /* store fapl details in ros3_fapl_t instance `fa` */ - if (H5Pget_fapl_ros3((hid_t)loc_id, &fa) < 0) + if (H5Pget_fapl_ros3((hid_t)fapl_id, &fa) < 0) H5_LIBRARY_ERROR(ENVONLY); if (NULL != fa.aws_region) { @@ -837,11 +837,11 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 args[2].l = j_key; CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj); - -done: #else H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented"); #endif /* H5_HAVE_ROS3_VFD */ + +done: return ret_obj; } /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3 */ @@ -854,9 +854,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { + const char *str = NULL; #ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t instance; - const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -935,13 +935,13 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0) H5_LIBRARY_ERROR(ENVONLY); +#else + H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); +#endif /* H5_HAVE_ROS3_VFD */ done: if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -#else - H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented"); -#endif /* H5_HAVE_ROS3_VFD */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */ /* -- cgit v0.12 From ff4cb06d425d04c87f4a8389e93b8ea5ef39e110 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 14:58:07 -0500 Subject: Add updated find module for earlier CMake versions --- MANIFEST | 1 + config/cmake_ext_mod/FindCURL.cmake | 193 ++++++++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 config/cmake_ext_mod/FindCURL.cmake diff --git a/MANIFEST b/MANIFEST index 2e0022e..93661fa 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3304,6 +3304,7 @@ ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake +./config/cmake_ext_mod/FindCURL.cmake ./config/cmake_ext_mod/FindSZIP.cmake ./config/cmake_ext_mod/GetTimeOfDayTest.cpp ./config/cmake_ext_mod/grepTest.cmake diff --git a/config/cmake_ext_mod/FindCURL.cmake b/config/cmake_ext_mod/FindCURL.cmake new file mode 100644 index 0000000..84299ec --- /dev/null +++ b/config/cmake_ext_mod/FindCURL.cmake @@ -0,0 +1,193 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindCURL +-------- + +Find the native CURL headers and libraries. + +This module accept optional COMPONENTS to check supported features and +protocols:: + + PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 + POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP + FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO + Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy + +IMPORTED Targets +^^^^^^^^^^^^^^^^ + +This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if +curl has been found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module defines the following variables: + +``CURL_FOUND`` + "True" if ``curl`` found. + +``CURL_INCLUDE_DIRS`` + where to find ``curl``/``curl.h``, etc. + +``CURL_LIBRARIES`` + List of libraries when using ``curl``. + +``CURL_VERSION_STRING`` + The version of ``curl`` found. +#]=======================================================================] + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CURL QUIET libcurl) + if(PC_CURL_FOUND) + set(CURL_VERSION_STRING ${PC_CURL_VERSION}) + pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols) + pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features) + endif() +endif() + +# Look for the header file. +find_path(CURL_INCLUDE_DIR + NAMES curl/curl.h + HINTS ${PC_CURL_INCLUDE_DIRS}) +mark_as_advanced(CURL_INCLUDE_DIR) + +if(NOT CURL_LIBRARY) + # Look for the library (sorted from most current/relevant entry to least). + find_library(CURL_LIBRARY_RELEASE NAMES + curl + # Windows MSVC prebuilts: + curllib + libcurl_imp + curllib_static + # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): + libcurl + HINTS ${PC_CURL_LIBRARY_DIRS} + ) + mark_as_advanced(CURL_LIBRARY_RELEASE) + + find_library(CURL_LIBRARY_DEBUG NAMES + # Windows MSVC CMake builds in debug configuration on vcpkg: + libcurl-d_imp + libcurl-d + HINTS ${PC_CURL_LIBRARY_DIRS} + ) + mark_as_advanced(CURL_LIBRARY_DEBUG) + + include(SelectLibraryConfigurations.cmake) + select_library_configurations(CURL) +endif() + +if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING) + foreach(_curl_version_header curlver.h curl.h) + if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") + file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") + + string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") + unset(curl_version_str) + break() + endif() + endforeach() +endif() + +if(CURL_FIND_COMPONENTS) + set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP) + set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy) + foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES) + set(CURL_${component}_FOUND FALSE) + endforeach() + if(NOT PC_CURL_FOUND) + find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config) + if(CURL_CONFIG_EXECUTABLE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version + OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature + OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}") + execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols + OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") + endif() + + endif() + foreach(component IN LISTS CURL_FIND_COMPONENTS) + list(FIND CURL_KNOWN_PROTOCOLS ${component} _found) + if(_found) + list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required protocol ${component} is not found") + endif() + else() + list(FIND CURL_SUPPORTED_FEATURES ${component} _found) + if(_found) + set(CURL_${component}_FOUND TRUE) + elseif(CURL_FIND_REQUIRED) + message(FATAL_ERROR "CURL: Required feature ${component} is not found") + endif() + endif() + endforeach() +endif() + +include(FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(CURL + REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR + VERSION_VAR CURL_VERSION_STRING + HANDLE_COMPONENTS) + +if(CURL_FOUND) + set(CURL_LIBRARIES ${CURL_LIBRARY}) + set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) + + if(NOT TARGET CURL::libcurl) + add_library(CURL::libcurl UNKNOWN IMPORTED) + set_target_properties(CURL::libcurl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + + if(EXISTS "${CURL_LIBRARY}") + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${CURL_LIBRARY}") + endif() + if(CURL_LIBRARY_RELEASE) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") + endif() + if(CURL_LIBRARY_DEBUG) + set_property(TARGET CURL::libcurl APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(CURL::libcurl PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") + endif() + endif() +endif() + +mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR) + +# Report the results. +if (NOT CURL_FOUND) + set (CURL_DIR_MESSAGE + "CURL was not found. Make sure CURL_LIBRARY and CURL_INCLUDE_DIR are set or set the CURL_INSTALL environment variable." + ) + if (NOT CURL_FIND_QUIETLY) + message (STATUS "${CURL_DIR_MESSAGE}") + else () + if (CURL_FIND_REQUIRED) + message (FATAL_ERROR "CURL was NOT found and is Required by this project") + endif () + endif () +endif () -- cgit v0.12 From 60cc470a359f13eba31945c396a58fd96a490f35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:21:02 -0500 Subject: Fix unused var --- java/src/jni/h5pFAPLImp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 69cdfdb..f737319 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -441,9 +441,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { - const char *str = NULL; #ifdef H5_HAVE_LIBHDFS H5FD_hdfs_fapl_t instance; + const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -536,8 +536,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs #endif /* H5_HAVE_LIBHDFS */ done: +#ifdef H5_HAVE_LIBHDFS if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#endif /* H5_HAVE_LIBHDFS */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs */ /* @@ -854,9 +856,9 @@ JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 (JNIEnv *env, jclass clss, jlong fapl_id, jobject fapl_config) { - const char *str = NULL; #ifdef H5_HAVE_ROS3_VFD H5FD_ros3_fapl_t instance; + const char *str = NULL; jfieldID fid; jstring j_str; jclass cls; @@ -940,8 +942,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 #endif /* H5_HAVE_ROS3_VFD */ done: +#ifdef H5_HAVE_ROS3_VFD if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); +#endif /* H5_HAVE_LIBHDFS */ } /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 */ /* -- cgit v0.12 From 9857dc553f49084f9039ae2e8d5f80420bf53b56 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:41:07 -0500 Subject: Update Windows require for CURL to CMake 3.13 --- MANIFEST | 1 - config/cmake/ConfigureChecks.cmake | 5 +- config/cmake_ext_mod/FindCURL.cmake | 193 ------------------------------------ 3 files changed, 3 insertions(+), 196 deletions(-) delete mode 100644 config/cmake_ext_mod/FindCURL.cmake diff --git a/MANIFEST b/MANIFEST index 93661fa..2e0022e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3304,7 +3304,6 @@ ./config/cmake_ext_mod/ConfigureChecks.cmake ./config/cmake_ext_mod/CTestCustom.cmake -./config/cmake_ext_mod/FindCURL.cmake ./config/cmake_ext_mod/FindSZIP.cmake ./config/cmake_ext_mod/GetTimeOfDayTest.cpp ./config/cmake_ext_mod/grepTest.cmake diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 24947f2..8230df8 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -159,8 +159,9 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if (HDF5_ENABLE_ROS3_VFD) - if (WIN32) - set(CURL_LIBRARY "-lcurl") + # CMake version 3.13 fixed FindCURL module + if(CMAKE_VERSION VERSION_LESS "3.13.0" AND WIN32) + MESSAGE(FATAL_ERROR "Windows builds for this option requires a minimum of CMake 3.13") endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) diff --git a/config/cmake_ext_mod/FindCURL.cmake b/config/cmake_ext_mod/FindCURL.cmake deleted file mode 100644 index 84299ec..0000000 --- a/config/cmake_ext_mod/FindCURL.cmake +++ /dev/null @@ -1,193 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindCURL --------- - -Find the native CURL headers and libraries. - -This module accept optional COMPONENTS to check supported features and -protocols:: - - PROTOCOLS: ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 - POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP - FEATURES: SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO - Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy - -IMPORTED Targets -^^^^^^^^^^^^^^^^ - -This module defines :prop_tgt:`IMPORTED` target ``CURL::libcurl``, if -curl has been found. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module defines the following variables: - -``CURL_FOUND`` - "True" if ``curl`` found. - -``CURL_INCLUDE_DIRS`` - where to find ``curl``/``curl.h``, etc. - -``CURL_LIBRARIES`` - List of libraries when using ``curl``. - -``CURL_VERSION_STRING`` - The version of ``curl`` found. -#]=======================================================================] - -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_CURL QUIET libcurl) - if(PC_CURL_FOUND) - set(CURL_VERSION_STRING ${PC_CURL_VERSION}) - pkg_get_variable(CURL_SUPPORTED_PROTOCOLS libcurl supported_protocols) - pkg_get_variable(CURL_SUPPORTED_FEATURES libcurl supported_features) - endif() -endif() - -# Look for the header file. -find_path(CURL_INCLUDE_DIR - NAMES curl/curl.h - HINTS ${PC_CURL_INCLUDE_DIRS}) -mark_as_advanced(CURL_INCLUDE_DIR) - -if(NOT CURL_LIBRARY) - # Look for the library (sorted from most current/relevant entry to least). - find_library(CURL_LIBRARY_RELEASE NAMES - curl - # Windows MSVC prebuilts: - curllib - libcurl_imp - curllib_static - # Windows older "Win32 - MSVC" prebuilts (libcurl.lib, e.g. libcurl-7.15.5-win32-msvc.zip): - libcurl - HINTS ${PC_CURL_LIBRARY_DIRS} - ) - mark_as_advanced(CURL_LIBRARY_RELEASE) - - find_library(CURL_LIBRARY_DEBUG NAMES - # Windows MSVC CMake builds in debug configuration on vcpkg: - libcurl-d_imp - libcurl-d - HINTS ${PC_CURL_LIBRARY_DIRS} - ) - mark_as_advanced(CURL_LIBRARY_DEBUG) - - include(SelectLibraryConfigurations.cmake) - select_library_configurations(CURL) -endif() - -if(CURL_INCLUDE_DIR AND NOT CURL_VERSION_STRING) - foreach(_curl_version_header curlver.h curl.h) - if(EXISTS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}") - file(STRINGS "${CURL_INCLUDE_DIR}/curl/${_curl_version_header}" curl_version_str REGEX "^#define[\t ]+LIBCURL_VERSION[\t ]+\".*\"") - - string(REGEX REPLACE "^#define[\t ]+LIBCURL_VERSION[\t ]+\"([^\"]*)\".*" "\\1" CURL_VERSION_STRING "${curl_version_str}") - unset(curl_version_str) - break() - endif() - endforeach() -endif() - -if(CURL_FIND_COMPONENTS) - set(CURL_KNOWN_PROTOCOLS ICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTMP RTSP SCP SFTP SMB SMBS SMTP SMTPS TELNET TFTP) - set(CURL_KNOWN_FEATURES SSL IPv6 UnixSockets libz AsynchDNS IDN GSS-API PSL SPNEGO Kerberos NTLM NTLM_WB TLS-SRP HTTP2 HTTPS-proxy) - foreach(component IN LISTS CURL_KNOWN_PROTOCOLS CURL_KNOWN_FEATURES) - set(CURL_${component}_FOUND FALSE) - endforeach() - if(NOT PC_CURL_FOUND) - find_program(CURL_CONFIG_EXECUTABLE NAMES curl-config) - if(CURL_CONFIG_EXECUTABLE) - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --version - OUTPUT_VARIABLE CURL_CONFIG_VERSION_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --feature - OUTPUT_VARIABLE CURL_CONFIG_FEATURES_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_SUPPORTED_FEATURES "${CURL_CONFIG_FEATURES_STRING}") - execute_process(COMMAND ${CURL_CONFIG_EXECUTABLE} --protocols - OUTPUT_VARIABLE CURL_CONFIG_PROTOCOLS_STRING - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" CURL_SUPPORTED_PROTOCOLS "${CURL_CONFIG_PROTOCOLS_STRING}") - endif() - - endif() - foreach(component IN LISTS CURL_FIND_COMPONENTS) - list(FIND CURL_KNOWN_PROTOCOLS ${component} _found) - if(_found) - list(FIND CURL_SUPPORTED_PROTOCOLS ${component} _found) - if(_found) - set(CURL_${component}_FOUND TRUE) - elseif(CURL_FIND_REQUIRED) - message(FATAL_ERROR "CURL: Required protocol ${component} is not found") - endif() - else() - list(FIND CURL_SUPPORTED_FEATURES ${component} _found) - if(_found) - set(CURL_${component}_FOUND TRUE) - elseif(CURL_FIND_REQUIRED) - message(FATAL_ERROR "CURL: Required feature ${component} is not found") - endif() - endif() - endforeach() -endif() - -include(FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(CURL - REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR - VERSION_VAR CURL_VERSION_STRING - HANDLE_COMPONENTS) - -if(CURL_FOUND) - set(CURL_LIBRARIES ${CURL_LIBRARY}) - set(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR}) - - if(NOT TARGET CURL::libcurl) - add_library(CURL::libcurl UNKNOWN IMPORTED) - set_target_properties(CURL::libcurl PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") - - if(EXISTS "${CURL_LIBRARY}") - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION "${CURL_LIBRARY}") - endif() - if(CURL_LIBRARY_RELEASE) - set_property(TARGET CURL::libcurl APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION_RELEASE "${CURL_LIBRARY_RELEASE}") - endif() - if(CURL_LIBRARY_DEBUG) - set_property(TARGET CURL::libcurl APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(CURL::libcurl PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" - IMPORTED_LOCATION_DEBUG "${CURL_LIBRARY_DEBUG}") - endif() - endif() -endif() - -mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR) - -# Report the results. -if (NOT CURL_FOUND) - set (CURL_DIR_MESSAGE - "CURL was not found. Make sure CURL_LIBRARY and CURL_INCLUDE_DIR are set or set the CURL_INSTALL environment variable." - ) - if (NOT CURL_FIND_QUIETLY) - message (STATUS "${CURL_DIR_MESSAGE}") - else () - if (CURL_FIND_REQUIRED) - message (FATAL_ERROR "CURL was NOT found and is Required by this project") - endif () - endif () -endif () -- cgit v0.12 From 3e816bd089f1eabc6e6cc68ec5b48f965d9a1129 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 15:49:57 -0500 Subject: Add statement for label if code unimplemented --- java/src/jni/h5pFAPLImp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index f737319..006707a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -536,6 +536,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs #endif /* H5_HAVE_LIBHDFS */ done: + /* NOP */; #ifdef H5_HAVE_LIBHDFS if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); @@ -942,6 +943,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 #endif /* H5_HAVE_ROS3_VFD */ done: + /* NOP */; #ifdef H5_HAVE_ROS3_VFD if (str) UNPIN_JAVA_STRING(ENVONLY, j_str, str); -- cgit v0.12 From bad125a071d6bb2b4ed958ebcdbd04d14f23bd1e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 16:54:24 -0500 Subject: Add policy to use _ROOT --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9a759f..38ec775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required (VERSION 3.10) project (HDF5 C) +if(POLICY CMP0074) + cmake_policy(SET CMP0074 NEW) +endif() + #----------------------------------------------------------------------------- # Instructions for use : Normal Build # -- cgit v0.12 From 677f8e6f31d756efb5f5259c6aea79d766d60639 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 5 Sep 2019 17:25:27 -0500 Subject: Add include dirs and default lib for windows --- config/cmake/ConfigureChecks.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8230df8..ae76d1e 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -163,11 +163,15 @@ option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if(CMAKE_VERSION VERSION_LESS "3.13.0" AND WIN32) MESSAGE(FATAL_ERROR "Windows builds for this option requires a minimum of CMake 3.13") endif () + if (WIN32) + set (CURL_LIBRARY "-lcurl") + endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) if (${CURL_FOUND} AND ${OPENSSL_FOUND}) set (${HDF_PREFIX}_HAVE_ROS3_VFD 1) list (APPEND LINK_LIBS ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) + INCLUDE_DIRECTORIES (${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS}) else () message (STATUS "The Read-Only S3 VFD was requested but cannot be built.\nPlease check that openssl and cURL are available on your\nsystem, and/or re-configure without option HDF5_ENABLE_ROS3_VFD.") endif () -- cgit v0.12 From acdeee8c6ac287618807cd22702d3cba1a1cd1ee Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 10:17:28 -0500 Subject: Windows ssl headers are not in system loacation --- src/H5FDs3comms.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 94fae7e..51d9b55 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /***************************************************************************** - * Read-Only S3 Virtual File Driver (VFD) + * Read-Only S3 Virtual File Driver (VFD) * * This is the header for the S3 Communications module * @@ -57,10 +57,10 @@ #ifdef H5_HAVE_ROS3_VFD /* Necessary S3 headers */ -#include -#include -#include -#include +#include "curl/curl.h" +#include "openssl/evp.h" +#include "openssl/hmac.h" +#include "openssl/sha.h" /***************** * PUBLIC MACROS * -- cgit v0.12 From 0d964c2f88047ae56b61d72485f3f01b45071294 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 11:01:25 -0500 Subject: revert windows change --- src/H5FDs3comms.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5FDs3comms.h b/src/H5FDs3comms.h index 51d9b55..90c6650 100644 --- a/src/H5FDs3comms.h +++ b/src/H5FDs3comms.h @@ -57,10 +57,10 @@ #ifdef H5_HAVE_ROS3_VFD /* Necessary S3 headers */ -#include "curl/curl.h" -#include "openssl/evp.h" -#include "openssl/hmac.h" -#include "openssl/sha.h" +#include +#include +#include +#include /***************** * PUBLIC MACROS * -- cgit v0.12 From 6eb6e0db8da2684ac702bebbe9d75c6c4900628a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 6 Sep 2019 15:24:52 -0500 Subject: Correct Windows check --- config/cmake/ConfigureChecks.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index ae76d1e..7d0f429 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -163,15 +163,12 @@ option (HDF5_ENABLE_ROS3_VFD "Build the ROS3 Virtual File Driver" OFF) if(CMAKE_VERSION VERSION_LESS "3.13.0" AND WIN32) MESSAGE(FATAL_ERROR "Windows builds for this option requires a minimum of CMake 3.13") endif () - if (WIN32) - set (CURL_LIBRARY "-lcurl") - endif () find_package(CURL REQUIRED) find_package(OpenSSL REQUIRED) if (${CURL_FOUND} AND ${OPENSSL_FOUND}) set (${HDF_PREFIX}_HAVE_ROS3_VFD 1) list (APPEND LINK_LIBS ${CURL_LIBRARIES} ${OPENSSL_LIBRARIES}) - INCLUDE_DIRECTORIES (${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS}) + INCLUDE_DIRECTORIES (${CURL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR}) else () message (STATUS "The Read-Only S3 VFD was requested but cannot be built.\nPlease check that openssl and cURL are available on your\nsystem, and/or re-configure without option HDF5_ENABLE_ROS3_VFD.") endif () -- cgit v0.12 From 78fda912952d977ec6b157d344834112c363dd26 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 6 Sep 2019 18:06:26 -0700 Subject: Fixed some exit calls. --- test/bittests.c | 14 +++++----- test/del_many_dense_attrs.c | 2 +- test/dsets.c | 7 +++-- test/extend.c | 22 +++++----------- test/filenotclosed.c | 2 +- test/filter_fail.c | 12 ++++----- test/gen_cross.c | 59 +++++++++++++++++++++--------------------- test/hyperslab.c | 12 ++++----- test/istore.c | 17 ++++-------- test/links.c | 7 +++-- test/links_env.c | 12 ++++----- test/objcopy.c | 10 +++---- test/swmr_addrem_writer.c | 10 +++---- test/swmr_generator.c | 4 +-- test/swmr_reader.c | 12 ++++----- test/swmr_remove_reader.c | 10 +++---- test/swmr_remove_writer.c | 10 +++---- test/swmr_sparse_reader.c | 10 +++---- test/swmr_sparse_writer.c | 10 +++---- test/swmr_start_write.c | 16 ++++++------ test/swmr_writer.c | 12 ++++----- test/testframe.c | 2 +- test/twriteorder.c | 6 ++--- test/unlink.c | 16 +++++------- test/use_append_chunk.c | 4 +-- test/use_append_mchunks.c | 4 +-- test/use_common.c | 2 +- test/use_disable_mdc_flushes.c | 4 +-- 28 files changed, 140 insertions(+), 168 deletions(-) diff --git a/test/bittests.c b/test/bittests.c index e29c188..046528a 100644 --- a/test/bittests.c +++ b/test/bittests.c @@ -895,13 +895,11 @@ test_clear (void) /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: * - * Return: Success: - * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, June 16, 1998 @@ -911,7 +909,7 @@ test_clear (void) int main(void) { - int nerrors = 0; + int nerrors = 0; /* * Open the library explicitly. @@ -930,12 +928,12 @@ main(void) if(nerrors) { HDprintf("***** %u FAILURE%s! *****\n", nerrors, 1 == nerrors ? "" : "S"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } HDprintf("All bit tests passed.\n"); H5close(); - return 0; -} + HDexit(EXIT_SUCCESS); +} /* end main() */ diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c index d88045c..ada7a6f 100644 --- a/test/del_many_dense_attrs.c +++ b/test/del_many_dense_attrs.c @@ -41,7 +41,7 @@ const char *FILENAME[] = { */ static void catch_signal(int H5_ATTR_UNUSED signo) { - HDexit(1); + HDexit(EXIT_FAILURE); } /* catch_signal() */ diff --git a/test/dsets.c b/test/dsets.c index 50a6907..649e001 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -13167,8 +13167,7 @@ error: * * Purpose: Tests the dataset interface (H5D) * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, December 9, 1997 @@ -13388,12 +13387,12 @@ main(void) #endif /* H5_HAVE_FILTER_SZIP */ h5_cleanup(FILENAME, fapl); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); error: nerrors = MAX(1, nerrors); HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return EXIT_FAILURE; + HDexit(EXIT_FAILURE); } /* end main() */ diff --git a/test/extend.c b/test/extend.c index f8c091b..a31ac0e 100644 --- a/test/extend.c +++ b/test/extend.c @@ -219,23 +219,15 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests extendible datasets + * Purpose: Tests extendible datasets * - * Return: Success: exit(0) - * - * Failure: exit(non-zero) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Friday, January 30, 1998 * - * Modifications: - * Took main data code out into write_data() routine, to allow - * different dataset creation property list settings to be tested. - * Quincey Koziol - * Tuesday, June 10, 2003 - * *------------------------------------------------------------------------- */ int @@ -290,16 +282,16 @@ main (void) if(nerrors) { HDprintf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* end if */ HDprintf("All extend tests passed.\n"); h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: HDprintf("*** One or more extend tests failed ***\n"); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 2c5c8dc..2d050eb 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -35,7 +35,7 @@ */ static void catch_signal(int H5_ATTR_UNUSED signo) { - HDexit(1); + HDexit(EXIT_FAILURE); } /* catch_signal() */ diff --git a/test/filter_fail.c b/test/filter_fail.c index 2acce01..4be2547 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -347,17 +347,15 @@ error: * Purpose: Tests the library's behavior when a mandate filter returns * failure. * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Raymond Lu * 25 August 2010 * - * Modifications: - * *------------------------------------------------------------------------- */ -int main(void) +int +main(void) { hid_t fapl; int mdc_nelmts = 0; @@ -398,7 +396,7 @@ int main(void) if (nerrors) TEST_ERROR - return 0; + HDexit(EXIT_SUCCESS); error: if (nerrors) { @@ -406,4 +404,4 @@ error: nerrors, 1==nerrors?"":"S"); HDexit(EXIT_FAILURE); } -} +} /* end main() */ diff --git a/test/gen_cross.c b/test/gen_cross.c index f7a1938..105895d 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -1255,13 +1255,11 @@ error: /*------------------------------------------------------------------------- * Function: main * - * Purpose: Create a file for cross_read.c test. + * Purpose: Create a file for cross_read.c test * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Raymond Lu - * Some time ago * *------------------------------------------------------------------------- */ @@ -1279,9 +1277,8 @@ main (void) * default file creation properties, and default file * access properties. */ - if((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - {H5_FAILED(); AT(); return 1;} + if((file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; /* * Describe the size of the array and create the data space for fixed @@ -1291,82 +1288,84 @@ main (void) dimsf[0] = NX + 1; dimsf[1] = NY; if((filespace = H5Screate_simple(RANK, dimsf, NULL)) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; dimsf[0] = NX; - if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL) - < 0) - {H5_FAILED(); AT(); return 1;} + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, NULL, dimsf, NULL) < 0) + TEST_ERROR; /* Create memory space. This does not include the extra row for fill * values. */ HDassert(dimsf[0] == NX); HDassert(dimsf[1] == NY); if((memspace = H5Screate_simple(RANK, dimsf, NULL)) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a regular dataset */ if(create_normal_dset(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of FLOAT with scale-offset filter */ if(create_scale_offset_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of DOUBLE with scale-offset filter */ if(create_scale_offset_dsets_double(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of CHAR with scale-offset filter */ if(create_scale_offset_dsets_char(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of SHORT with scale-offset filter */ if(create_scale_offset_dsets_short(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of INT with scale-offset filter */ if(create_scale_offset_dsets_int(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of LONG LONG with scale-offset filter */ if(create_scale_offset_dsets_long_long(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of FLOAT with fletcher filter */ if(create_fletcher_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of FLOAT with deflate filter */ if(create_deflate_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; #ifdef H5_HAVE_FILTER_SZIP /* Create a dataset of FLOAT with szip filter */ if(create_szip_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; #else /* H5_HAVE_FILTER_SZIP */ - puts("Szip filter is not enabled. Can't create the dataset."); + HDputs("Szip filter is not enabled. Can't create the dataset."); #endif /* H5_HAVE_FILTER_SZIP */ /* Create a dataset of FLOAT with shuffle filter */ if(create_shuffle_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* Create a dataset of FLOAT with nbit filter */ if(create_nbit_dsets_float(file, filespace, memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; /* * Close/release resources. */ if(H5Sclose(memspace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; if(H5Sclose(filespace) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; if(H5Fclose(file) < 0) - {H5_FAILED(); AT(); return 1;} + TEST_ERROR; - return 0; -} + HDexit(EXIT_SUCCESS); + +error: + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/hyperslab.c b/test/hyperslab.c index 3592ca0..8ed9c22 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -1176,13 +1176,11 @@ error: /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test various hyperslab operations. Give the words - * `small' and/or `medium' on the command line or only `small' - * is assumed. + * Purpose: Test various hyperslab operations. Give the words + * 'small' and/or 'medium' on the command line or only 'small' + * is assumed. * - * Return: Success: exit(EXIT_SUCCESS) - * - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Friday, October 10, 1997 @@ -1438,6 +1436,6 @@ main(int argc, char *argv[]) H5close(); #endif /* H5_HAVE_THREADSAFE */ - return 0; + HDexit(EXIT_SUCCESS); } diff --git a/test/istore.c b/test/istore.c index 8759be3..c8fe866 100644 --- a/test/istore.c +++ b/test/istore.c @@ -579,17 +579,13 @@ error: /*------------------------------------------------------------------------- * Function: main * - * Purpose: Tests indexed storage stuff. + * Purpose: Tests indexed storage * - * Return: Success: exit(EXIT_SUCCESS) - * - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Wednesday, October 15, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -618,9 +614,6 @@ main(int argc, char *argv[]) size_of_test |= TEST_LARGE; } else { HDprintf("unrecognized argument: %s\n", argv[i]); -#if 0 - exit(EXIT_FAILURE); -#endif } } } @@ -654,7 +647,7 @@ main(int argc, char *argv[]) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { HDprintf("Cannot create file %s; test aborted\n", filename); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* Initialize chunk dimensions */ @@ -722,13 +715,13 @@ main(int argc, char *argv[]) if (nerrors) { HDprintf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } HDprintf("All i-store tests passed.\n"); h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); } diff --git a/test/links.c b/test/links.c index cd44433..4eb4126 100644 --- a/test/links.c +++ b/test/links.c @@ -13907,8 +13907,7 @@ error: * * Purpose: Test links * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- */ int @@ -14137,10 +14136,10 @@ main(void) HDrmdir(TMPDIR); HDrmdir(TMPDIR2); - return SUCCEED; + HDexit(EXIT_SUCCESS); error: HDputs("*** TESTS FAILED ***"); - return 1; + HDexit(EXIT_FAILURE); } diff --git a/test/links_env.c b/test/links_env.c index dff185c..efb8cfd 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -134,10 +134,9 @@ external_link_env(hid_t fapl, hbool_t new_format) /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test external link with environment variable HDF5_EXT_PREFIX + * Purpose: Test external link with environment variable HDF5_EXT_PREFIX * - * Return: Success: exit(EXIT_SUCCESS) - * Failure: exit(EXIT_FAILURE) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Vailin Choi; Nov 2010 * @@ -175,9 +174,10 @@ main(void) /* clean up tmp_links_env directory created by external link tests */ HDrmdir(TMPDIR); - return 0; + HDexit(EXIT_SUCCESS); error: HDputs("*** TESTS FAILED ***"); - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ + diff --git a/test/objcopy.c b/test/objcopy.c index 5a5afc0..05ddfa4 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -14090,7 +14090,7 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: main * * Purpose: Test H5Ocopy() * @@ -14098,7 +14098,7 @@ error: * new or old format, messages can be shared in either, * both, or neither of the source and destination files. * - * Return: Non-negative on success/Negative on failure + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Peter Cao * Friday, September 30, 2005 @@ -14376,7 +14376,7 @@ main(void) if(nerrors) { HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n", nerrors, (1 == nerrors ? "" : "S")); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* end if */ HDputs ("All object copying tests passed."); @@ -14406,9 +14406,9 @@ main(void) h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - return 1; + HDexit(EXIT_FAILURE); } /* main */ diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c index 01e2ce1..df984b1 100644 --- a/test/swmr_addrem_writer.c +++ b/test/swmr_addrem_writer.c @@ -302,7 +302,7 @@ usage(void) HDprintf("Defaults to verbose (no '-q' given), flushing every 1000 operations\n"); HDprintf("('-f 1000'), and will generate a random seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -401,7 +401,7 @@ int main(int argc, const char *argv[]) /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose)) < 0) { HDfprintf(stderr, "Error opening skeleton file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -414,7 +414,7 @@ int main(int argc, const char *argv[]) /* Grow and shrink datasets */ if(addrem_records(fid, verbose, (unsigned long)nops, (unsigned long)flush_count) < 0) { HDfprintf(stderr, "Error adding and removing records from datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -424,7 +424,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -434,7 +434,7 @@ int main(int argc, const char *argv[]) /* Close objects opened */ if(H5Fclose(fid) < 0) { HDfprintf(stderr, "Error closing file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_generator.c b/test/swmr_generator.c index d986696..54a9900 100644 --- a/test/swmr_generator.c +++ b/test/swmr_generator.c @@ -283,7 +283,7 @@ usage(void) HDprintf("compression ('-c -1'), v1 b-tree indexing (-i b1), and will generate a random\n"); HDprintf("seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end usage() */ int main(int argc, const char *argv[]) @@ -377,7 +377,7 @@ int main(int argc, const char *argv[]) /* Generate file skeleton */ if(gen_skeleton(FILENAME, verbose, swmr_write, comp_level, index_type, random_seed) < 0) { HDfprintf(stderr, "Error generating skeleton file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_reader.c b/test/swmr_reader.c index c994a71..cb354a7 100644 --- a/test/swmr_reader.c +++ b/test/swmr_reader.c @@ -384,7 +384,7 @@ usage(void) HDprintf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); HDprintf("and will generate a random seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -485,7 +485,7 @@ int main(int argc, const char *argv[]) HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_reader.out.%u", random_seed); if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) { HDfprintf(stderr, "Can't open verbose output file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } } /* end if */ @@ -508,7 +508,7 @@ int main(int argc, const char *argv[]) /* Generate dataset names */ if(generate_symbols() < 0) { HDfprintf(stderr, "Error generating symbol names!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Create datatype for creating datasets */ @@ -518,7 +518,7 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { HDfprintf(stderr, "Error reading records from datasets (random_seed = %u)!\n", random_seed); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -528,7 +528,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -538,7 +538,7 @@ int main(int argc, const char *argv[]) /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { HDfprintf(stderr, "Error closing symbol datatype!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_remove_reader.c b/test/swmr_remove_reader.c index b4f0d5b..9ca6045 100644 --- a/test/swmr_remove_reader.c +++ b/test/swmr_remove_reader.c @@ -370,7 +370,7 @@ usage(void) HDprintf("5 common symbols to poll ('-h 5'), 10 random symbols to poll ('-l 10'),\n"); HDprintf("and will generate a random seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -480,7 +480,7 @@ int main(int argc, const char *argv[]) /* Generate dataset names */ if(generate_symbols() < 0) { HDfprintf(stderr, "Error generating symbol names!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Create datatype for creating datasets */ @@ -490,7 +490,7 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { HDfprintf(stderr, "Error reading records from datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -500,7 +500,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -510,7 +510,7 @@ int main(int argc, const char *argv[]) /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { HDfprintf(stderr, "Error closing symbol datatype!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c index c4f7b6e..e6d23de 100644 --- a/test/swmr_remove_writer.c +++ b/test/swmr_remove_writer.c @@ -236,7 +236,7 @@ usage(void) HDprintf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); HDprintf("flushing every 1000 shrinks ('-f 1000'), and will generate a random seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -339,7 +339,7 @@ int main(int argc, const char *argv[]) /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose, old)) < 0) { HDfprintf(stderr, "Error opening skeleton file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -352,7 +352,7 @@ int main(int argc, const char *argv[]) /* Remove records from datasets */ if(remove_records(fid, verbose, (unsigned long)nshrinks, (unsigned long)flush_count) < 0) { HDfprintf(stderr, "Error removing records from datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -362,7 +362,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -372,7 +372,7 @@ int main(int argc, const char *argv[]) /* Close objects opened */ if(H5Fclose(fid) < 0) { HDfprintf(stderr, "Error closing file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_sparse_reader.c b/test/swmr_sparse_reader.c index cd0ece6..6adc6c5 100644 --- a/test/swmr_sparse_reader.c +++ b/test/swmr_sparse_reader.c @@ -338,7 +338,7 @@ usage(void) HDprintf("Note that the # of records *must* be the same as that supplied to\n"); HDprintf("swmr_sparse_writer\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end usage() */ int main(int argc, const char *argv[]) @@ -410,7 +410,7 @@ int main(int argc, const char *argv[]) /* Generate dataset names */ if(generate_symbols() < 0) { HDfprintf(stderr, "Error generating symbol names!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Create datatype for creating datasets */ @@ -420,7 +420,7 @@ int main(int argc, const char *argv[]) /* Reading records from datasets */ if(read_records(FILENAME, verbose, (unsigned long) nrecords, (unsigned)poll_time, (unsigned)reopen_count) < 0) { HDfprintf(stderr, "Error reading records from datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -430,7 +430,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -440,7 +440,7 @@ int main(int argc, const char *argv[]) /* Close objects created */ if(H5Tclose(symbol_tid) < 0) { HDfprintf(stderr, "Error closing symbol datatype!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c index 17d8c61..5173c71 100644 --- a/test/swmr_sparse_writer.c +++ b/test/swmr_sparse_writer.c @@ -337,7 +337,7 @@ usage(void) HDprintf("Defaults to verbose (no '-q' given) and flushing every 1000 records\n"); HDprintf("('-f 1000')\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -412,7 +412,7 @@ int main(int argc, const char *argv[]) /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose)) < 0) { HDfprintf(stderr, "Error opening skeleton file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -425,7 +425,7 @@ int main(int argc, const char *argv[]) /* Append records to datasets */ if(add_records(fid, verbose, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { HDfprintf(stderr, "Error appending records to datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -435,7 +435,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -445,7 +445,7 @@ int main(int argc, const char *argv[]) /* Close objects opened */ if(H5Fclose(fid) < 0) { HDfprintf(stderr, "Error closing file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c index 0ee382d..c4222ad 100644 --- a/test/swmr_start_write.c +++ b/test/swmr_start_write.c @@ -357,7 +357,7 @@ usage(void) HDprintf("v1 b-tree indexing (-i b1), compression ('-c -1'),\n"); HDprintf("will generate a random seed (no -r given), and verbose (no '-q' given)\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* usage() */ /* @@ -468,7 +468,7 @@ int main(int argc, const char *argv[]) HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_writer.out.%u", random_seed); if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) { HDfprintf(stderr, "Can't open verbose output file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } } /* end if */ @@ -487,7 +487,7 @@ int main(int argc, const char *argv[]) /* Create the test file */ if((fid = create_file(FILENAME, verbose, verbose_file, random_seed)) < 0) { HDfprintf(stderr, "Error creating the file...\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* Emit informational message */ @@ -501,13 +501,13 @@ int main(int argc, const char *argv[]) /* Create the datasets in the file */ if(create_datasets(fid, comp_level, verbose, verbose_file, index_type) < 0) { HDfprintf(stderr, "Error creating datasets...\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* Enable SWMR writing mode */ if(H5Fstart_swmr_write(fid) < 0) { HDfprintf(stderr, "Error starting SWMR writing mode...\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -520,7 +520,7 @@ int main(int argc, const char *argv[]) /* Append records to datasets */ if(add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { HDfprintf(stderr, "Error appending records to datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -530,7 +530,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -540,7 +540,7 @@ int main(int argc, const char *argv[]) /* Close objects opened */ if(H5Fclose(fid) < 0) { HDfprintf(stderr, "Error closing file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/swmr_writer.c b/test/swmr_writer.c index 6df7355..4c3e64a 100644 --- a/test/swmr_writer.c +++ b/test/swmr_writer.c @@ -291,7 +291,7 @@ usage(void) HDprintf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n"); HDprintf("flushing every 10000 records ('-f 10000'), and will generate a random seed (no -r given).\n"); HDprintf("\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } int main(int argc, const char *argv[]) @@ -379,7 +379,7 @@ int main(int argc, const char *argv[]) HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_writer.out.%u", random_seed); if(NULL == (verbose_file = HDfopen(verbose_name, "w"))) { HDfprintf(stderr, "Can't open verbose output file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } } /* end if */ @@ -408,7 +408,7 @@ int main(int argc, const char *argv[]) /* Open file skeleton */ if((fid = open_skeleton(FILENAME, verbose, verbose_file, random_seed, old)) < 0) { HDfprintf(stderr, "Error opening skeleton file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ @@ -421,7 +421,7 @@ int main(int argc, const char *argv[]) /* Append records to datasets */ if(add_records(fid, verbose, verbose_file, (unsigned long)nrecords, (unsigned long)flush_count) < 0) { HDfprintf(stderr, "Error appending records to datasets!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -431,7 +431,7 @@ int main(int argc, const char *argv[]) /* Clean up the symbols */ if(shutdown_symbols() < 0) { HDfprintf(stderr, "Error releasing symbols!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ /* Emit informational message */ @@ -441,7 +441,7 @@ int main(int argc, const char *argv[]) /* Close objects opened */ if(H5Fclose(fid) < 0) { HDfprintf(stderr, "Error closing file!\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* end if */ return 0; diff --git a/test/testframe.c b/test/testframe.c index 68c66ec..3c2a335 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -90,7 +90,7 @@ AddTest(const char *TheName, void (*TheCall) (void), void (*Cleanup) (void), con /* Reallocate array */ if(NULL == (newTest = (TestStruct *)HDrealloc(Test, newAlloc * sizeof(TestStruct)))) { HDprintf("Out of memory for tests, Index = %u, TestAlloc = %u, newAlloc = %u\n", Index, TestAlloc, newAlloc); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } /* end if */ /* Update info */ diff --git a/test/twriteorder.c b/test/twriteorder.c index 60ee384..b104b72 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -134,7 +134,7 @@ parse_option(int argc, char * const argv[]) switch (c) { case 'h': usage(progname_g); - HDexit(0); + HDexit(EXIT_SUCCESS); break; case 'b': /* number of planes to write/read */ if ((blocksize_g = atoi(optarg)) <= 0) { @@ -407,12 +407,12 @@ main(int argc, char *argv[]) HDprintf("%d: launch reader process\n", mypid); if (read_wo_file() < 0) { HDfprintf(stderr, "read_wo_file encountered error\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } /* Reader is done. Clean up by removing the data file */ HDremove(DATAFILE); - HDexit(0); + HDexit(EXIT_SUCCESS); } } diff --git a/test/unlink.c b/test/unlink.c index f79aa29..6825dec 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2421,17 +2421,13 @@ error: /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test unlinking operations + * Purpose: Test unlinking operations * - * Return: Success: zero - * - * Failure: non-zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Friday, September 25, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -2551,16 +2547,16 @@ main(void) if (nerrors) { HDprintf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } HDputs("All unlink tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + HDexit(EXIT_SUCCESS); error: - return 1; -} + HDexit(EXIT_FAILURE); +} /* end main() */ diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c index 4e8c672..6b34f1e 100644 --- a/test/use_append_chunk.c +++ b/test/use_append_chunk.c @@ -174,9 +174,9 @@ main(int argc, char *argv[]) HDprintf("%d: launch reader process\n", mypid); if (read_uc_file(send_wait) < 0){ HDfprintf(stderr, "read_uc_file encountered error\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } - HDexit(0); + HDexit(EXIT_SUCCESS); } } diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 0414628..b7d45a4 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -167,9 +167,9 @@ main(int argc, char *argv[]) HDprintf("%d: launch reader process\n", mypid); if (read_uc_file(send_wait) < 0){ HDfprintf(stderr, "read_uc_file encountered error\n"); - HDexit(1); + HDexit(EXIT_FAILURE); } - HDexit(0); + HDexit(EXIT_SUCCESS); } } diff --git a/test/use_common.c b/test/use_common.c index b600dca..9effa06 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -63,7 +63,7 @@ parse_option(int argc, char * const argv[]) switch (c) { case 'h': usage(progname_g); - exit(0); + HDexit(EXIT_SUCCESS); break; case 'f': /* usecase data file name */ UC_opts.filename = optarg; diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index b349269..9cd202c 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -102,7 +102,7 @@ parse_option(int argc, char * const argv[]) switch (c) { case 'h': usage(progname_g); - exit(0); + HDexit(EXIT_SUCCESS); break; case 'f': /* usecase data file name */ filename_g = optarg; @@ -540,7 +540,7 @@ int main(void) { HDfprintf(stderr, "Non-POSIX platform. Skipping.\n"); - return EXIT_SUCCESS; + HDexit(EXIT_SUCCESS); } /* end main() */ #endif /* H5_HAVE_FORK */ -- cgit v0.12 From afb07f9b3932633686a262f0b91a00993acb112f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2019 13:47:24 -0500 Subject: Clear exception for getting JNI string to clear the exception --- java/src/jni/h5pFAPLImp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index 006707a..b7e351a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -467,7 +467,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); @@ -491,7 +491,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); @@ -509,7 +509,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); @@ -883,7 +883,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); @@ -901,7 +901,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); @@ -919,7 +919,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); -- cgit v0.12 From e20331651e34a043bd54826169b21e776bb09816 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 10 Sep 2019 14:19:29 -0500 Subject: revert as CHECK will first check for exception --- java/src/jni/h5pFAPLImp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c index b7e351a..006707a 100644 --- a/java/src/jni/h5pFAPLImp.c +++ b/java/src/jni/h5pFAPLImp.c @@ -467,7 +467,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config namenode_name not pinned"); @@ -491,7 +491,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config user_name not pinned"); @@ -509,7 +509,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5FDset_fapl_hdfs: fapl_config kerberos_ticket_cache not pinned"); @@ -883,7 +883,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config aws_region not pinned"); @@ -901,7 +901,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_id not pinned"); @@ -919,7 +919,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3 CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, fapl_config, fid))) - CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE); + CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); if (j_str) { PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_fapl_ros3: fapl_config secret_key not pinned"); -- cgit v0.12 From 24f863dfba86fa0ace926847f0dacce18635a73c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 11 Sep 2019 12:51:31 -0500 Subject: Allow tests to dump output if not comparing --- config/cmake_ext_mod/runTest.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index e601653..7a10df2 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -343,6 +343,14 @@ if (TEST_GREP_COMPARE) endif () endif () +# dump the output unless nodisplay option is set +if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + execute_process ( + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_FOLDER}/${TEST_OUTPUT} + RESULT_VARIABLE TEST_RESULT + ) +endif () + # everything went fine... message (STATUS "${TEST_PROGRAM} Passed") -- cgit v0.12 From e37b474374592d28352f354450efdbc1ff1836ba Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 11 Sep 2019 14:09:25 -0500 Subject: Use variable for test output --- config/cmake_ext_mod/runTest.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 7a10df2..6f633f3 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -345,8 +345,9 @@ endif () # dump the output unless nodisplay option is set if (TEST_SKIP_COMPARE AND NOT TEST_NO_DISPLAY) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) execute_process ( - COMMAND ${CMAKE_COMMAND} -E echo ${TEST_FOLDER}/${TEST_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E echo ${TEST_STREAM} RESULT_VARIABLE TEST_RESULT ) endif () -- cgit v0.12 From 50287cb9d245698a281102c79f76fa3fa9c38ed0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2019 14:22:43 -0500 Subject: Fix get home dir for windows --- src/H5FDs3comms.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index f8b4417..f08e9d5 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -114,7 +114,7 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); /* Functions */ /*************/ - + /*---------------------------------------------------------------------------- * * Function: curlwritecallback() @@ -162,7 +162,7 @@ curlwritecallback(char *ptr, } /* end curlwritecallback() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_node_set() @@ -589,7 +589,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_hrb_node_set() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_hrb_destroy() @@ -803,7 +803,7 @@ done: * S3R FUNCTIONS ****************************************************************************/ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_close() @@ -865,7 +865,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_close */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_get_filesize() @@ -900,7 +900,7 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_get_filesize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_getsize() @@ -1109,7 +1109,7 @@ done: } /* H5FD_s3comms_s3r_getsize */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_open() @@ -1362,7 +1362,7 @@ done: } /* H5FD_s3comms_s3r_open */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_s3r_read() @@ -1924,7 +1924,7 @@ done: * MISCELLANEOUS FUNCTIONS ****************************************************************************/ - + /*---------------------------------------------------------------------------- * * Function: gmnow() @@ -2136,7 +2136,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_aws_canonical_request() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_bytes_to_hex() @@ -2210,7 +2210,7 @@ done: } /* end H5FD_s3comms_bytes_to_hex() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_free_purl() @@ -2253,7 +2253,7 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_s3comms_free_purl() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_HMAC_SHA256() @@ -2330,7 +2330,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_HMAC_SHA256 */ - + /*----------------------------------------------------------------------------- * * Function: H5FD__s3comms_load_aws_creds_from_file() @@ -2505,7 +2505,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD__s3comms_load_aws_creds_from_file() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_load_aws_profile() @@ -2556,9 +2556,12 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, HDfprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); #endif - /* TODO: Windows and other path gotchas */ +#ifdef H5_HAVE_WIN32_API + ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE")) ; +#else ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")) ; - if (ret < 0 || (size_t)ret >= 117) { +#endif + if (ret < 0 || (size_t)ret >= 117) { HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") } @@ -2631,7 +2634,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_load_aws_profile() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_nlowercase() @@ -2689,7 +2692,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_nlowercase() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_parse_url() @@ -2953,7 +2956,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_parse_url() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_percent_encode_char() @@ -3127,7 +3130,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* H5FD_s3comms_percent_encode_char */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_signing_key() @@ -3258,7 +3261,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } /* end H5FD_s3comms_signing_key() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_tostringtosign() @@ -3385,7 +3388,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5ros3_tostringtosign() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_trim() @@ -3470,7 +3473,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_trim() */ - + /*---------------------------------------------------------------------------- * * Function: H5FD_s3comms_uriencode() -- cgit v0.12 From 05f49d5ffdbd4cf9e967d60a3a0efd0ca7f2c820 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 12 Sep 2019 15:13:42 -0500 Subject: HDFFV-10854 add release note for windows --- release_docs/RELEASE.txt | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 37dec3e..f26d969 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -191,6 +191,31 @@ New Features Library: -------- + - Add S3 and HDFS VFDs to HDF5 maintenance + + Fix windows requirements and java tests. Windows requires CMake 3.13. + Install openssl library (with dev files); + from "Shining Light Productions". msi package preferred. + + PATH should have been updated with the installation dir. + set ENV variable OPENSSL_ROOT_DIR to the installation dir. + set ENV variable OPENSSL_CONF to the cfg file, likely %OPENSSL_ROOT_DIR%\bin\openssl.cfg + Install libcurl library (with dev files); + download the latest released version using git: https://github.com/curl/curl.git + + Open a Visual Studio Command prompt + change to the libcurl root folder + run the "buildconf.bat" batch file + change to the winbuild directory + nmake /f Makefile.vc mode=dll MACHINE=x64 + copy libcurl-vc-x64-release-dll-ipv6-sspi-winssl dir to C:\curl (installation dir) + set ENV variable CURL_ROOT to C:\curl (installation dir) + update PATH ENV variable to %CURL_ROOT%\bin (installation bin dir). + the aws credentials file should be in %USERPROFILE%\.aws folder + set the ENV variable "HDF5_ROS3_TEST_BUCKET_URL=https://s3.us-east-2.amazonaws.com/hdf5ros3" + + (ADB - 2019/09/12, HDFFV-10854) + - Added new chunk query functions The following public functions were added to discover information about @@ -343,10 +368,10 @@ Bug Fixes since HDF5-1.10.3 release There was an assertion failure when moving meessages from running a user test program with library release hdf5.1.10.4. It was because the tag value (object header's address) was not set up when entering - the library routine H5O__chunk_update_idx(), which will eventually + the library routine H5O__chunk_update_idx(), which will eventually verifies the metadata tag value when protecting the object header. - The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() + The problem was fixed by replacing FUNC_ENTER_PACKAGE in H5O__chunk_update_idx() with FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) to set up the metadata tag. (VC - 2019/08/23, HDFFV-10873) @@ -363,7 +388,7 @@ Bug Fixes since HDF5-1.10.3 release to unsigned later on, the decimal part is chopped off causing the test failure. - This was fixed by obtaining the rounded integer value (HDceil) for the + This was fixed by obtaining the rounded integer value (HDceil) for the log10 value of read attempts first before casting the result to unsigned. (VC - 2019/8/14, HDFFV-10813) -- cgit v0.12 From b477f9bcc7bb83d7c06e1d09f428030f51d71897 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 13 Sep 2019 11:33:47 -0500 Subject: HDFFV-10901 add missing config options --- config/cmake/ConfigureChecks.cmake | 21 +- config/cmake/HDFCompilerFlags.cmake | 76 ++- config/cmake/libhdf5.settings.cmake.in | 8 +- java/test/TestH5Pfapl.java | 1 - src/CMakeLists.txt | 2 - src/H5make_libsettings.c | 13 +- tools/src/h5dump/h5dump.c | 12 +- tools/src/h5ls/h5ls.c | 1046 +++++++++++++------------------- 8 files changed, 533 insertions(+), 646 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 7d0f429..ab1fa89 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -33,7 +33,7 @@ MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) # conversions. If not, some hard conversions will still be prefered even # though the data may be wrong (for example, some compilers don't # support denormalized floating values) to maximize speed. -# +#----------------------------------------------------------------------------- option (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) if (HDF5_WANT_DATA_ACCURACY) set (${HDF_PREFIX}_WANT_DATA_ACCURACY 1) @@ -45,7 +45,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) # checked and data conversion exceptions are returned. This is mainly # for the speed optimization of hard conversions. Soft conversions can # actually benefit little. -# +#----------------------------------------------------------------------------- option (HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON) if (HDF5_WANT_DCONV_EXCEPTION) set (${HDF_PREFIX}_WANT_DCONV_EXCEPTION 1) @@ -54,7 +54,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) # ---------------------------------------------------------------------- # Check if they would like the function stack support compiled in -# +#----------------------------------------------------------------------------- option (HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF) if (HDF5_ENABLE_CODESTACK) set (${HDF_PREFIX}_HAVE_CODESTACK 1) @@ -75,7 +75,7 @@ set (${HDF_PREFIX}_HAVE_TMPFILE 1) # TODO -------------------------------------------------------------------------- # Should the Default Virtual File Driver be compiled? # This is hard-coded now but option should added to match configure -# +#----------------------------------------------------------------------------- set (${HDF_PREFIX}_DEFAULT_VFD H5FD_SEC2) if (NOT DEFINED "${HDF_PREFIX}_DEFAULT_PLUGINDIR") @@ -92,6 +92,7 @@ if (WINDOWS) # Set the flag to indicate that the machine has window style pathname, # that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). # (This flag should be _unset_ for all machines, except for Windows) + #----------------------------------------------------------------------- set (${HDF_PREFIX}_HAVE_WINDOW_PATH 1) endif () @@ -237,7 +238,7 @@ endmacro () # is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. # The machine's conversion gets the correct value. We define the macro and disable # this kind of test until we figure out what algorithm they use. -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm @@ -246,7 +247,7 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your syst # when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., # ..., 7fffff..., the compiler uses a unknown algorithm. We define a # macro and skip the test for now until we know about the algorithm. -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert @@ -256,7 +257,7 @@ H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your syste # start to go wrong on these two machines. Adjusting it higher to # 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted # values wildly wrong. This test detects this wrong behavior and disable the test. -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert @@ -264,14 +265,14 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctl # all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., # 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice # as big as they should be. -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can accurately convert # some long double values -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values") # ---------------------------------------------------------------------- # Check if pointer alignments are enforced -# +#----------------------------------------------------------------------------- H5ConversionTests (${HDF_PREFIX}_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index aea417a..37ddcbb 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -212,7 +212,8 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias=2 -Wmissing-profile") endif () - +elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=inform") endif () #----------------------------------------------------------------------------- @@ -339,3 +340,76 @@ endif () if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") endif () + +#----------------------------------------------------------------------------- +# Option for --enable-asserts +# By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) +if (HDF5_ENABLE_ASSERTS) + add_compile_options ("-UNDEBUG") +else () + add_compile_options ("-DNDEBUG") +endif () +MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) + +#----------------------------------------------------------------------------- +# Option for --enable-symbols +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) +if (HDF5_ENABLE_SYMBOLS) + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fno-omit-frame-pointer") + endif () + if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + endif () + endif () +else () + if (CMAKE_C_COMPILER_ID STREQUAL "Intel") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") + elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s") + endif () + if(CMAKE_CXX_COMPILER_LOADED) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s") + endif () + endif () +endif () +MARK_AS_ADVANCED (HDF5_ENABLE_SYMBOLS) + +#----------------------------------------------------------------------------- +# Option for --enable-profiling +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_PROFILING "Enable profiling flags independently from the build mode." OFF) +if (HDF5_ENABLE_PROFILING) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PROFILE_CFLAGS}") + if(CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PROFILE_CXXFLAGS}") + endif () +endif () +MARK_AS_ADVANCED (HDF5_ENABLE_PROFILING) + +#----------------------------------------------------------------------------- +# Option for --enable-optimization +# This option will force/override the default setting for all configurations +#----------------------------------------------------------------------------- +option (HDF5_ENABLE_OPTIMIZATION "Enable optimization flags/settings independently from the build mode" OFF) +if (HDF5_ENABLE_OPTIMIZATION) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTIMIZE_CFLAGS}") + if(CMAKE_CXX_COMPILER_LOADED) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTIMIZE_CXXFLAGS}") + endif () +endif () +MARK_AS_ADVANCED (HDF5_ENABLE_OPTIMIZATION) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 3451545..8397d68 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -14,10 +14,10 @@ General Information: Compiling Options: ------------------ Build Mode: @CMAKE_BUILD_TYPE@ - Debugging Symbols: @SYMBOLS@ - Asserts: @ASSERTS@ - Profiling: @PROFILING@ - Optimization Level: @OPTIMIZATION@ + Debugging Symbols: @HDF5_ENABLE_SYMBOLS@ + Asserts: @HDF5_ENABLE_ASSERTS@ + Profiling: @HDF5_ENABLE_PROFILING@ + Optimization Level: @HDF5_ENABLE_OPTIMIZATION@ Linking Options: ---------------- diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index 7d690cf..10a79dd 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -15,7 +15,6 @@ package test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 97ae847..6df8af3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1135,7 +1135,6 @@ if (NOT ONLY_SHARED_LIBS) PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS} - $,DEBUG,NDEBUG> PRIVATE $<$:H5_DEBUG_API> # Enable tracing of the API $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> @@ -1173,7 +1172,6 @@ if (BUILD_SHARED_LIBS) "H5_BUILT_AS_DYNAMIC_LIB" ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS} - $,DEBUG,NDEBUG> PRIVATE $<$:H5_HAVE_THREADSAFE> $<$:H5_DEBUG_API> # Enable tracing of the API diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c index da7c8d9..fd67184 100644 --- a/src/H5make_libsettings.c +++ b/src/H5make_libsettings.c @@ -35,12 +35,15 @@ static const char *FileHeader = "\n\ #include #include #include "H5private.h" +/* Do NOT use HDfprintf in this file as it is not linked with the library, + * which contains the H5system.c file in which the function is defined. + */ #define LIBSETTINGSFNAME "libhdf5.settings" FILE *rawoutstream = NULL; - + /*------------------------------------------------------------------------- * Function: insert_libhdf5_settings * @@ -105,7 +108,7 @@ insert_libhdf5_settings(FILE *flibinfo) #endif } /* insert_libhdf5_settings() */ - + /*------------------------------------------------------------------------- * Function: make_libinfo * @@ -123,7 +126,7 @@ make_libinfo(void) insert_libhdf5_settings(rawoutstream); } - + /*------------------------------------------------------------------------- * Function: print_header * @@ -229,7 +232,7 @@ information about the library build configuration\n"; fprintf(rawoutstream, "\n */\n\n"); } - + /*------------------------------------------------------------------------- * Function: print_footer * @@ -244,7 +247,7 @@ print_footer(void) /* nothing */ } - + /*------------------------------------------------------------------------- * Function: main * diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index 5df701a..b1e736a 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1639,14 +1639,10 @@ main(int argc, const char *argv[]) if (fapl_id != H5P_DEFAULT) { fid = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); - } else { - fid = h5tools_fopen( - fname, - H5F_ACC_RDONLY, - H5P_DEFAULT, - driver, - NULL, - 0); + } + else { + fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, + driver, NULL, 0); } if (fid < 0) { diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 7e2a431..20a68e8 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -165,12 +165,6 @@ static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter); * Purpose: Prints a usage message on stderr and then returns. * * Return: void - * - * Programmer: Robb Matzke - * Thursday, July 16, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -251,16 +245,9 @@ usage (void) * Function: print_string * * Purpose: Print a string value by escaping unusual characters. If - * STREAM is null then we only count how large the output would - * be. + * STREAM is null then we only count how large the output would be. * * Return: Number of characters printed. - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -271,27 +258,33 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) for (/*void*/; s && *s; s++) { switch (*s) { case '"': - if (buffer) h5tools_str_append(buffer, "\\\""); + if (buffer) + h5tools_str_append(buffer, "\\\""); nprint += 2; break; case '\\': - if (buffer) h5tools_str_append(buffer, "\\\\"); + if (buffer) + h5tools_str_append(buffer, "\\\\"); nprint += 2; break; case '\b': - if (buffer) h5tools_str_append(buffer, "\\b"); + if (buffer) + h5tools_str_append(buffer, "\\b"); nprint += 2; break; case '\f': - if (buffer) h5tools_str_append(buffer, "\\f"); + if (buffer) + h5tools_str_append(buffer, "\\f"); nprint += 2; break; case '\n': - if (buffer) h5tools_str_append(buffer, "\\n"); + if (buffer) + h5tools_str_append(buffer, "\\n"); nprint += 2; break; case '\r': - if (buffer) h5tools_str_append(buffer, "\\r"); + if (buffer) + h5tools_str_append(buffer, "\\r"); nprint += 2; break; case '\t': @@ -300,21 +293,25 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) break; case ' ': if (escape_spaces) { - if (buffer) h5tools_str_append(buffer, "\\ "); + if (buffer) + h5tools_str_append(buffer, "\\ "); nprint += 2; } else { - if (buffer) h5tools_str_append(buffer, " "); + if (buffer) + h5tools_str_append(buffer, " "); nprint++; } break; default: if (isprint((int)*s)) { - if (buffer) h5tools_str_append(buffer, "%c", *s); + if (buffer) + h5tools_str_append(buffer, "%c", *s); nprint++; } else { - if (buffer) h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); + if (buffer) + h5tools_str_append(buffer, "\\%03o", *((const unsigned char*)s)); nprint += 4; } break; @@ -330,14 +327,7 @@ print_string(h5tools_str_t *buffer, const char *s, hbool_t escape_spaces) * Purpose: Print an object name and another string. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Quincey Koziol - * Tuesday, November 6, 2007 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static int @@ -348,19 +338,19 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, const char *name = fullname; /* Pointer to buffer for printing */ int n; - if(show_file_name_g) + if (show_file_name_g) HDsnprintf(fullname, sizeof(fullname), "%s/%s", iter->fname, oname + iter->name_start); else name = oname + iter->name_start; /* Print the object name, either full name or base name */ - if(fullname_g) + if (fullname_g) n = print_string(buffer, name, TRUE); else { const char *last_sep; /* The location of the last group separator */ /* Find the last component of the path name */ - if(NULL == (last_sep = HDstrrchr(name, '/'))) + if (NULL == (last_sep = HDstrrchr(name, '/'))) last_sep = name; else { last_sep++; @@ -379,116 +369,151 @@ print_obj_name(h5tools_str_t *buffer, const iter_t *iter, const char *oname, * Purpose: Prints the name of a native C data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed. - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-11 - * Added the C9x types, but we still prefer to display the types - * from the C language itself (like `int' vs. `int32_t'). - * + * Failure: FALSE, nothing printed. *------------------------------------------------------------------------- */ static hbool_t print_native_type(h5tools_str_t *buffer, hid_t type, int ind) { - if(!simple_output_g) { - if (H5Tequal(type, H5T_NATIVE_SCHAR)==TRUE) { + if (!simple_output_g) { + if (H5Tequal(type, H5T_NATIVE_SCHAR) == TRUE) { h5tools_str_append(buffer, "native signed char"); - } else if (H5Tequal(type, H5T_NATIVE_UCHAR)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UCHAR) == TRUE) { h5tools_str_append(buffer, "native unsigned char"); - } else if (H5Tequal(type, H5T_NATIVE_INT)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT) == TRUE) { h5tools_str_append(buffer, "native int"); - } else if (H5Tequal(type, H5T_NATIVE_UINT)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT) == TRUE) { h5tools_str_append(buffer, "native unsigned int"); - } else if (H5Tequal(type, H5T_NATIVE_SHORT)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_SHORT) == TRUE) { h5tools_str_append(buffer, "native short"); - } else if (H5Tequal(type, H5T_NATIVE_USHORT)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_USHORT) == TRUE) { h5tools_str_append(buffer, "native unsigned short"); - } else if (H5Tequal(type, H5T_NATIVE_LONG)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_LONG) == TRUE) { h5tools_str_append(buffer, "native long"); - } else if (H5Tequal(type, H5T_NATIVE_ULONG)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_ULONG) == TRUE) { h5tools_str_append(buffer, "native unsigned long"); - } else if (H5Tequal(type, H5T_NATIVE_LLONG)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_LLONG) == TRUE) { h5tools_str_append(buffer, "native long long"); - } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_ULLONG) == TRUE) { h5tools_str_append(buffer, "native unsigned long long"); - } else if (H5Tequal(type, H5T_NATIVE_FLOAT)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_FLOAT) == TRUE) { h5tools_str_append(buffer, "native float"); - } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_DOUBLE) == TRUE) { h5tools_str_append(buffer, "native double"); + } #if H5_SIZEOF_LONG_DOUBLE !=0 - } else if (H5Tequal(type, H5T_NATIVE_LDOUBLE)==TRUE) { + else if (H5Tequal(type, H5T_NATIVE_LDOUBLE) == TRUE) { h5tools_str_append(buffer, "native long double"); + } #endif - } else if (H5Tequal(type, H5T_NATIVE_INT8)==TRUE) { + else if (H5Tequal(type, H5T_NATIVE_INT8) == TRUE) { h5tools_str_append(buffer, "native int8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT8) == TRUE) { h5tools_str_append(buffer, "native uint8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT16) == TRUE) { h5tools_str_append(buffer, "native int16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT16) == TRUE) { h5tools_str_append(buffer, "native uint16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT32) == TRUE) { h5tools_str_append(buffer, "native int32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT32) == TRUE) { h5tools_str_append(buffer, "native uint32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT64) == TRUE) { h5tools_str_append(buffer, "native int64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT64) == TRUE) { h5tools_str_append(buffer, "native uint64_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_LEAST8) == TRUE) { h5tools_str_append(buffer, "native int_least8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST8) == TRUE) { h5tools_str_append(buffer, "native uint_least8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_LEAST16) == TRUE) { h5tools_str_append(buffer, "native int_least16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST16) == TRUE) { h5tools_str_append(buffer, "native uint_least16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_LEAST32) == TRUE) { h5tools_str_append(buffer, "native int_least32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST32) == TRUE) { h5tools_str_append(buffer, "native uint_least32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_LEAST64) == TRUE) { h5tools_str_append(buffer, "native int_least64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_LEAST64) == TRUE) { h5tools_str_append(buffer, "native uint_least64_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_FAST8) == TRUE) { h5tools_str_append(buffer, "native int_fast8_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_FAST8) == TRUE) { h5tools_str_append(buffer, "native uint_fast8_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_FAST16) == TRUE) { h5tools_str_append(buffer, "native int_fast16_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_FAST16) == TRUE) { h5tools_str_append(buffer, "native uint_fast16_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_FAST32) == TRUE) { h5tools_str_append(buffer, "native int_fast32_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_FAST32) == TRUE) { h5tools_str_append(buffer, "native uint_fast32_t"); - } else if (H5Tequal(type, H5T_NATIVE_INT_FAST64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_INT_FAST64) == TRUE) { h5tools_str_append(buffer, "native int_fast64_t"); - } else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_UINT_FAST64) == TRUE) { h5tools_str_append(buffer, "native uint_fast64_t"); - } else if (H5Tequal(type, H5T_NATIVE_B8)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_B8) == TRUE) { h5tools_str_append(buffer, "native 8-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B16)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_B16) == TRUE) { h5tools_str_append(buffer, "native 16-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B32)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_B32) == TRUE) { h5tools_str_append(buffer, "native 32-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_B64)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_B64) == TRUE) { h5tools_str_append(buffer, "native 64-bit field"); - } else if (H5Tequal(type, H5T_NATIVE_HSIZE)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_HSIZE) == TRUE) { h5tools_str_append(buffer, "native hsize_t"); - } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_HSSIZE) == TRUE) { h5tools_str_append(buffer, "native hssize_t"); - } else if (H5Tequal(type, H5T_NATIVE_HERR)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_HERR) == TRUE) { h5tools_str_append(buffer, "native herr_t"); - } else if (H5Tequal(type, H5T_NATIVE_HBOOL)==TRUE) { + } + else if (H5Tequal(type, H5T_NATIVE_HBOOL) == TRUE) { h5tools_str_append(buffer, "native hbool_t"); - } else { + } + else { return print_int_type(buffer, type, ind); } } else { @@ -504,29 +529,22 @@ print_native_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Print the name of an IEEE floating-point data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind) { - if (H5Tequal(type, H5T_IEEE_F32BE)==TRUE) { + if (H5Tequal(type, H5T_IEEE_F32BE) == TRUE) { h5tools_str_append(buffer, "IEEE 32-bit big-endian float"); } - else if (H5Tequal(type, H5T_IEEE_F32LE)==TRUE) { + else if (H5Tequal(type, H5T_IEEE_F32LE) == TRUE) { h5tools_str_append(buffer, "IEEE 32-bit little-endian float"); } - else if (H5Tequal(type, H5T_IEEE_F64BE)==TRUE) { + else if (H5Tequal(type, H5T_IEEE_F64BE) == TRUE) { h5tools_str_append(buffer, "IEEE 64-bit big-endian float"); } - else if (H5Tequal(type, H5T_IEEE_F64LE)==TRUE) { + else if (H5Tequal(type, H5T_IEEE_F64LE) == TRUE) { h5tools_str_append(buffer, "IEEE 64-bit little-endian float"); } else { @@ -540,16 +558,10 @@ print_ieee_type(h5tools_str_t *buffer, hid_t type, int ind) * Function: print_precision * * Purpose: Prints information on the next line about precision and - * padding if the precision is less than the total data type - * size. + * padding if the precision is less than the total data type + * size. * * Return: void - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -564,13 +576,12 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) /* If the precision is less than the total size then show the precision * and offset on the following line. Also display the padding * information. */ - if(8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) { + if (8 * H5Tget_size(type) != (prec = H5Tget_precision(type))) { h5tools_str_append(buffer, "\n%*s(%lu bit%s of precision beginning at bit %lu)", - ind, "", (unsigned long)prec, 1 == prec ? "" : "s", - (unsigned long)H5Tget_offset(type)); + ind, "", (unsigned long)prec, 1 == prec ? "" : "s", (unsigned long)H5Tget_offset(type)); H5Tget_pad(type, &plsb, &pmsb); - if(H5Tget_offset(type) > 0) { + if (H5Tget_offset(type) > 0) { switch(plsb) { case H5T_PAD_ZERO: plsb_s = "zero"; @@ -589,7 +600,7 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) break; } } - if((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) { + if ((unsigned)H5Tget_offset(type) + prec < 8 * H5Tget_size(type)) { switch(pmsb) { case H5T_PAD_ZERO: pmsb_s = "zero"; @@ -612,15 +623,13 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) h5tools_str_append(buffer, "\n%*s(", ind, ""); if (plsb_s) { nbits = (unsigned)H5Tget_offset(type); - h5tools_str_append(buffer, "%lu %s bit%s at bit 0", - (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s"); + h5tools_str_append(buffer, "%lu %s bit%s at bit 0", (unsigned long)nbits, plsb_s, 1 == nbits ? "" : "s"); } - if (plsb_s && pmsb_s) h5tools_str_append(buffer, ", "); + if (plsb_s && pmsb_s) + h5tools_str_append(buffer, ", "); if (pmsb_s) { nbits = (8 * H5Tget_size(type)) - ((unsigned)H5Tget_offset(type) + prec); - h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", - (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s", - (unsigned long)(8 * H5Tget_size(type) - nbits)); + h5tools_str_append(buffer, "%lu %s bit%s at bit %lu", (unsigned long)nbits, pmsb_s, 1 == nbits ? "" : "s", (unsigned long)(8 * H5Tget_size(type) - nbits)); } h5tools_str_append(buffer, ")"); } @@ -632,41 +641,35 @@ print_precision(h5tools_str_t *buffer, hid_t type, int ind) * Function: print_int_type * * Purpose: Print the name of an integer data type. Common information - * like number of bits, byte order, and sign scheme appear on - * the first line. Additional information might appear in - * parentheses on the following lines. + * like number of bits, byte order, and sign scheme appear on + * the first line. Additional information might appear in + * parentheses on the following lines. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t print_int_type(h5tools_str_t *buffer, hid_t type, int ind) { - H5T_order_t order; /* byte order value */ - const char *order_s=NULL; /* byte order string */ - H5T_sign_t sign; /* sign scheme value */ - const char *sign_s=NULL; /* sign scheme string */ + H5T_order_t order; /* byte order value */ + const char *order_s = NULL; /* byte order string */ + H5T_sign_t sign; /* sign scheme value */ + const char *sign_s = NULL; /* sign scheme string */ - if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; + if (H5T_INTEGER != H5Tget_class(type)) + return FALSE; /* Byte order */ - if (H5Tget_size(type)>1) { + if (H5Tget_size(type) > 1) { order = H5Tget_order(type); - if (H5T_ORDER_LE==order) { + if (H5T_ORDER_LE == order) { order_s = " little-endian"; } - else if (H5T_ORDER_BE==order) { + else if (H5T_ORDER_BE == order) { order_s = " big-endian"; } - else if (H5T_ORDER_VAX==order) { + else if (H5T_ORDER_VAX == order) { order_s = " mixed-endian"; } else { @@ -678,11 +681,11 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) } /* Sign */ - if ((sign=H5Tget_sign(type))>=0) { - if (H5T_SGN_NONE==sign) { + if ((sign = H5Tget_sign(type)) >= 0) { + if (H5T_SGN_NONE == sign) { sign_s = " unsigned"; } - else if (H5T_SGN_2==sign) { + else if (H5T_SGN_2 == sign) { sign_s = ""; } else { @@ -695,8 +698,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) /* Print size, order, and sign on first line, precision and padding * information on the subsequent lines */ - h5tools_str_append(buffer, "%lu-bit%s%s integer", - (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); + h5tools_str_append(buffer, "%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); print_precision(buffer, type, ind); return TRUE; } @@ -708,14 +710,7 @@ print_int_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Print info about a floating point data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -732,18 +727,19 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) H5T_pad_t pad; /* internal padding value */ const char *pad_s=NULL; /* internal padding string */ - if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; + if (H5T_FLOAT != H5Tget_class(type)) + return FALSE; /* Byte order */ - if (H5Tget_size(type)>1) { + if (H5Tget_size(type) > 1) { order = H5Tget_order(type); - if (H5T_ORDER_LE==order) { + if (H5T_ORDER_LE == order) { order_s = " little-endian"; } - else if (H5T_ORDER_BE==order) { + else if (H5T_ORDER_BE == order) { order_s = " big-endian"; } - else if (H5T_ORDER_VAX==order) { + else if (H5T_ORDER_VAX == order) { order_s = " mixed-endian"; } else { @@ -756,8 +752,7 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) /* Print size and byte order on first line, precision and padding on * subsequent lines. */ - h5tools_str_append(buffer, "%lu-bit%s floating-point", - (unsigned long)(8*H5Tget_size(type)), order_s); + h5tools_str_append(buffer, "%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s); print_precision(buffer, type, ind); /* Print sizes, locations, and other information about each field */ @@ -782,15 +777,13 @@ print_float_type(h5tools_str_t *buffer, hid_t type, int ind) break; } h5tools_str_append(buffer, "\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", - (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, - norm_s); + (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s); h5tools_str_append(buffer, "\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", - ind, "", (unsigned long)esize, 1==esize?"":"s", - (unsigned long)epos, (unsigned long)ebias); + ind, "", (unsigned long)esize, 1==esize?"":"s", (unsigned long)epos, (unsigned long)ebias); h5tools_str_append(buffer, "\n%*s(sign bit at %lu)", ind, "", (unsigned long)spos); /* Display internal padding */ - if (1+esize+msize 0) { + if (nmembs > 0) { char **name; /* member names */ unsigned char *value; /* value array */ hid_t native = -1; /* native integer data type */ @@ -913,9 +891,9 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) * 1. long long -- the largest native signed integer * 2. unsigned long long -- the largest native unsigned integer * 3. raw format */ - if(H5Tget_size(type) <= sizeof(long long)) { + if (H5Tget_size(type) <= sizeof(long long)) { dst_size = sizeof(long long); - if(H5T_SGN_NONE == H5Tget_sign(type)) + if (H5T_SGN_NONE == H5Tget_sign(type)) native = H5T_NATIVE_ULLONG; else native = H5T_NATIVE_LLONG; @@ -926,16 +904,16 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /* Get the names and raw values of all members */ name = (char **)HDcalloc((size_t)nmembs, sizeof(char *)); value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(H5Tget_size(type), dst_size)); - for(i = 0; i < (unsigned)nmembs; i++) { + for (i = 0; i < (unsigned)nmembs; i++) { name[i] = H5Tget_member_name(type, i); H5Tget_member_value(type, i, value + i * H5Tget_size(type)); } /* Convert values to native data type */ - if(native > 0) - if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) { + if (native > 0) + if (H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) { /* Release resources */ - for(i = 0; i < (unsigned)nmembs; i++) + for (i = 0; i < (unsigned)nmembs; i++) H5free_memory(name[i]); HDfree(name); HDfree(value); @@ -947,7 +925,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /*not implemented yet*/ /* Print members */ - for(i = 0; i < (unsigned)nmembs; i++) { + for (i = 0; i < (unsigned)nmembs; i++) { unsigned char *copy; /* a pointer to value array */ int nchars; /* number of output characters */ @@ -955,14 +933,14 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) nchars = print_string(buffer, name[i], TRUE); h5tools_str_append(buffer, "%*s = ", MAX(0, 16 - nchars), ""); - if(native < 0) { + if (native < 0) { size_t j; h5tools_str_append(buffer, "0x"); - for(j = 0; j < dst_size; j++) + for (j = 0; j < dst_size; j++) h5tools_str_append(buffer, "%02x", value[i*dst_size+j]); } - else if(H5T_SGN_NONE == H5Tget_sign(native)) { + else if (H5T_SGN_NONE == H5Tget_sign(native)) { /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" *strangely, unless use another pointer "copy".*/ copy = value + i * dst_size; @@ -972,8 +950,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" *strangely, unless use another pointer "copy".*/ copy = value + i * dst_size; - h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d", - *((long long*)((void*)copy))); + h5tools_str_append(buffer, "%"H5_PRINTF_LL_WIDTH"d", *((long long*)((void*)copy))); } } @@ -1000,14 +977,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Print information about a string data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -1018,7 +988,8 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) H5T_cset_t cset; const char *cset_s=NULL; - if (H5T_STRING!=H5Tget_class(type)) return FALSE; + if (H5T_STRING != H5Tget_class(type)) + return FALSE; /* Padding */ pad = H5Tget_strpad(type); @@ -1101,32 +1072,23 @@ print_string_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) * Purpose: Prints information about a reference data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-04 - * Knows about object and dataset region references. - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) { - if (H5T_REFERENCE!=H5Tget_class(type)) return FALSE; + if (H5T_REFERENCE != H5Tget_class(type)) + return FALSE; - if (H5Tequal(type, H5T_STD_REF_OBJ)==TRUE) { + if (H5Tequal(type, H5T_STD_REF_OBJ) == TRUE) { h5tools_str_append(buffer, "object reference"); } - else if (H5Tequal(type, H5T_STD_REF_DSETREG)==TRUE) { + else if (H5Tequal(type, H5T_STD_REF_DSETREG) == TRUE) { h5tools_str_append(buffer, "dataset region reference"); } else { - h5tools_str_append(buffer, "%lu-byte unknown reference", - (unsigned long)H5Tget_size(type)); + h5tools_str_append(buffer, "%lu-byte unknown reference", (unsigned long)H5Tget_size(type)); } return TRUE; @@ -1139,14 +1101,7 @@ print_reference_type(h5tools_str_t *buffer, hid_t type, int H5_ATTR_UNUSED ind) * Purpose: Prints information about an opaque data type. * * Return: Success: TRUE - * - * Failure: FALSE, nothing printed - * - * Programmer: Robb Matzke - * Monday, June 7, 1999 - * - * Modifications: - * + * Failure: FALSE, nothing printed *------------------------------------------------------------------------- */ static hbool_t @@ -1155,11 +1110,12 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) char *tag; size_t size; - if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE; + if (H5T_OPAQUE != H5Tget_class(type)) + return FALSE; size = H5Tget_size(type); h5tools_str_append(buffer, "%lu-byte opaque type", (unsigned long)size); - if ((tag=H5Tget_tag(type))) { + if ((tag = H5Tget_tag(type))) { h5tools_str_append(buffer, "\n%*s(tag = \"", ind, ""); print_string(buffer, tag, FALSE); h5tools_str_append(buffer, "\")"); @@ -1175,13 +1131,7 @@ print_opaque_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Print information about a variable-length type * * Return: Success: TRUE - * * Failure: FALSE - * - * Programmer: Robb Matzke - * Friday, December 1, 2000 - * - * Modifications: *------------------------------------------------------------------------- */ static hbool_t @@ -1189,11 +1139,12 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) { hid_t super; - if (H5T_VLEN!=H5Tget_class(type)) return FALSE; + if (H5T_VLEN != H5Tget_class(type)) + return FALSE; - h5tools_str_append(buffer, "variable length of\n%*s", ind+4, ""); + h5tools_str_append(buffer, "variable length of\n%*s", ind + 4, ""); super = H5Tget_super(type); - print_type(buffer, super, ind+4); + print_type(buffer, super, ind + 4); H5Tclose(super); return TRUE; } @@ -1203,13 +1154,7 @@ print_vlen_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Print information about an array type * * Return: Success: TRUE - * * Failure: FALSE - * - * Programmer: Robb Matzke - * Thursday, January 31, 2002 - * - * Modifications: *--------------------------------------------------------------------------- */ static hbool_t @@ -1219,7 +1164,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) int ndims, i; hsize_t *dims=NULL; - if (H5T_ARRAY!=H5Tget_class(type)) + if (H5T_ARRAY != H5Tget_class(type)) return FALSE; ndims = H5Tget_array_ndims(type); if (ndims) { @@ -1227,7 +1172,7 @@ print_array_type(h5tools_str_t *buffer, hid_t type, int ind) H5Tget_array_dims2(type, dims); /* Print dimensions */ - for (i=0; i1) { order = H5Tget_order(type); - if (H5T_ORDER_LE==order) { + if (H5T_ORDER_LE == order) { order_s = " little-endian"; - } else if (H5T_ORDER_BE==order) { + } + else if (H5T_ORDER_BE == order) { order_s = " big-endian"; - } else if (H5T_ORDER_VAX==order) { + } + else if (H5T_ORDER_VAX == order) { order_s = " mixed-endian"; - } else { + } + else { order_s = "unknown-byte-order"; } - } else { + } + else { order_s = ""; } - h5tools_str_append(buffer, "%lu-bit%s bitfield", - (unsigned long)(8*H5Tget_size(type)), order_s); + h5tools_str_append(buffer, "%lu-bit%s bitfield", (unsigned long)(8*H5Tget_size(type)), order_s); print_precision(buffer, type, ind); return TRUE; } @@ -1301,16 +1241,9 @@ print_bitfield_type(h5tools_str_t *buffer, hid_t type, int ind) * there might be line-feeds inside the type definition). The * first line is assumed to have IND characters before it on * the same line (printed by the caller). - * - * Return: void - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * Robb Matzke, 1999-06-11 * Prints the OID of shared data types. * + * Return: void *------------------------------------------------------------------------- */ static void @@ -1319,24 +1252,23 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) H5T_class_t data_class = H5Tget_class(type); /* Bad data type */ - if (type<0) { + if (type < 0) { h5tools_str_append(buffer,""); return; } /* Shared? If so then print the type's OID */ - if(H5Tcommitted(type)) { + if (H5Tcommitted(type)) { H5O_info_t oi; - if(H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0) - h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", - oi.fileno, oi.addr); + if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0) + h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr); else h5tools_str_append(buffer,"shared "); } /* end if */ /* Print the type */ - if(print_native_type(buffer, type, ind) || + if (print_native_type(buffer, type, ind) || print_ieee_type(buffer, type, ind) || print_cmpd_type(buffer, type, ind) || print_enum_type(buffer, type, ind) || @@ -1349,8 +1281,7 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) return; /* Unknown type */ - h5tools_str_append(buffer,"%lu-byte class-%u unknown", - (unsigned long)H5Tget_size(type), (unsigned)data_class); + h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class); } @@ -1360,14 +1291,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind) * Purpose: Prints all values of a dataset. * * Return: void - * - * Programmer: Robb Matzke - * Tuesday, July 21, 1998 - * - * Modifications: - * Robb Matzke, 1999-09-27 - * Understands the simple_output_g switch which causes data to - * be displayed in a more machine-readable format. *------------------------------------------------------------------------- */ static void @@ -1407,7 +1330,8 @@ dump_dataset_values(hid_t dset) } outputformat.cmpd_sep = " "; - if (label_g) outputformat.cmpd_name = "%s="; + if (label_g) + outputformat.cmpd_name = "%s="; outputformat.elmt_suf1 = " "; outputformat.str_locale = ESCAPE_HTML; @@ -1450,7 +1374,7 @@ dump_dataset_values(hid_t dset) * command line switch was given. */ outputformat.raw = TRUE; } - else if (string_g && 1==size && H5T_INTEGER==H5Tget_class(f_type)) { + else if (string_g && 1 == size && H5T_INTEGER == H5Tget_class(f_type)) { /* Print 1-byte integer data as an ASCI character string instead of * integers if the `-s' or `--string' command-line option was given. */ outputformat.ascii = TRUE; @@ -1490,14 +1414,7 @@ dump_dataset_values(hid_t dset) * Purpose: Prints information about attributes. * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, June 5, 1998 - * - * Modifications: - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1530,7 +1447,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain print_string(&buffer, attr_name, TRUE); - if((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) { + if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT))) { space = H5Aget_space(attr); type = H5Aget_type(attr); @@ -1547,7 +1464,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain case H5S_SIMPLE: /* simple dataspace */ h5tools_str_append(&buffer, " {"); - for (i=0; i= 0) { + if (p_type >= 0) { /* VL data special information */ unsigned int vl_data = 0; /* contains VL datatypes */ @@ -1680,14 +1596,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain * printed by the caller. * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, August 27, 1998 - * - * Modifications: - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1715,17 +1624,19 @@ dataset_list1(hid_t dset) space_type = H5Sget_simple_extent_type(space); ndims = H5Sget_simple_extent_dims(space, cur_size, max_size); h5tools_str_append(&buffer, " {"); - for (i=0; i0) { + else if (max_size[i] != cur_size[i] || verbose_g > 0) { h5tools_str_append(&buffer, "/"HSIZE_T_FORMAT, max_size[i]); } } - if (space_type==H5S_SCALAR) h5tools_str_append(&buffer, "SCALAR"); - else if (space_type==H5S_NULL) h5tools_str_append(&buffer, "NULL"); + if (space_type == H5S_SCALAR) + h5tools_str_append(&buffer, "SCALAR"); + else if (space_type == H5S_NULL) + h5tools_str_append(&buffer, "NULL"); h5tools_str_append(&buffer, "}"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); H5Sclose (space); @@ -1743,14 +1654,7 @@ dataset_list1(hid_t dset) * information which is general to all objects. * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, August 27, 1998 - * - * Modifications: - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -1786,7 +1690,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) h5tools_str_reset(&buffer); - if(verbose_g > 0) { + if (verbose_g > 0) { dcpl = H5Dget_create_plist(dset); space = H5Dget_space(dset); type = H5Dget_type(dset); @@ -1800,7 +1704,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) ndims = H5Pget_chunk(dcpl, (int)NELMTS(chsize), chsize/*out*/); h5tools_str_append(&buffer, " %-10s {", "Chunks:"); total = H5Tget_size(type); - for (i=0; i 0) { - for(i = 0, max_len = 0; i < nf; i++) { - if(H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0) + if ((nf = H5Pget_external_count(dcpl)) > 0) { + for (i = 0, max_len = 0; i < nf; i++) { + if (H5Pget_external(dcpl, (unsigned)i, sizeof(f_name), f_name, NULL, NULL) < 0) continue; n = print_string(NULL, f_name, TRUE); max_len = MAX(max_len, n); } /* end for */ - h5tools_str_append(&buffer, " %-10s %d external file%s\n", - "Extern:", nf, 1==nf?"":"s"); - h5tools_str_append(&buffer, " %4s %10s %10s %10s %s\n", - "ID", "DSet-Addr", "File-Addr", "Bytes", "File"); - h5tools_str_append(&buffer, " %4s %10s %10s %10s ", - "----", "----------", "----------", "----------"); - for (i=0; i0) - { + h5tools_str_append(&buffer, HSIZE_T_FORMAT" logical byte%s, "HSIZE_T_FORMAT" allocated byte%s", total, 1==total?"":"s", used, 1==used?"":"s"); + if (used>0) { utilization = ((double)total * (double)100.0f) / (double)used; h5tools_str_append(&buffer, ", %1.2f%% utilization", utilization); } @@ -1929,18 +1822,14 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) h5tools_str_append(&buffer, "\n"); /* Print information about raw data filters */ - if((nf = H5Pget_nfilters(dcpl)) > 0) { - for(i = 0; i < nf; i++) { + if ((nf = H5Pget_nfilters(dcpl)) > 0) { + for (i = 0; i < nf; i++) { cd_nelmts = NELMTS(cd_values); - filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_name), f_name, NULL); + filt_id = H5Pget_filter2(dcpl, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); f_name[sizeof(f_name) - 1] = '\0'; HDsnprintf(s, sizeof(s), "Filter-%d:", i); - h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, - (f_name[0] ? f_name : "method"), - (unsigned)filt_id, - ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : "")); - for(cd_num = 0; cd_num < cd_nelmts; cd_num++) + h5tools_str_append(&buffer, " %-10s %s-%u %s {", s, (f_name[0] ? f_name : "method"), (unsigned)filt_id, ((filt_flags & H5Z_FLAG_OPTIONAL) ? "OPT" : "")); + for (cd_num = 0; cd_num < cd_nelmts; cd_num++) h5tools_str_append(&buffer, "%s%u", (cd_num ? ", " : ""), cd_values[cd_num]); h5tools_str_append(&buffer, "}\n"); } /* end for */ @@ -1953,7 +1842,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Print address information */ - if(address_g) + if (address_g) H5Ddebug(dset); /* Close stuff */ @@ -1964,7 +1853,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) h5tools_str_close(&buffer); - if(data_g) + if (data_g) dump_dataset_values(dset); return 0; @@ -1978,20 +1867,13 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) * information which is general to all objects. * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Thursday, November 5, 1998 - * - * Modifications: - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) { - if (verbose_g>0) { + if (verbose_g > 0) { hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -2019,12 +1901,7 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name) * Purpose: Prints information about an object * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 6, 2007 - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -2043,26 +1920,26 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_str_reset(&buffer); /* Print the link's name, either full name or base name */ - if(!iter->symlink_target) + if (!iter->symlink_target) print_obj_name(&buffer, iter, name, ""); /* Check object information */ - if(oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) { + if (oinfo->type < 0 || oinfo->type >= H5O_TYPE_NTYPES) { h5tools_str_append(&buffer, "Unknown type(%d)", (int)oinfo->type); obj_type = H5O_TYPE_UNKNOWN; } - if(iter->symlink_target) + if (iter->symlink_target) h5tools_str_append(&buffer, "{"); - if(obj_type >= 0 && dispatch_g[obj_type].name) + if (obj_type >= 0 && dispatch_g[obj_type].name) h5tools_str_append(&buffer, "%s", dispatch_g[obj_type].name); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Check if we've seen this object before */ - if(first_seen) { + if (first_seen) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, ", same as "); print_string(&buffer, first_seen, TRUE); - if(!iter->symlink_target) { + if (!iter->symlink_target) { h5tools_str_append(&buffer, "\n"); } h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); @@ -2073,7 +1950,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Open the object. Not all objects can be opened. If this is the case * then return right away. */ - if(obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { + if (obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " *ERROR*\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); @@ -2081,9 +1958,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* List the first line of information for the object. */ - if(obj_type >= 0 && dispatch_g[obj_type].list1) + if (obj_type >= 0 && dispatch_g[obj_type].list1) (dispatch_g[obj_type].list1)(obj); - if(!iter->symlink_target || (verbose_g > 0)) { + if (!iter->symlink_target || (verbose_g > 0)) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); @@ -2091,13 +1968,13 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Show detailed information about the object, beginning with information * which is common to all objects. */ - if(verbose_g > 0) { + if (verbose_g > 0) { size_t buf_size = 0; char* comment = NULL; ssize_t cmt_bufsize = -1; /* Display attributes */ - if(obj_type >= 0) + if (obj_type >= 0) H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL); /* Object location & reference count */ @@ -2107,7 +1984,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Modification time */ - if(oinfo->mtime > 0) { + if (oinfo->mtime > 0) { char buf[256]; struct tm *tm; @@ -2115,7 +1992,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void tm = HDgmtime(&(oinfo->mtime)); else tm = HDlocaltime(&(oinfo->mtime)); - if(tm) { + if (tm) { HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " %-10s %s\n", "Modified:", buf); @@ -2131,9 +2008,9 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void * If the call to H5Oget_comment returned an error, skip this block */ if (cmt_bufsize > 0) { comment = (char *)HDmalloc((size_t)cmt_bufsize + 1); /* new_size including null terminator */ - if(comment) { + if (comment) { cmt_bufsize = H5Oget_comment(obj, comment, (size_t)cmt_bufsize); - if(cmt_bufsize > 0) { + if (cmt_bufsize > 0) { comment[cmt_bufsize] = 0; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " %-10s \"", "Comment:"); @@ -2147,16 +2024,16 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* Detailed list for object */ - if(obj_type >= 0 && dispatch_g[obj_type].list2) + if (obj_type >= 0 && dispatch_g[obj_type].list2) (dispatch_g[obj_type].list2)(obj, name); /* Close the object. */ - if(obj_type >= 0) + if (obj_type >= 0) H5Oclose(obj); } /* end else */ done: - if(iter->symlink_target) { + if (iter->symlink_target) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "}\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); @@ -2168,19 +2045,13 @@ done: } /* end list_obj() */ - /*------------------------------------------------------------------------- * Function: list_lnk * * Purpose: Prints information about a link * * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Quincey Koziol - * Thursday, November 8, 2007 - * + * Failure: -1 *------------------------------------------------------------------------- */ static herr_t @@ -2227,15 +2098,13 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_append(&buffer, buf); h5tools_str_append(&buffer, "}"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); - if(follow_symlink_g) - { + if (follow_symlink_g) { hbool_t orig_grp_literal = grp_literal_g; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " "); /* Check if we have already seen this softlink */ - if(symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) - { + if (symlink_is_visited(iter->symlink_list, linfo->type, NULL, buf)) { h5tools_str_append(&buffer, "{Already Visited}\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; @@ -2243,7 +2112,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Add this link to the list of seen softlinks */ - if(symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0) + if (symlink_visit_add(iter->symlink_list, linfo->type, NULL, buf) < 0) goto done; /* Adjust user data to specify that we are operating on the @@ -2252,11 +2121,10 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) /* Prevent recursive listing of soft link target if * recursive_g is off */ - if(!recursive_g) + if (!recursive_g) grp_literal_g = TRUE; /* Recurse through the soft link */ - if(visit_obj(iter->fid, name, iter) < 0) - { + if (visit_obj(iter->fid, name, iter) < 0) { grp_literal_g = orig_grp_literal; goto done; } @@ -2288,7 +2156,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) else if (no_dangling_link_g && ret == 0) iter->symlink_list->dangle_link = TRUE; - if(H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0) + if (H5Lunpack_elink_val(buf, linfo->u.val_size, NULL, &filename, &path) < 0) goto done; h5tools_str_append(&buffer, "External Link {"); @@ -2296,21 +2164,19 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_str_append(&buffer, "/"); if(*path != '/') h5tools_str_append(&buffer, "/"); - h5tools_str_append(&buffer, path); + h5tools_str_append(&buffer, path); h5tools_str_append(&buffer, "}"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Recurse through the external link */ /* keep the follow_elink_g for backward compatibility with -E */ - if(follow_link) - { + if (follow_link) { hbool_t orig_grp_literal = grp_literal_g; h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " "); /* Check if we have already seen this elink */ - if(symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) - { + if (symlink_is_visited(iter->symlink_list, linfo->type, filename, path)) { h5tools_str_append(&buffer, "{Already Visited}\n"); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; @@ -2318,8 +2184,7 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); /* Add this link to the list of seen elinks */ - if(symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) - { + if (symlink_visit_add(iter->symlink_list, linfo->type, filename, path) < 0) { goto done; } @@ -2329,11 +2194,11 @@ list_lnk(const char *name, const H5L_info_t *linfo, void *_iter) /* Prevent recursive listing of external link target if * recursive_g is off */ - if(!recursive_g) + if (!recursive_g) grp_literal_g = TRUE; /* Recurse through the external link */ - if(visit_obj(iter->fid, name, iter) < 0) { + if (visit_obj(iter->fid, name, iter) < 0) { grp_literal_g = orig_grp_literal; goto done; } @@ -2371,11 +2236,6 @@ done: * Return: * Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, August 21, 2008 - * Mostly copied from main() - * *------------------------------------------------------------------------- */ static herr_t @@ -2394,8 +2254,8 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) h5tools_str_reset(&buffer); /* Retrieve info for object to list */ - if(H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) { - if(iter->symlink_target) { + if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) { + if (iter->symlink_target) { h5tools_str_append(&buffer, "{**NOT FOUND**}\n"); iter->symlink_target = FALSE; } @@ -2407,9 +2267,9 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) } /* end if */ /* Check for group iteration */ - if(H5O_TYPE_GROUP == oi.type && !grp_literal_g) { + if (H5O_TYPE_GROUP == oi.type && !grp_literal_g) { /* Get ID for group */ - if(!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) { + if (!iter->symlink_target && (iter->gid = H5Gopen2(file, oname, H5P_DEFAULT)) < 0) { h5tools_str_append(&buffer, "%s: unable to open '%s' as group\n", iter->fname, oname); h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); goto done; /* Previously "continue", when this code was in main(). @@ -2425,7 +2285,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter) h5trav_visit(file, oname, (hbool_t) (display_root_g || iter->symlink_target), recursive_g, list_obj, list_lnk, iter, H5O_INFO_BASIC|H5O_INFO_TIME); /* Close group */ - if(!iter->symlink_target) + if (!iter->symlink_target) H5Gclose(iter->gid); } /* end if */ else { @@ -2452,14 +2312,7 @@ done: * were borrowed from the GNU less(1). * * Return: Success: Number of columns. - * - * Failure: Some default number of columms. - * - * Programmer: Robb Matzke - * Friday, November 6, 1998 - * - * Modifications: - * + * Failure: Some default number of columms. *------------------------------------------------------------------------- */ static int @@ -2470,7 +2323,7 @@ get_width(void) /* Try to get it from the COLUMNS environment variable first since it's * value is sometimes wrong. */ - if ((s=HDgetenv("COLUMNS")) && *s && isdigit((int)*s)) + if ((s = HDgetenv("COLUMNS")) && *s && isdigit((int)*s)) width = (int)HDstrtol(s, NULL, 0); #if defined(H5_HAVE_STRUCT_VIDEOCONFIG) && defined(H5_HAVE__GETVIDEOCONFIG) @@ -2518,7 +2371,8 @@ get_width(void) #endif /* Set to at least 1 */ - if (width<1) width = 1; + if (width < 1) + width = 1; return width; } @@ -2530,25 +2384,19 @@ get_width(void) * Return: * Success: TRUE (1) * Failure: FALSE (0) - * - * Programmer: - * Jonathan Kim (06/15/2010) - * *-------------------------------------------------------------------------*/ static hbool_t is_valid_args(void) { hbool_t ret = TRUE; - if(recursive_g && grp_literal_g) - { + if (recursive_g && grp_literal_g) { HDfprintf(rawerrorstream, "Error: 'recursive' option not compatible with 'group info' option!\n\n"); ret = FALSE; goto out; } - if(no_dangling_link_g && !follow_symlink_g) - { + if (no_dangling_link_g && !follow_symlink_g) { HDfprintf(rawerrorstream, "Error: --no-dangling-links must be used along with --follow-symlinks option!\n\n"); ret = FALSE; goto out; @@ -2565,12 +2413,6 @@ out: * Purpose: Close HDF5 and MPI and call exit() * * Return: Does not return - * - * Programmer: Quincey Koziol - * Saturday, January 31, 2004 - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -2588,29 +2430,22 @@ leave(int ret) * Purpose: Opens a file and lists the specified group * * Return: Success: 0 - * - * Failure: 1 - * - * Programmer: Robb Matzke - * Monday, March 23, 1998 - * - * Modifications: - * + * Failure: 1 *------------------------------------------------------------------------- */ int main(int argc, const char *argv[]) { - hid_t file = -1; - char *fname = NULL, *oname = NULL, *x; + hid_t file = -1; + char *fname = NULL, *oname = NULL, *x; const char *s = NULL; - char *rest; - int argno; + char *rest; + int argno; static char root_name[] = "/"; char drivername[50]; const char *preferred_driver = NULL; - int err_exit = 0; - hid_t fapl_id = H5P_DEFAULT; + int err_exit = 0; + hid_t fapl_id = H5P_DEFAULT; #ifdef H5_HAVE_ROS3_VFD /* default "anonymous" s3 configuration */ @@ -2650,85 +2485,110 @@ main(int argc, const char *argv[]) width_g = get_width(); /* Switches come before non-switch arguments */ - for(argno = 1; argno < argc && '-' == argv[argno][0]; argno++) { - if(!HDstrcmp(argv[argno], "--")) { + for (argno = 1; argno < argc && '-' == argv[argno][0]; argno++) { + if (!HDstrcmp(argv[argno], "--")) { /* Last switch */ argno++; break; - } else if(!HDstrcmp(argv[argno], "--help")) { + } + else if (!HDstrcmp(argv[argno], "--help")) { usage(); leave(EXIT_SUCCESS); - } else if(!HDstrcmp(argv[argno], "--address")) { + } + else if (!HDstrcmp(argv[argno], "--address")) { address_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--data")) { + } + else if(!HDstrcmp(argv[argno], "--data")) { data_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--enable-error-stack")) { + } + else if (!HDstrcmp(argv[argno], "--enable-error-stack")) { show_errors_g = TRUE; /* deprecated --errors */ - } else if(!HDstrcmp(argv[argno], "--errors")) { + } + else if (!HDstrcmp(argv[argno], "--errors")) { show_errors_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--follow-symlinks")) { + } + else if (!HDstrcmp(argv[argno], "--follow-symlinks")) { follow_symlink_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--no-dangling-links")) { + } + else if (!HDstrcmp(argv[argno], "--no-dangling-links")) { no_dangling_link_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--external")) { + } + else if (!HDstrcmp(argv[argno], "--external")) { follow_elink_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--full")) { + } + else if (!HDstrcmp(argv[argno], "--full")) { fullname_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--group")) { + } + else if (!HDstrcmp(argv[argno], "--group")) { grp_literal_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--label")) { + } + else if (!HDstrcmp(argv[argno], "--label")) { label_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--recursive")) { + } + else if (!HDstrcmp(argv[argno], "--recursive")) { recursive_g = TRUE; fullname_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--simple")) { + } + else if (!HDstrcmp(argv[argno], "--simple")) { simple_output_g = TRUE; - } else if(!HDstrcmp(argv[argno], "--string")) { + } + else if (!HDstrcmp(argv[argno], "--string")) { string_g = TRUE; - } else if(!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { + } + else if (!HDstrncmp(argv[argno], "--vfd=", (size_t)6)) { preferred_driver = argv[argno]+6; - } else if(!HDstrncmp(argv[argno], "--width=", (size_t)8)) { + } + else if (!HDstrncmp(argv[argno], "--width=", (size_t)8)) { width_g = (int)HDstrtol(argv[argno]+8, &rest, 0); - if(0 == width_g) + if (0 == width_g) no_line_wrap_g = TRUE; - else if(width_g < 0 || *rest) { + else if (width_g < 0 || *rest) { usage(); leave(EXIT_FAILURE); } - } else if(!HDstrcmp(argv[argno], "--width")) { - if((argno + 1) >= argc) { + } + else if (!HDstrcmp(argv[argno], "--width")) { + if ((argno + 1) >= argc) { usage(); leave(EXIT_FAILURE); - } else { + } + else { s = argv[++argno]; } width_g = (int)HDstrtol(s, &rest, 0); - if(width_g <= 0 || *rest) { + if (width_g <= 0 || *rest) { usage(); leave(EXIT_FAILURE); } - } else if(!HDstrcmp(argv[argno], "--verbose")) { + } + else if (!HDstrcmp(argv[argno], "--verbose")) { verbose_g++; - } else if(!HDstrcmp(argv[argno], "--version")) { + } + else if (!HDstrcmp(argv[argno], "--version")) { print_version(h5tools_getprogname()); leave(EXIT_SUCCESS); - } else if(!HDstrcmp(argv[argno], "--hexdump")) { + } + else if (!HDstrcmp(argv[argno], "--hexdump")) { hexdump_g = TRUE; - } else if(!HDstrncmp(argv[argno], "-w", (size_t)2)) { - if(argv[argno][2]) { + } + else if (!HDstrncmp(argv[argno], "-w", (size_t)2)) { + if (argv[argno][2]) { s = argv[argno] + 2; - } else if((argno + 1) >= argc) { + } + else if ((argno + 1) >= argc) { usage(); leave(EXIT_FAILURE); - } else { + } + else { s = argv[++argno]; } width_g = (int)HDstrtol(s, &rest, 0); - if(0 == width_g) + if(0 == width_g) { no_line_wrap_g = TRUE; + } else if(width_g < 0 || *rest) { usage(); leave(EXIT_FAILURE); @@ -2736,8 +2596,7 @@ main(int argc, const char *argv[]) } else if (!HDstrncmp(argv[argno], "--s3-cred=", (size_t)10)) { #ifndef H5_HAVE_ROS3_VFD - HDfprintf(rawerrorstream, - "Error: Read-Only S3 VFD is not enabled\n\n"); + HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD is not enabled\n\n"); usage(); leave(EXIT_FAILURE); #else @@ -2752,26 +2611,20 @@ main(int argc, const char *argv[]) if (start == NULL) { HDfprintf(rawerrorstream, "Error: Unable to parse null credentials tuple\n" - " For anonymous access, omit \"--s3-cred\" and use" - "only \"--vfd=ros3\"\n\n"); + " For anonymous access, omit \"--s3-cred\" and use only \"--vfd=ros3\"\n\n"); usage(); leave(EXIT_FAILURE); } start++; - if (FAIL == - parse_tuple((const char *)start, ',', - &s3cred_src, &nelems, &s3cred)) - { - HDfprintf(rawerrorstream, - "Error: Unable to parse S3 credentials\n\n"); + if (FAIL == parse_tuple((const char *)start, ',', &s3cred_src, &nelems, &s3cred)) { + HDfprintf(rawerrorstream, "Error: Unable to parse S3 credentials\n\n"); usage(); leave(EXIT_FAILURE); } /* sanity-check tuple count */ if (nelems != 3) { - HDfprintf(rawerrorstream, - "Error: Invalid S3 credentials\n\n"); + HDfprintf(rawerrorstream, "Error: Invalid S3 credentials\n\n"); usage(); leave(EXIT_FAILURE); } @@ -2779,8 +2632,7 @@ main(int argc, const char *argv[]) ccred[1] = (const char *)s3cred[1]; ccred[2] = (const char *)s3cred[2]; if (0 == h5tools_populate_ros3_fapl(&ros3_fa, ccred)) { - HDfprintf(rawerrorstream, - "Error: Invalid S3 credentials\n\n"); + HDfprintf(rawerrorstream, "Error: Invalid S3 credentials\n\n"); usage(); leave(EXIT_FAILURE); } @@ -2788,13 +2640,13 @@ main(int argc, const char *argv[]) HDfree(s3cred_src); #endif /* H5_HAVE_ROS3_VFD */ - } else if (!HDstrncmp(argv[argno], "--hdfs-attrs=", (size_t)13)) { + } + else if (!HDstrncmp(argv[argno], "--hdfs-attrs=", (size_t)13)) { #ifndef H5_HAVE_LIBHDFS PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n"); leave(EXIT_FAILURE); #else - /* Parse received configuration data and set fapl config struct - */ + /* Parse received configuration data and set fapl config struct */ hbool_t _debug = FALSE; unsigned nelems = 0; @@ -2809,20 +2661,16 @@ main(int argc, const char *argv[]) HDfprintf(stderr, "configuring hdfs...\n"); } start = argv[argno]+13; /* should never segfault: worst case of */ - if (*start != '(') /* null-termintor after '='. */ - { + if (*start != '(') { /* null-termintor after '='. */ + if (_debug) { HDfprintf(stderr, " no tuple.\n"); } usage(); leave(EXIT_FAILURE); } - if (FAIL == - parse_tuple((const char *)start, ',', - &props_src, &nelems, &props)) - { - HDfprintf(stderr, - " unable to parse tuple.\n"); + if (FAIL == parse_tuple((const char *)start, ',', &props_src, &nelems, &props)) { + HDfprintf(stderr, " unable to parse tuple.\n"); usage(); leave(EXIT_FAILURE); } @@ -2830,20 +2678,13 @@ main(int argc, const char *argv[]) /* sanity-check tuple count */ if (nelems != 5) { - HDfprintf(stderr, - " expected 5-ple, got `%d`\n", - nelems); + HDfprintf(stderr, " expected 5-ple, got `%d`\n", nelems); usage(); leave(EXIT_FAILURE); } if (_debug) { - HDfprintf(stderr, - " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n", - props[0], - props[1], - props[2], - props[3], - props[4]); + HDfprintf(stderr, " got hdfs-attrs tuple: `(%s,%s,%s,%s,%s)`\n", + props[0], props[1], props[2], props[3], props[4]); } /* Populate fapl configuration structure with given properties. @@ -2852,59 +2693,41 @@ main(int argc, const char *argv[]) */ if (HDstrncmp(props[0], "", 1)) { if (_debug) { - HDfprintf(stderr, - " setting namenode name: %s\n", - props[0]); + HDfprintf(stderr, " setting namenode name: %s\n", props[0]); } - HDstrncpy(hdfs_fa.namenode_name, - (const char *)props[0], - HDstrlen(props[0])); + HDstrncpy(hdfs_fa.namenode_name, (const char *)props[0], HDstrlen(props[0])); } if (HDstrncmp(props[1], "", 1)) { k = strtoul((const char *)props[1], NULL, 0); if (errno == ERANGE) { - HDfprintf(stderr, - " supposed port number wasn't.\n"); + HDfprintf(stderr, " supposed port number wasn't.\n"); leave(EXIT_FAILURE); } if (_debug) { - HDfprintf(stderr, - " setting namenode port: %lu\n", - k); + HDfprintf(stderr, " setting namenode port: %lu\n", k); } hdfs_fa.namenode_port = (int32_t)k; } if (HDstrncmp(props[2], "", 1)) { if (_debug) { - HDfprintf(stderr, - " setting kerb cache path: %s\n", - props[2]); + HDfprintf(stderr, " setting kerb cache path: %s\n", props[2]); } - HDstrncpy(hdfs_fa.kerberos_ticket_cache, - (const char *)props[2], - HDstrlen(props[2])); + HDstrncpy(hdfs_fa.kerberos_ticket_cache, (const char *)props[2], HDstrlen(props[2])); } if (HDstrncmp(props[3], "", 1)) { if (_debug) { - HDfprintf(stderr, - " setting username: %s\n", - props[3]); + HDfprintf(stderr, " setting username: %s\n", props[3]); } - HDstrncpy(hdfs_fa.user_name, - (const char *)props[3], - HDstrlen(props[3])); + HDstrncpy(hdfs_fa.user_name, (const char *)props[3], HDstrlen(props[3])); } if (HDstrncmp(props[4], "", 1)) { k = HDstrtoul((const char *)props[4], NULL, 0); if (errno == ERANGE) { - HDfprintf(stderr, - " supposed buffersize number wasn't.\n"); + HDfprintf(stderr, " supposed buffersize number wasn't.\n"); leave(EXIT_FAILURE); } if (_debug) { - HDfprintf(stderr, - " setting stream buffer size: %lu\n", - k); + HDfprintf(stderr, " setting stream buffer size: %lu\n", k); } hdfs_fa.stream_buffer_size = (int32_t)k; } @@ -2912,7 +2735,8 @@ main(int argc, const char *argv[]) HDfree(props_src); #endif /* H5_HAVE_LIBHDFS */ - } else if('-'!=argv[argno][1]) { + } + else if('-'!=argv[argno][1]) { /* Single-letter switches */ for(s = argv[argno] + 1; *s; s++) { switch(*s) { @@ -2982,7 +2806,8 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } /* end switch */ } /* end for */ - } else { + } + else { HDfprintf(stderr, "Unknown argument: %s\n", argv[argno]); usage(); leave(EXIT_FAILURE); @@ -2991,14 +2816,13 @@ main(int argc, const char *argv[]) /* If no arguments remain then print a usage message (instead of doing * absolutely nothing ;-) */ - if(argno >= argc) { + if (argno >= argc) { usage(); leave(EXIT_FAILURE); } /* end if */ /* Check for conflicting arguments */ - if (!is_valid_args()) - { + if (!is_valid_args()) { usage(); leave(EXIT_FAILURE); } @@ -3008,15 +2832,15 @@ main(int argc, const char *argv[]) if (!HDstrcmp(preferred_driver, "ros3")) { #ifndef H5_HAVE_ROS3_VFD - HDfprintf(rawerrorstream, - "Error: Read-Only S3 VFD not enabled.\n\n"); + HDfprintf(rawerrorstream, "Error: Read-Only S3 VFD not enabled.\n\n"); usage(); leave(EXIT_FAILURE); #else conf_fa = (void *)&ros3_fa; #endif /* H5_HAVE_ROS3_VFD */ - } else if (!HDstrcmp(preferred_driver, "hdfs")) { + } + else if (!HDstrcmp(preferred_driver, "hdfs")) { #ifndef H5_HAVE_LIBHDFS PRINTVALSTREAM(rawoutstream, "The HDFS VFD is not enabled.\n"); leave(EXIT_FAILURE); @@ -3029,17 +2853,11 @@ main(int argc, const char *argv[]) HDassert(fapl_id == H5P_DEFAULT); fapl_id = H5Pcreate(H5P_FILE_ACCESS); if (fapl_id < 0) { - HDfprintf(rawerrorstream, - "Error: Unable to create fapl entry\n\n"); + HDfprintf(rawerrorstream, "Error: Unable to create fapl entry\n\n"); leave(EXIT_FAILURE); } - if (0 == h5tools_set_configured_fapl( - fapl_id, - preferred_driver, - conf_fa)) - { - HDfprintf(rawerrorstream, - "Error: Unable to set fapl\n\n"); + if (0 == h5tools_set_configured_fapl(fapl_id, preferred_driver, conf_fa)) { + HDfprintf(rawerrorstream, "Error: Unable to set fapl\n\n"); usage(); leave(EXIT_FAILURE); } @@ -3074,7 +2892,7 @@ main(int argc, const char *argv[]) oname = NULL; file = -1; - while(fname && *fname) { + while (fname && *fname) { if (fapl_id != H5P_DEFAULT) { file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id); } @@ -3082,8 +2900,8 @@ main(int argc, const char *argv[]) file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername); } - if(file >= 0) { - if(verbose_g) + if (file >= 0) { + if (verbose_g) PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername); break; /*success*/ } /* end if */ @@ -3091,27 +2909,27 @@ main(int argc, const char *argv[]) /* Shorten the file name; lengthen the object name */ x = oname; oname = HDstrrchr(fname, '/'); - if(x) + if (x) *x = '/'; - if(!oname) + if (!oname) break; *oname = '\0'; } /* end while */ - if(file < 0) { + if (file < 0) { HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]); HDfree(fname); err_exit = 1; continue; } /* end if */ - if(oname) { + if (oname) { /* Always use absolute paths to avoid confusion, keep track of where * to begin path name output */ *oname = '/'; iter.base_len = HDstrlen(oname); iter.base_len -= oname[iter.base_len-1] == '/'; x = oname; - if(NULL == (oname = HDstrdup(oname))) { + if (NULL == (oname = HDstrdup(oname))) { HDfprintf(rawerrorstream, "memory allocation failed\n"); leave(EXIT_FAILURE); } @@ -3120,9 +2938,9 @@ main(int argc, const char *argv[]) * is displayed if it is a link or non-group object */ iter.name_start = 1; } - if(!oname || !*oname) { + if (!oname || !*oname) { oname = root_name; - if(recursive_g) + if (recursive_g) display_root_g = TRUE; iter.base_len = 0; iter.name_start = 0; @@ -3143,9 +2961,9 @@ main(int argc, const char *argv[]) symlink_list.objs = NULL; /* Check for root group as object name */ - if(HDstrcmp(oname, root_name)) { + if (HDstrcmp(oname, root_name)) { /* Check the type of link given */ - if(H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { + if (H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) { hsize_t curr_pos = 0; /* total data element position */ h5tools_str_t buffer; /* string into which to render */ h5tools_context_t ctx; /* print context */ @@ -3164,8 +2982,8 @@ main(int argc, const char *argv[]) li.type = H5L_TYPE_HARD; /* Open the object and display it's information */ - if(li.type == H5L_TYPE_HARD) { - if(visit_obj(file, oname, &iter) < 0) + if (li.type == H5L_TYPE_HARD) { + if (visit_obj(file, oname, &iter) < 0) leave(EXIT_FAILURE); } /* end if(li.type == H5L_TYPE_HARD) */ else { @@ -3176,11 +2994,10 @@ main(int argc, const char *argv[]) } H5Fclose(file); HDfree(fname); - if(x) + if (x) HDfree(oname); - for(u=0; u < symlink_list.nused; u++) - { + for (u = 0; u < symlink_list.nused; u++) { if (symlink_list.objs[u].type == H5L_TYPE_EXTERNAL) HDfree(symlink_list.objs[u].file); @@ -3195,8 +3012,7 @@ main(int argc, const char *argv[]) if (fapl_id != H5P_DEFAULT) { if (0 < H5Pclose(fapl_id)) { - HDfprintf(rawerrorstream, - "Error: Unable to set close fapl entry\n\n"); + HDfprintf(rawerrorstream, "Error: Unable to set close fapl entry\n\n"); leave(EXIT_FAILURE); } } -- cgit v0.12 From db1022ef5dad4ee450ca092b8b471040f405bbcf Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 16 Sep 2019 15:35:09 -0500 Subject: Fix segfault after H5VL_loc_params_t fix merge --- src/H5Gdeprec.c | 4 ++-- src/H5VLpassthru.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 5acb378..97a3ccf 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -357,7 +357,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new tmp_vol_obj.connector = vol_obj->connector; /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -437,7 +437,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Create the link through the VOL */ - if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, loc_params1) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index eecdac2..24070fa 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -2131,11 +2131,11 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj, /* Fix up the link target object for hard link creation */ if(H5VL_LINK_CREATE_HARD == create_type) { void *cur_obj; - H5VL_loc_params_t cur_params; + H5VL_loc_params_t *cur_params; /* Retrieve the object & loc params for the link target */ cur_obj = va_arg(arguments, void *); - cur_params = va_arg(arguments, H5VL_loc_params_t); + cur_params = va_arg(arguments, H5VL_loc_params_t *); /* If it's a non-NULL pointer, find the 'under object' and re-set the property */ if(cur_obj) { -- cgit v0.12 From 387d2e671c597a51b4166667a16e740a8e1449fa Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 16 Sep 2019 15:17:31 -0700 Subject: Added a release note for HDFFV-10892 (fcntl lock bug). --- release_docs/RELEASE.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f26d969..7c09c2b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -538,6 +538,28 @@ Bug Fixes since HDF5-1.10.3 release (JTH - 2018/08/25, HDFFV-10501) + - fcntl(2)-based file locking incorrectly passed the lock argument struct + instead of a pointer to the struct, causing errors on systems where + flock(2) is not available. + + File locking is used when files are opened to enforce SWMR semantics. A + lock operation takes place on all file opens unless the + HDF5_USE_FILE_LOCKING environment variable is set to the string "FALSE". + flock(2) is preferentially used, with fcntl(2) locks as a backup if + flock(2) is unavailable on a system (if neither is available, the lock + operation fails). On these systems, the file lock will often fail, which + causes HDF5 to not open the file and report an error. + + This bug only affects POSIX systems. Win32 builds on Windows use a no-op + locking call which always succeeds. Systems which exhibit this bug will + have H5_HAVE_FCNTL defined but not H5_HAVE_FLOCK in the configure output. + + This bug affects HDF5 1.10.0 through 1.10.5. + + fcntl(2)-based file locking now correctly passes the struct pointer. + + (DER - 2019/08/27, HDFFV-10892) + Java Library: ---------------- -- cgit v0.12 From adce9e7f4e9a743c4d48cf5fc7c52a13cc751be3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 10:30:04 -0500 Subject: HDFFV-10903 - fix VFD constants in JNI --- java/src/jni/h5Constants.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index ac55a13..9f52b3c 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -453,7 +453,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { return H5FD_HDFS; } +Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_LIBHDFS + return H5FD_HDFS; +#else + return -1; +#endif +} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } JNIEXPORT jlong JNICALL @@ -463,7 +469,13 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5F JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } JNIEXPORT jlong JNICALL -Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { return H5FD_ROS3; } +Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_ROS3_VFD + return H5FD_ROS3; +#else + return -1; +#endif +} JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } JNIEXPORT jlong JNICALL -- cgit v0.12 From f5a84c9856888446e329dd36bff842e5a2db708c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 17 Sep 2019 10:52:16 -0700 Subject: Added MPICH_SKIP_MPICXX and OMPI_SKIP_CXX to H5public.h to avoid inadvertant linking to the deprecated MPI C++ wrappers. Fixes HDFFV-10893. --- release_docs/RELEASE.txt | 13 +++++++++++++ src/H5public.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 7c09c2b..eb47648 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -808,6 +808,19 @@ Bug Fixes since HDF5-1.10.2 release (DER - 2018/02/26, HDFFV-10356) + - Inappropriate linking with deprecated MPI C++ libraries + + HDF5 does not define *_SKIP_MPICXX in the public headers, so applications + can inadvertently wind up linking to the deprecated MPI C++ wrappers. + + MPICH_SKIP_MPICXX and OMPI_SKIP_MPICXX have both been defined in H5public.h + so this should no longer be an issue. HDF5 makes no use of the deprecated + MPI C++ wrappers. + + (DER - 2019/09/17, HDFFV-10893) + + + Configuration ------------- - Applied patches to address Cywin build issues diff --git a/src/H5public.h b/src/H5public.h index a7e21f6..b79fcfb 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -57,6 +57,9 @@ # include #endif #ifdef H5_HAVE_PARALLEL +/* Don't link against MPI C++ bindings */ +# define MPICH_SKIP_MPICXX 1 +# define OMPI_SKIP_MPICXX 1 # include #ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ # include -- cgit v0.12 From 3790ba38a1ad9751696f1244e73b83964994e8d5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 14:38:26 -0500 Subject: HDFFV-10905 fix test scripts for no zlib --- tools/test/h5copy/testh5copy.sh.in | 9 ++++----- tools/test/h5repack/h5repack.sh.in | 9 +++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 50758b5..2440ca4 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -504,22 +504,21 @@ fi TOOLTEST -i $TESTFILE -o $TESTDIR/dsrename.out.h5 -v -s compound -d rename echo "Test copying empty, 'full' & 'nested' groups" -if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/grp_empty.out.h5 -v -s grp_empty -d grp_empty -fi +if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST -i $TESTFILE -o $TESTDIR/grp_dsets.out.h5 -v -s grp_dsets -d grp_dsets TOOLTEST -i $TESTFILE -o $TESTDIR/grp_nested.out.h5 -v -s grp_nested -d grp_nested +fi TOOLTEST -i $TESTFILE -o $TESTDIR/grp_attr.out.h5 -v -s grp_attr -d grp_attr -if test $USE_FILTER_DEFLATE = "yes" ; then echo "Test copying dataset within group in source file to group in destination" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/simple_group.out.h5 grp_dsets grp_dsets /grp_dsets/simple /grp_dsets/simple_group +if test $USE_FILTER_DEFLATE = "yes" ; then echo "Test copying & renaming group" TOOLTEST -i $TESTFILE -o $TESTDIR/grp_rename.out.h5 -v -s grp_dsets -d grp_rename -fi - echo "Test copying 'full' group hierarchy into group in destination file" TOOLTEST_PREFILL -i $TESTFILE -o $TESTDIR/grp_dsets_rename.out.h5 grp_dsets grp_rename grp_dsets /grp_rename/grp_dsets +fi echo "Test copying objects into group hier. that doesn't exist yet in destination file" TOOLTEST -i $TESTFILE -o $TESTDIR/A_B1_simple.out.h5 -vp -s simple -d /A/B1/simple diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 282ba76..c515786 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -1391,7 +1391,12 @@ TOOLTEST add_alignment $arg TOOLTEST upgrade_layout h5repack_layouto.h5 # test for datum size > H5TOOLS_MALLOCSIZE -TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1 +arg="h5repack_objs.h5 -f GZIP=1" +if test $USE_FILTER_DEFLATE != "yes" ; then + SKIP $arg +else + TOOLTEST gt_mallocsize $arg +fi # Check repacking file with committed datatypes in odd configurations TOOLTEST committed_dt h5repack_named_dtypes.h5 @@ -1462,7 +1467,7 @@ VERIFY_SUPERBLOCK 1 2 2 h5repack_layout.h5 -j 1 -k 2 h5repack_layout.h5 # -j 2 -k 2, superblock will be 3 VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5 # -j 0 -k 1, file cannot be opened -VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 +VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 8e686c8211f837cd57427c46efc06386f156fb92 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 17 Sep 2019 15:43:27 -0500 Subject: Correct HDF5 options to tristate values. --- config/cmake/HDFCompilerFlags.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 37ddcbb..adace89 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -346,10 +346,12 @@ endif () # By default, CMake adds NDEBUG to CMAKE_${lang}_FLAGS for Release build types # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) -if (HDF5_ENABLE_ASSERTS) +#option (HDF5_ENABLE_ASSERTS "Determines whether NDEBUG is defined to control assertions." OFF) +set (HDF5_ENABLE_ASSERTS "OFF" CACHE STRING "Determines whether NDEBUG is defined to control assertions (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_ASSERTS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_ASSERTS MATCHES "YES") add_compile_options ("-UNDEBUG") -else () +elseif (HDF5_ENABLE_ASSERTS MATCHES "NO") add_compile_options ("-DNDEBUG") endif () MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) @@ -358,8 +360,10 @@ MARK_AS_ADVANCED (HDF5_ENABLE_ASSERTS) # Option for --enable-symbols # This option will force/override the default setting for all configurations #----------------------------------------------------------------------------- -option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) -if (HDF5_ENABLE_SYMBOLS) +#option (HDF5_ENABLE_SYMBOLS "Add debug symbols to the library independent of the build mode and optimization level." OFF) +set (HDF5_ENABLE_SYMBOLS "OFF" CACHE STRING "Add debug symbols to the library independent of the build mode and optimization level (OFF NO YES)") +set_property (CACHE HDF5_ENABLE_SYMBOLS PROPERTY STRINGS OFF NO YES) +if (HDF5_ENABLE_SYMBOLS MATCHES "YES") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") @@ -372,7 +376,7 @@ if (HDF5_ENABLE_SYMBOLS) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") endif () endif () -else () +elseif (HDF5_ENABLE_SYMBOLS MATCHES "NO") if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-s") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") -- cgit v0.12 From 431123503d387bce30b1f6db7dc4ad3a33bc51bb Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 17 Sep 2019 16:53:18 -0700 Subject: Moved NDEBUG guards to H5EA_DEBUG in H5EA package. --- configure.ac | 4 ++-- src/CMakeLists.txt | 8 ++++---- src/H5EA.c | 4 ++-- src/H5EAcache.c | 20 -------------------- src/H5EAhdr.c | 12 ++++++------ src/H5EAprivate.h | 4 ++-- src/H5EAtest.c | 4 ++-- 7 files changed, 18 insertions(+), 38 deletions(-) diff --git a/configure.ac b/configure.ac index e119e0a..b4308f6 100644 --- a/configure.ac +++ b/configure.ac @@ -2280,8 +2280,8 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT]) ## too specialized or have huge performance hits. These ## are not listed in the "all" packages list. ## -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" +## all_packages="AC,B,B2,D,EA,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +all_packages="AC,B2,CX,D,EA,F,HL,I,O,S,ST,T,Z" case "X-$INTERNAL_DEBUG_OUTPUT" in X-yes|X-all) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6df8af3..26a3c26 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1115,8 +1115,8 @@ if (BUILD_SHARED_LIBS) set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) endif () -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" +## all_packages="AC,B,B2,D,EA,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +#all_packages="AC,B2,CX,D,EA,F,HL,I,O,S,ST,T,Z" option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) #----------------------------------------------------------------------------- @@ -1137,7 +1137,7 @@ if (NOT ONLY_SHARED_LIBS) ${HDF_EXTRA_FLAGS} PRIVATE $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5EA_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -1175,7 +1175,7 @@ if (BUILD_SHARED_LIBS) PRIVATE $<$:H5_HAVE_THREADSAFE> $<$:H5_DEBUG_API> # Enable tracing of the API - $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5EA_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} diff --git a/src/H5EA.c b/src/H5EA.c index 96eee12..604df5d 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -877,7 +877,7 @@ H5EA_close(H5EA_t *ea)) if(pending_delete) { H5EA_hdr_t *hdr; /* Another pointer to extensible array header */ -#ifndef NDEBUG +#ifdef H5EA_DEBUG { unsigned hdr_status = 0; /* Header's status in the metadata cache */ @@ -890,7 +890,7 @@ H5EA_close(H5EA_t *ea)) HDassert(hdr_status & H5AC_ES__IS_PINNED); HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); } -#endif /* NDEBUG */ +#endif /* H5EA_DEBUG */ /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ diff --git a/src/H5EAcache.c b/src/H5EAcache.c index da67e6b..d55a2b4 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -581,11 +581,7 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ } /* end if */ else @@ -978,11 +974,7 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1390,11 +1382,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -1803,11 +1791,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH @@ -2184,11 +2168,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing)) break; default: -#ifdef NDEBUG H5E_THROW(H5E_BADVALUE, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ } /* end switch */ CATCH diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index ec40298..8a2e1d1 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -49,10 +49,10 @@ /* Local Macros */ /****************/ -#ifndef NDEBUG +#ifdef H5EA_DEBUG /* Max. # of bits for max. nelmts index */ #define H5EA_MAX_NELMTS_IDX_MAX 64 -#endif /* NDEBUG */ +#endif /* H5EA_DEBUG */ /* # of elements in a data block for a particular super block */ #define H5EA_SBLK_DBLK_NELMTS(s, m) \ @@ -366,7 +366,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) HDassert(f); HDassert(cparam); -#ifndef NDEBUG +#ifdef H5EA_DEBUG { unsigned sblk_idx; /* Super block index for first "actual" super block */ size_t dblk_nelmts; /* Number of data block elements */ @@ -398,7 +398,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) if(cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) H5E_THROW(H5E_BADVALUE, "max. # of elements per data block page bits must be <= max. # of elements bits") } -#endif /* NDEBUG */ +#endif /* H5EA_DEBUG */ /* Allocate space for the shared information */ if(NULL == (hdr = H5EA__hdr_alloc(f))) @@ -724,7 +724,7 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr)) HDassert(hdr); HDassert(!hdr->file_rc); -#ifndef NDEBUG +#ifdef H5EA_DEBUG { unsigned hdr_status = 0; /* Array header's status in the metadata cache */ @@ -736,7 +736,7 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr)) HDassert(hdr_status & H5AC_ES__IN_CACHE); HDassert(hdr_status & H5AC_ES__IS_PROTECTED); } /* end block */ -#endif /* NDEBUG */ +#endif /* H5EA_DEBUG */ /* Check for index block */ if(H5F_addr_defined(hdr->idx_blk_addr)) { diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 1195256..6067ed0 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -150,8 +150,8 @@ H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); /* Debugging routines */ -#ifdef H5EA_DEBUGGING -#endif /* H5EA_DEBUGGING */ +#ifdef H5EA_DEBUG +#endif /* H5EA_DEBUG */ #endif /* _H5EAprivate_H */ diff --git a/src/H5EAtest.c b/src/H5EAtest.c index 814e64f..b7064de 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -282,9 +282,9 @@ herr_t, SUCCEED, -, H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) /* Local variables */ -#ifndef NDEBUG +#ifdef H5EA_DEBUG H5EA__test_ctx_t *ctx = (H5EA__test_ctx_t *)_ctx; /* Callback context to destroy */ -#endif /* NDEBUG */ +#endif /* H5EA_DEBUG */ uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ -- cgit v0.12 From 624d5d9a8e27fdad93208821d1cd7f535d2ca61a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 11:04:09 -0500 Subject: HDFFV-10740 - skip copying dirs in for loops --- test/test_usecases.sh.in | 31 ++++++++++++++++++++----------- test/testflushrefresh.sh.in | 25 ++++++++++++++++--------- test/testswmr.sh.in | 11 +++++++---- test/testvdsswmr.sh.in | 13 +++++++++++-- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index 8bc2078..49868ca 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -40,7 +40,7 @@ fi # Define symbols EXIT_SUCCESS=0 EXIT_FAILURE=1 -EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed +EXIT_VALUE=$EXIT_SUCCESS # Default all tests succeed RESULT_PASSED=" PASSED" RESULT_FAILED="*FAILED*" RESULT_SKIP="-SKIP-" @@ -97,17 +97,17 @@ TOOLTEST() { cat $actual_err >> $actual if [ $exit_code -eq 0 ];then - echo "$RESULT_PASSED" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_PASSED" + test yes = "$verbose" && sed 's/^/ /' < $actual else - echo "$RESULT_FAILED" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && sed 's/^/ /' < $actual + echo "$RESULT_FAILED" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && sed 's/^/ /' < $actual fi # Clean up output file if test -z "$HDF5_NOCLEANUP"; then - rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext + rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext fi } @@ -122,7 +122,9 @@ for FILE in use_*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE usecases_test + if test -f "$FILE" ; then + cp $FILE usecases_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -131,7 +133,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/use_append_chunk ]; then mkdir usecases_test/.libs - cp .libs/use_* usecases_test/.libs + for FILE in .libs/use_*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE usecases_test/.libs + fi + done cp .libs/twriteorder usecases_test/.libs fi @@ -176,10 +185,10 @@ for p in $USECASES_PROGRAMS; do TOOLTEST ./$p -l w TOOLTEST ./$p -l r # use case 1.9, testing with multi-planes chunks - TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks + TOOLTEST ./$p -z 256 -y 5 # 5 planes chunks # cleanup temp datafile if test -z "$HDF5_NOCLEANUP"; then - rm -f $p.h5 + rm -f $p.h5 fi done diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index ca46dcb..3cdf10f 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -20,7 +20,7 @@ # the verification of this feature needs to occur in separate processes # from the one in which the file is being manipulated in. (i.e., we have # a single writer process, and various reader processes spawning off -# and doing the verification that individual objects are being +# and doing the verification that individual objects are being # correctly flushed). # # Programmer: @@ -80,23 +80,30 @@ fi # HDF5 has several tests that create and delete signal files to communicate # between processes, and it seems that even though the names of the files are # different, occasionally the wrong file is deleted, interrupting the flow of -# the test. Running each of these tests in its own directory should eliminate +# the test. Running each of these tests in its own directory should eliminate # the problem. mkdir flushrefresh_test cp flushrefresh flushrefresh_test # With the --disable-shared option, flushrefresh is built in the test directory, -# otherwise it is in test/.libs with a wrapper script named flushrefresh in -# the test directory. test/flushrefresh should always be copied, +# otherwise it is in test/.libs with a wrapper script named flushrefresh in +# the test directory. test/flushrefresh should always be copied, # .libs/flushrefresh should be copied only if it exists. if [ -f .libs/flushrefresh ]; then mkdir flushrefresh_test/.libs - cp .libs/flushrefresh flushrefresh_test/.libs + for FILE in .libs/flushrefresh*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE flushrefresh_test/.libs + fi + done fi cd flushrefresh_test # ================================================= -# Set up/initialize some variables to be used later +# Set up/initialize some variables to be used later # ================================================= testfile=flushrefresh.h5 startsignal=flushrefresh_VERIFICATION_START @@ -119,13 +126,13 @@ pid_main=$! # ======================================= until [ $verification_done -eq 1 ]; do - + # Wait for signal from test program that verification routine can run. before=`TimeStamp` until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break @@ -165,7 +172,7 @@ if [ $timedout -eq 0 ]; then until [ -s $startsignal ]; do after=`TimeStamp` timediff=`expr $after - $before` - if [ $timediff -gt $timeout_length ]; then + if [ $timediff -gt $timeout_length ]; then nerrors=`expr $nerrors + 1` timedout=1 break diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index f81a7d7..a41947e 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -131,9 +131,10 @@ for FILE in swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test + if test -f "$FILE" ; then + cp $FILE swmr_test + fi done -cp swmr* swmr_test # With the --disable-shared option, swmr program files are built in the test # directory, otherwise they are in test/.libs with a corresponding wrapper @@ -145,7 +146,9 @@ if [ -f .libs/swmr ]; then case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE swmr_test/.libs + if test -f "$FILE" ; then + cp $FILE swmr_test/.libs + fi done fi @@ -153,7 +156,7 @@ cd swmr_test # Loop over index types -for index_type in "-i ea" "-i b2" +for index_type in "-i ea" "-i b2" do # Try with and without compression for compress in "" "-c 5" diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index 32af072..28abcf5 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -117,7 +117,9 @@ for FILE in vds_swmr*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files esac - cp $FILE vds_swmr_test + if test -f "$FILE" ; then + cp $FILE vds_swmr_test + fi done # With the --disable-shared option, swmr program files are built in the test @@ -126,7 +128,14 @@ done # always be copied, swmr files in .libs should be copied only if they exists. if [ -f .libs/vds_swmr_writer ]; then mkdir vds_swmr_test/.libs - cp .libs/vds_swmr* vds_swmr_test/.libs + for FILE in .libs/vds_swmr*; do + case "$FILE" in + *.o) continue ;; ## don't copy the .o files + esac + if test -f "$FILE" ; then + cp $FILE vds_swmr_test/.libs + fi + done fi cd vds_swmr_test -- cgit v0.12 From 4775b6a3d9f6cd9be4865897d7ab8301222a076b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 11:15:58 -0500 Subject: Add missing HD prefix --- tools/test/perform/sio_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index ff9e2b4..90030d8 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -1423,6 +1423,6 @@ usage(const char *prog) HDprintf(" HDF5_NOCLEANUP Do not remove data files if set [default remove]\n"); HDprintf(" HDF5_PREFIX Data file prefix\n"); HDprintf("\n"); - fflush(stdout); + HDfflush(stdout); } /* end usage() */ -- cgit v0.12 From 6f34503a5a93ae1ba97d35475643fac1ef70447e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Sep 2019 12:11:12 -0500 Subject: Whitespace cleanup --- c++/examples/chunks.cpp | 338 ++++++++++++------------- c++/examples/compound.cpp | 16 +- c++/examples/create.cpp | 12 +- c++/examples/extend_ds.cpp | 24 +- c++/examples/h5group.cpp | 288 +++++++++++----------- c++/examples/h5tutr_cmprss.cpp | 196 +++++++-------- c++/examples/h5tutr_crtatt.cpp | 58 ++--- c++/examples/h5tutr_crtdat.cpp | 55 +++-- c++/examples/h5tutr_crtgrp.cpp | 34 +-- c++/examples/h5tutr_crtgrpar.cpp | 54 ++-- c++/examples/h5tutr_crtgrpd.cpp | 136 +++++----- c++/examples/h5tutr_extend.cpp | 218 ++++++++-------- c++/examples/h5tutr_rdwt.cpp | 48 ++-- c++/examples/h5tutr_subset.cpp | 192 +++++++-------- c++/examples/readdata.cpp | 36 +-- c++/examples/writedata.cpp | 518 +++++++++++++++++++-------------------- 16 files changed, 1112 insertions(+), 1111 deletions(-) diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 142e70f..03e2855 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -37,194 +37,194 @@ const int RANKC = 1; int main (void) { - hsize_t i, j; + hsize_t i, j; // Try block to detect exceptions raised by any of the calls inside it try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Open the file and the dataset. - */ - H5File file( FILE_NAME, H5F_ACC_RDONLY ); - DataSet dataset = file.openDataSet( DATASET_NAME ); - - /* - * Get filespace for rank and dimension - */ - DataSpace filespace = dataset.getSpace(); - - /* - * Get number of dimensions in the file dataspace - */ - int rank = filespace.getSimpleExtentNdims(); - - /* - * Get and print the dimension sizes of the file dataspace - */ - hsize_t dims[2]; // dataset dimensions - rank = filespace.getSimpleExtentDims( dims ); - cout << "dataset rank = " << rank << ", dimensions " - << (unsigned long)(dims[0]) << " x " - << (unsigned long)(dims[1]) << endl; - - /* - * Define the memory space to read dataset. - */ - DataSpace mspace1(RANK, dims); - - /* - * Read dataset back and display. - */ - int data_out[NX][NY]; // buffer for dataset to be read - dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace ); - - cout << "\n"; - cout << "Dataset: \n"; - for (j = 0; j < dims[0]; j++) - { - for (i = 0; i < dims[1]; i++) - cout << data_out[j][i] << " "; - cout << endl; - } - - /* - * dataset rank 2, dimensions 10 x 5 - * chunk rank 2, dimensions 2 x 5 - - * Dataset: - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - */ - - /* - * Read the third column from the dataset. - * First define memory dataspace, then define hyperslab - * and read it into column array. - */ - hsize_t col_dims[1]; - col_dims[0] = 10; - DataSpace mspace2( RANKC, col_dims ); - - /* - * Define the column (hyperslab) to read. - */ - hsize_t offset[2] = { 0, 2 }; - hsize_t count[2] = { 10, 1 }; - int column[10]; // buffer for column to be read - - /* - * Define hyperslab and read. - */ - filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); - dataset.read( column, PredType::NATIVE_INT, mspace2, filespace ); - - cout << endl; - cout << "Third column: " << endl; - for (i = 0; i < 10; i++) - cout << column[i] << endl; - - /* - * Third column: - * 1 - * 1 - * 1 - * 0 - * 0 - * 0 - * 0 - * 0 - * 0 - * 0 - */ - - /* - * Get creation properties list. - */ - DSetCreatPropList cparms = dataset.getCreatePlist(); - - /* - * Check if dataset is chunked. - */ - hsize_t chunk_dims[2]; - int rank_chunk; - if( H5D_CHUNKED == cparms.getLayout() ) - { - /* - * Get chunking information: rank and dimensions - */ - rank_chunk = cparms.getChunk( 2, chunk_dims); - cout << "chunk rank " << rank_chunk << "dimensions " - << (unsigned long)(chunk_dims[0]) << " x " - << (unsigned long)(chunk_dims[1]) << endl; - - /* - * Define the memory space to read a chunk. - */ - DataSpace mspace3( rank_chunk, chunk_dims ); - - /* - * Define chunk in the file (hyperslab) to read. - */ - offset[0] = 2; - offset[1] = 0; - count[0] = chunk_dims[0]; - count[1] = chunk_dims[1]; - filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); - - /* - * Read chunk back and display. - */ - int chunk_out[2][5]; // buffer for chunk to be read - dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace ); - cout << endl; - cout << "Chunk:" << endl; - for (j = 0; j < chunk_dims[0]; j++) - { - for (i = 0; i < chunk_dims[1]; i++) - cout << chunk_out[j][i] << " "; - cout << endl; - } - /* - * Chunk: - * 1 1 1 0 0 - * 2 0 0 0 0 - */ - } + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Open the file and the dataset. + */ + H5File file( FILE_NAME, H5F_ACC_RDONLY ); + DataSet dataset = file.openDataSet( DATASET_NAME ); + + /* + * Get filespace for rank and dimension + */ + DataSpace filespace = dataset.getSpace(); + + /* + * Get number of dimensions in the file dataspace + */ + int rank = filespace.getSimpleExtentNdims(); + + /* + * Get and print the dimension sizes of the file dataspace + */ + hsize_t dims[2]; // dataset dimensions + rank = filespace.getSimpleExtentDims( dims ); + cout << "dataset rank = " << rank << ", dimensions " + << (unsigned long)(dims[0]) << " x " + << (unsigned long)(dims[1]) << endl; + + /* + * Define the memory space to read dataset. + */ + DataSpace mspace1(RANK, dims); + + /* + * Read dataset back and display. + */ + int data_out[NX][NY]; // buffer for dataset to be read + dataset.read( data_out, PredType::NATIVE_INT, mspace1, filespace ); + + cout << "\n"; + cout << "Dataset: \n"; + for (j = 0; j < dims[0]; j++) + { + for (i = 0; i < dims[1]; i++) + cout << data_out[j][i] << " "; + cout << endl; + } + + /* + * dataset rank 2, dimensions 10 x 5 + * chunk rank 2, dimensions 2 x 5 + + * Dataset: + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + */ + + /* + * Read the third column from the dataset. + * First define memory dataspace, then define hyperslab + * and read it into column array. + */ + hsize_t col_dims[1]; + col_dims[0] = 10; + DataSpace mspace2( RANKC, col_dims ); + + /* + * Define the column (hyperslab) to read. + */ + hsize_t offset[2] = { 0, 2 }; + hsize_t count[2] = { 10, 1 }; + int column[10]; // buffer for column to be read + + /* + * Define hyperslab and read. + */ + filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); + dataset.read( column, PredType::NATIVE_INT, mspace2, filespace ); + + cout << endl; + cout << "Third column: " << endl; + for (i = 0; i < 10; i++) + cout << column[i] << endl; + + /* + * Third column: + * 1 + * 1 + * 1 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + * 0 + */ + + /* + * Get creation properties list. + */ + DSetCreatPropList cparms = dataset.getCreatePlist(); + + /* + * Check if dataset is chunked. + */ + hsize_t chunk_dims[2]; + int rank_chunk; + if( H5D_CHUNKED == cparms.getLayout() ) + { + /* + * Get chunking information: rank and dimensions + */ + rank_chunk = cparms.getChunk( 2, chunk_dims); + cout << "chunk rank " << rank_chunk << "dimensions " + << (unsigned long)(chunk_dims[0]) << " x " + << (unsigned long)(chunk_dims[1]) << endl; + + /* + * Define the memory space to read a chunk. + */ + DataSpace mspace3( rank_chunk, chunk_dims ); + + /* + * Define chunk in the file (hyperslab) to read. + */ + offset[0] = 2; + offset[1] = 0; + count[0] = chunk_dims[0]; + count[1] = chunk_dims[1]; + filespace.selectHyperslab( H5S_SELECT_SET, count, offset ); + + /* + * Read chunk back and display. + */ + int chunk_out[2][5]; // buffer for chunk to be read + dataset.read( chunk_out, PredType::NATIVE_INT, mspace3, filespace ); + cout << endl; + cout << "Chunk:" << endl; + for (j = 0; j < chunk_dims[0]; j++) + { + for (i = 0; i < chunk_dims[1]; i++) + cout << chunk_out[j][i] << " "; + cout << endl; + } + /* + * Chunk: + * 1 1 1 0 0 + * 2 0 0 0 0 + */ + } } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; } diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp index 192a1cf..4b116e0 100644 --- a/c++/examples/compound.cpp +++ b/c++/examples/compound.cpp @@ -41,15 +41,15 @@ int main(void) { /* First structure and dataset*/ typedef struct s1_t { - int a; - float b; - double c; + int a; + float b; + double c; } s1_t; /* Second structure (subset of s1_t) and dataset*/ typedef struct s2_t { - double c; - int a; + double c; + int a; } s2_t; // Try block to detect exceptions raised by any of the calls inside it @@ -135,12 +135,12 @@ int main(void) */ cout << endl << "Field c : " << endl; for( i = 0; i < LENGTH; i++) - cout << s2[i].c << " "; + cout << s2[i].c << " "; cout << endl; cout << endl << "Field a : " << endl; for( i = 0; i < LENGTH; i++) - cout << s2[i].a << " "; + cout << s2[i].a << " "; cout << endl; /* @@ -161,7 +161,7 @@ int main(void) */ cout << endl << "Field b : " << endl; for( i = 0; i < LENGTH; i++) - cout << s3[i] << " "; + cout << s3[i] << " "; cout << endl; /* diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp index 890fb03..06b981b 100644 --- a/c++/examples/create.cpp +++ b/c++/examples/create.cpp @@ -25,11 +25,11 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME( "SDS.h5" ); -const H5std_string DATASET_NAME( "IntArray" ); -const int NX = 5; // dataset dimensions -const int NY = 6; -const int RANK = 2; +const H5std_string FILE_NAME( "SDS.h5" ); +const H5std_string DATASET_NAME( "IntArray" ); +const int NX = 5; // dataset dimensions +const int NY = 6; +const int RANK = 2; int main (void) { @@ -41,7 +41,7 @@ int main (void) for (j = 0; j < NX; j++) { for (i = 0; i < NY; i++) - data[j][i] = i + j; + data[j][i] = i + j; } /* * 0 1 2 3 4 5 diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index 271100e..9e005c6 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -105,8 +105,8 @@ int main (void) * Write the data to the hyperslab. */ int data1[3][3] = { {1, 1, 1}, /* data to write */ - {1, 1, 1}, - {1, 1, 1} }; + {1, 1, 1}, + {1, 1, 1} }; dataset.write( data1, PredType::NATIVE_INT, mspace1, fspace1 ); /* @@ -179,16 +179,16 @@ int main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 - * 2 0 0 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 + * 2 0 0 0 0 */ /* * Display the result. diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index a8c9953..fab54cd 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -33,7 +33,7 @@ using std::endl; using namespace H5; const H5std_string FILE_NAME( "Group.h5" ); -const int RANK = 2; +const int RANK = 2; // Operator function extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, @@ -48,169 +48,169 @@ int main(void) // Try block to detect exceptions raised by any of the calls inside it try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Create the named file, truncating the existing one if any, - * using default create and access property lists. - */ - H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); - - /* - * Create a group in the file - */ - Group* group = new Group( file->createGroup( "/Data" )); - - /* - * Create dataset "Compressed Data" in the group using absolute - * name. Dataset creation property list is modified to use - * GZIP compression with the compression effort set to 6. - * Note that compression can be used only when dataset is chunked. - */ - dims[0] = 1000; - dims[1] = 20; - cdims[0] = 20; - cdims[1] = 20; - DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace - DSetCreatPropList ds_creatplist; // create dataset creation prop list - ds_creatplist.setChunk( 2, cdims ); // then modify it for compression - ds_creatplist.setDeflate( 6 ); - - /* - * Create the first dataset. - */ - DataSet* dataset = new DataSet(file->createDataSet( - "/Data/Compressed_Data", PredType::NATIVE_INT, - *dataspace, ds_creatplist )); - - /* - * Close the first dataset. - */ - delete dataset; - delete dataspace; - - /* - * Create the second dataset. - */ - dims[0] = 500; - dims[1] = 20; - dataspace = new DataSpace(RANK, dims); // create second dspace - dataset = new DataSet(file->createDataSet("/Data/Float_Data", - PredType::NATIVE_FLOAT, *dataspace)); - - delete dataset; - delete dataspace; - delete group; - delete file; - - /* - * Now reopen the file and group in the file. - */ - file = new H5File(FILE_NAME, H5F_ACC_RDWR); - group = new Group(file->openGroup("Data")); - - /* - * Access "Compressed_Data" dataset in the group. - */ - try { // to determine if the dataset exists in the group - dataset = new DataSet( group->openDataSet( "Compressed_Data" )); - } - catch( GroupIException not_found_error ) { - cout << " Dataset is not found." << endl; - } - cout << "dataset \"/Data/Compressed_Data\" is open" << endl; - - /* - * Close the dataset. - */ - delete dataset; - - /* - * Create hard link to the Data group. - */ - file->link( H5L_TYPE_HARD, "Data", "Data_new" ); - - /* - * We can access "Compressed_Data" dataset using created - * hard link "Data_new". - */ - try { // to determine if the dataset exists in the file - dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" )); - } - catch( FileIException not_found_error ) - { - cout << " Dataset is not found." << endl; - } - cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl; - - /* - * Close the dataset. - */ - delete dataset; - - /* - * Use iterator to see the names of the objects in the file - * root directory. - */ - cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); - cout << endl; - - /* - * Unlink name "Data" and use iterator to see the names - * of the objects in the file root direvtory. - */ - cout << "Unlinking..." << endl; - try { // attempt to unlink the dataset - file->unlink( "Data" ); - } - catch( FileIException unlink_error ) - { - cout << " unlink failed." << endl; - } - cout << "\"Data\" is unlinked" << endl; - - cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); - cout << endl; - - /* - * Close the group and file. - */ - delete group; - delete file; + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Create the named file, truncating the existing one if any, + * using default create and access property lists. + */ + H5File *file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); + + /* + * Create a group in the file + */ + Group* group = new Group( file->createGroup( "/Data" )); + + /* + * Create dataset "Compressed Data" in the group using absolute + * name. Dataset creation property list is modified to use + * GZIP compression with the compression effort set to 6. + * Note that compression can be used only when dataset is chunked. + */ + dims[0] = 1000; + dims[1] = 20; + cdims[0] = 20; + cdims[1] = 20; + DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace + DSetCreatPropList ds_creatplist; // create dataset creation prop list + ds_creatplist.setChunk( 2, cdims ); // then modify it for compression + ds_creatplist.setDeflate( 6 ); + + /* + * Create the first dataset. + */ + DataSet* dataset = new DataSet(file->createDataSet( + "/Data/Compressed_Data", PredType::NATIVE_INT, + *dataspace, ds_creatplist )); + + /* + * Close the first dataset. + */ + delete dataset; + delete dataspace; + + /* + * Create the second dataset. + */ + dims[0] = 500; + dims[1] = 20; + dataspace = new DataSpace(RANK, dims); // create second dspace + dataset = new DataSet(file->createDataSet("/Data/Float_Data", + PredType::NATIVE_FLOAT, *dataspace)); + + delete dataset; + delete dataspace; + delete group; + delete file; + + /* + * Now reopen the file and group in the file. + */ + file = new H5File(FILE_NAME, H5F_ACC_RDWR); + group = new Group(file->openGroup("Data")); + + /* + * Access "Compressed_Data" dataset in the group. + */ + try { // to determine if the dataset exists in the group + dataset = new DataSet( group->openDataSet( "Compressed_Data" )); + } + catch( GroupIException not_found_error ) { + cout << " Dataset is not found." << endl; + } + cout << "dataset \"/Data/Compressed_Data\" is open" << endl; + + /* + * Close the dataset. + */ + delete dataset; + + /* + * Create hard link to the Data group. + */ + file->link( H5L_TYPE_HARD, "Data", "Data_new" ); + + /* + * We can access "Compressed_Data" dataset using created + * hard link "Data_new". + */ + try { // to determine if the dataset exists in the file + dataset = new DataSet(file->openDataSet( "/Data_new/Compressed_Data" )); + } + catch( FileIException not_found_error ) + { + cout << " Dataset is not found." << endl; + } + cout << "dataset \"/Data_new/Compressed_Data\" is open" << endl; + + /* + * Close the dataset. + */ + delete dataset; + + /* + * Use iterator to see the names of the objects in the file + * root directory. + */ + cout << endl << "Iterating over elements in the file" << endl; + herr_t idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + cout << endl; + + /* + * Unlink name "Data" and use iterator to see the names + * of the objects in the file root direvtory. + */ + cout << "Unlinking..." << endl; + try { // attempt to unlink the dataset + file->unlink( "Data" ); + } + catch( FileIException unlink_error ) + { + cout << " unlink failed." << endl; + } + cout << "\"Data\" is unlinked" << endl; + + cout << endl << "Iterating over elements in the file again" << endl; + idx = H5Literate(file->getId(), H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + cout << endl; + + /* + * Close the group and file. + */ + delete group; + delete file; } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Attribute operations catch( AttributeIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; } diff --git a/c++/examples/h5tutr_cmprss.cpp b/c++/examples/h5tutr_cmprss.cpp index 9b1d2bc..9531bdd 100644 --- a/c++/examples/h5tutr_cmprss.cpp +++ b/c++/examples/h5tutr_cmprss.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -24,130 +24,130 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_cmprss.h5"); -const H5std_string DATASET_NAME("Compressed_Data"); -const int DIM0 = 100; -const int DIM1 = 20; +const H5std_string FILE_NAME("h5tutr_cmprss.h5"); +const H5std_string DATASET_NAME("Compressed_Data"); +const int DIM0 = 100; +const int DIM1 = 20; int main (void) { - hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions - hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions + hsize_t dims[2] = { DIM0, DIM1 }; // dataset dimensions + hsize_t chunk_dims[2] = { 20, 20 }; // chunk dimensions int i,j, buf[DIM0][DIM1]; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create the data space for the dataset. - DataSpace *dataspace = new DataSpace(2, dims); + // Create the data space for the dataset. + DataSpace *dataspace = new DataSpace(2, dims); - // Modify dataset creation property to enable chunking - DSetCreatPropList *plist = new DSetCreatPropList; - plist->setChunk(2, chunk_dims); + // Modify dataset creation property to enable chunking + DSetCreatPropList *plist = new DSetCreatPropList; + plist->setChunk(2, chunk_dims); - // Set ZLIB (DEFLATE) Compression using level 6. - // To use SZIP compression comment out this line. - plist->setDeflate(6); + // Set ZLIB (DEFLATE) Compression using level 6. + // To use SZIP compression comment out this line. + plist->setDeflate(6); - // Uncomment these lines to set SZIP Compression - // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; - // unsigned szip_pixels_per_block = 16; - // plist->setSzip(szip_options_mask, szip_pixels_per_block); + // Uncomment these lines to set SZIP Compression + // unsigned szip_options_mask = H5_SZIP_NN_OPTION_MASK; + // unsigned szip_pixels_per_block = 16; + // plist->setSzip(szip_options_mask, szip_pixels_per_block); - // Create the dataset. - DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, - PredType::STD_I32BE, *dataspace, *plist) ); - - for (i = 0; i< DIM0; i++) - for (j=0; jwrite(buf, PredType::NATIVE_INT); - - // Close objects and file. Either approach will close the HDF5 item. - delete dataspace; - delete dataset; - delete plist; - file.close(); - - // ----------------------------------------------- - // Re-open the file and dataset, retrieve filter - // information for dataset and read the data back. - // ----------------------------------------------- - - int rbuf[DIM0][DIM1]; - int numfilt; - size_t nelmts={1}, namelen={1}; - unsigned flags, filter_info, cd_values[1], idx; - char name[1]; - H5Z_filter_t filter_type; - - // Open the file and the dataset in the file. - file.openFile(FILE_NAME, H5F_ACC_RDONLY); - dataset = new DataSet(file.openDataSet( DATASET_NAME)); - - // Get the create property list of the dataset. - plist = new DSetCreatPropList(dataset->getCreatePlist ()); - - // Get the number of filters associated with the dataset. - numfilt = plist->getNfilters(); - cout << "Number of filters associated with dataset: " << numfilt << endl; - - for (idx=0; idx < numfilt; idx++) { - nelmts = 0; - - filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); - - cout << "Filter Type: "; - - switch (filter_type) { - case H5Z_FILTER_DEFLATE: - cout << "H5Z_FILTER_DEFLATE" << endl; - break; - case H5Z_FILTER_SZIP: - cout << "H5Z_FILTER_SZIP" << endl; - break; - default: - cout << "Other filter type included." << endl; - } - } - - // Read data. - dataset->read(rbuf, PredType::NATIVE_INT); - - delete plist; - delete dataset; - file.close(); // can be skipped + // Create the dataset. + DataSet *dataset = new DataSet(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, *dataspace, *plist) ); + + for (i = 0; i< DIM0; i++) + for (j=0; jwrite(buf, PredType::NATIVE_INT); + + // Close objects and file. Either approach will close the HDF5 item. + delete dataspace; + delete dataset; + delete plist; + file.close(); + + // ----------------------------------------------- + // Re-open the file and dataset, retrieve filter + // information for dataset and read the data back. + // ----------------------------------------------- + + int rbuf[DIM0][DIM1]; + int numfilt; + size_t nelmts={1}, namelen={1}; + unsigned flags, filter_info, cd_values[1], idx; + char name[1]; + H5Z_filter_t filter_type; + + // Open the file and the dataset in the file. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASET_NAME)); + + // Get the create property list of the dataset. + plist = new DSetCreatPropList(dataset->getCreatePlist ()); + + // Get the number of filters associated with the dataset. + numfilt = plist->getNfilters(); + cout << "Number of filters associated with dataset: " << numfilt << endl; + + for (idx=0; idx < numfilt; idx++) { + nelmts = 0; + + filter_type = plist->getFilter(idx, flags, nelmts, cd_values, namelen, name , filter_info); + + cout << "Filter Type: "; + + switch (filter_type) { + case H5Z_FILTER_DEFLATE: + cout << "H5Z_FILTER_DEFLATE" << endl; + break; + case H5Z_FILTER_SZIP: + cout << "H5Z_FILTER_SZIP" << endl; + break; + default: + cout << "Other filter type included." << endl; + } + } + + // Read data. + dataset->read(rbuf, PredType::NATIVE_INT); + + delete plist; + delete dataset; + file.close(); // can be skipped } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtatt.cpp b/c++/examples/h5tutr_crtatt.cpp index f865501..fcf6c27 100644 --- a/c++/examples/h5tutr_crtatt.cpp +++ b/c++/examples/h5tutr_crtatt.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -21,11 +21,11 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME( "h5tutr_dset.h5" ); -const H5std_string DATASET_NAME( "dset" ); -const H5std_string ATTR_NAME( "Units" ); +const H5std_string FILE_NAME( "h5tutr_dset.h5" ); +const H5std_string DATASET_NAME( "dset" ); +const H5std_string ATTR_NAME( "Units" ); -const int DIM1 = 2; +const int DIM1 = 2; int main (void) { @@ -36,52 +36,52 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Open an existing file and dataset. - H5File file( FILE_NAME, H5F_ACC_RDWR ); - DataSet dataset = file.openDataSet( DATASET_NAME ); + // Open an existing file and dataset. + H5File file( FILE_NAME, H5F_ACC_RDWR ); + DataSet dataset = file.openDataSet( DATASET_NAME ); - // Create the data space for the attribute. - DataSpace attr_dataspace = DataSpace (1, dims ); + // Create the data space for the attribute. + DataSpace attr_dataspace = DataSpace (1, dims ); - // Create a dataset attribute. - Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, - attr_dataspace); + // Create a dataset attribute. + Attribute attribute = dataset.createAttribute( ATTR_NAME, PredType::STD_I32BE, + attr_dataspace); - // Write the attribute data. - attribute.write( PredType::NATIVE_INT, attr_data); + // Write the attribute data. + attribute.write( PredType::NATIVE_INT, attr_data); } // end of try block // catch failure caused by the H5File operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the H5File operations catch( AttributeIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtdat.cpp b/c++/examples/h5tutr_crtdat.cpp index 7cd49f8..985f6ac 100644 --- a/c++/examples/h5tutr_crtdat.cpp +++ b/c++/examples/h5tutr_crtdat.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -18,57 +18,58 @@ #include #include + #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_dset.h5"); -const H5std_string DATASET_NAME("dset"); -const int NX = 4; // dataset dimensions -const int NY = 6; -const int RANK = 2; +const H5std_string FILE_NAME("h5tutr_dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int NX = 4; // dataset dimensions +const int NY = 6; +const int RANK = 2; int main (void) { // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create the data space for the dataset. - hsize_t dims[2]; // dataset dimensions - dims[0] = NX; - dims[1] = NY; - DataSpace dataspace(RANK, dims); + // Create the data space for the dataset. + hsize_t dims[2]; // dataset dimensions + dims[0] = NX; + dims[1] = NY; + DataSpace dataspace(RANK, dims); - // Create the dataset. - DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); + // Create the dataset. + DataSet dataset = file.createDataSet(DATASET_NAME, PredType::STD_I32BE, dataspace); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_crtgrp.cpp b/c++/examples/h5tutr_crtgrp.cpp index 4bdb02c..e35cb46 100644 --- a/c++/examples/h5tutr_crtgrp.cpp +++ b/c++/examples/h5tutr_crtgrp.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -31,31 +31,31 @@ int main(void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Create a new file using default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); - - // Create a group named "/MygGroup" in the file - Group group(file.createGroup("/MyGroup")); + // Create a new file using default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create a group named "/MygGroup" in the file + Group group(file.createGroup("/MyGroup")); - // File and group will be closed as their instances go out of scope. + // File and group will be closed as their instances go out of scope. } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_crtgrpar.cpp b/c++/examples/h5tutr_crtgrpar.cpp index 3e175d6..76ec9e5 100644 --- a/c++/examples/h5tutr_crtgrpar.cpp +++ b/c++/examples/h5tutr_crtgrpar.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -33,50 +33,50 @@ int main(void) try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately. + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately. - Exception::dontPrint(); + Exception::dontPrint(); - // Create a new file using default properties. + // Create a new file using default properties. - H5File file(FILE_NAME, H5F_ACC_TRUNC); + H5File file(FILE_NAME, H5F_ACC_TRUNC); - // Create group "MyGroup" in the root group using an absolute name. - - Group group1(file.createGroup( "/MyGroup")); + // Create group "MyGroup" in the root group using an absolute name. + + Group group1(file.createGroup( "/MyGroup")); - // Create group "Group_A" in group "MyGroup" using an - // absolute name. + // Create group "Group_A" in group "MyGroup" using an + // absolute name. - Group group2(file.createGroup("/MyGroup/Group_A")); + Group group2(file.createGroup("/MyGroup/Group_A")); - // Create group "Group_B" in group "MyGroup" using a - // relative name. + // Create group "Group_B" in group "MyGroup" using a + // relative name. - Group group3(group1.createGroup ("Group_B")); + Group group3(group1.createGroup ("Group_B")); - // Close the groups and file. + // Close the groups and file. - group1.close(); - group2.close(); - group3.close(); - file.close(); + group1.close(); + group2.close(); + group3.close(); + file.close(); } // end of try block // catch failure caused by the File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_crtgrpd.cpp b/c++/examples/h5tutr_crtgrpd.cpp index 318ab1c..e3bb1b1 100644 --- a/c++/examples/h5tutr_crtgrpd.cpp +++ b/c++/examples/h5tutr_crtgrpd.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -27,11 +27,11 @@ using namespace H5; const H5std_string FILE_NAME("h5tutr_groups.h5"); const H5std_string DATASET_NAME1("/MyGroup/dset1"); const H5std_string DATASET_NAME2("dset2"); -const int RANK = 2; -const int D1DIM1 = 3; -const int D1DIM2 = 3; -const int D2DIM1 = 2; -const int D2DIM2 = 10; +const int RANK = 2; +const int D1DIM1 = 3; +const int D1DIM2 = 3; +const int D2DIM1 = 2; +const int D2DIM2 = 10; int main(void) { @@ -41,93 +41,93 @@ int main(void) // Try block to catch exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Initialize the first dataset. - for (i = 0; i < D1DIM1; i++) - for (j = 0; j < D1DIM2; j++) - dset1_data[i][j] = j + 1; + // Initialize the first dataset. + for (i = 0; i < D1DIM1; i++) + for (j = 0; j < D1DIM2; j++) + dset1_data[i][j] = j + 1; - // Initialize the second dataset. - for (i = 0; i < D2DIM1; i++) - for (j = 0; j < D2DIM2; j++) - dset2_data[i][j] = j + 1; + // Initialize the second dataset. + for (i = 0; i < D2DIM1; i++) + for (j = 0; j < D2DIM2; j++) + dset2_data[i][j] = j + 1; - // Open an existing file and dataset. - H5File file(FILE_NAME, H5F_ACC_RDWR); + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); // Create the data space for the first dataset. Note the use of // pointer for the instance 'dataspace'. It can be deleted and // used again later for another data space. An HDF5 identifier is // closed by the destructor or the method 'close()'. - hsize_t dims[RANK]; // dataset dimensions - dims[0] = D1DIM1; - dims[1] = D1DIM2; - DataSpace *dataspace = new DataSpace (RANK, dims); - - // Create the dataset in group "MyGroup". Same note as for the - // dataspace above. - DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, - PredType::STD_I32BE, *dataspace)); - - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset->write(dset1_data, PredType::NATIVE_INT); - - // Close the current dataset and data space. - delete dataset; - delete dataspace; - - // Create the data space for the second dataset. - dims[0] = D2DIM1; - dims[1] = D2DIM2; - dataspace = new DataSpace (RANK, dims); - - // Create group "Group_A" in group "MyGroup". - Group group(file.openGroup("/MyGroup/Group_A")); - - // Create the second dataset in group "Group_A". - dataset = new DataSet (group.createDataSet(DATASET_NAME2, - PredType::STD_I32BE, *dataspace)); - - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset->write(dset2_data, PredType::NATIVE_INT); - - // Close all objects. - delete dataspace; - delete dataset; - group.close(); + hsize_t dims[RANK]; // dataset dimensions + dims[0] = D1DIM1; + dims[1] = D1DIM2; + DataSpace *dataspace = new DataSpace (RANK, dims); + + // Create the dataset in group "MyGroup". Same note as for the + // dataspace above. + DataSet *dataset = new DataSet (file.createDataSet(DATASET_NAME1, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset1_data, PredType::NATIVE_INT); + + // Close the current dataset and data space. + delete dataset; + delete dataspace; + + // Create the data space for the second dataset. + dims[0] = D2DIM1; + dims[1] = D2DIM2; + dataspace = new DataSpace (RANK, dims); + + // Create group "Group_A" in group "MyGroup". + Group group(file.openGroup("/MyGroup/Group_A")); + + // Create the second dataset in group "Group_A". + dataset = new DataSet (group.createDataSet(DATASET_NAME2, + PredType::STD_I32BE, *dataspace)); + + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset->write(dset2_data, PredType::NATIVE_INT); + + // Close all objects. + delete dataspace; + delete dataset; + group.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the Group operations catch(GroupIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp index 8c1bc03..b6927ea 100644 --- a/c++/examples/h5tutr_extend.cpp +++ b/c++/examples/h5tutr_extend.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -24,17 +24,17 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_extend.h5"); -const H5std_string DATASETNAME("ExtendibleArray"); +const H5std_string FILE_NAME("h5tutr_extend.h5"); +const H5std_string DATASETNAME("ExtendibleArray"); int main (void) { - hsize_t dims[2] = {3,3}; // dataset dimensions at creation + hsize_t dims[2] = {3,3}; // dataset dimensions at creation hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] ={2, 5}; - int data[3][3] = { {1, 1, 1}, // data to write - {1, 1, 1}, - {1, 1, 1} }; + int data[3][3] = { {1, 1, 1}, // data to write + {1, 1, 1}, + {1, 1, 1} }; // Variables used in extending and writing to the extended portion of dataset @@ -42,127 +42,127 @@ int main (void) hsize_t offset[2]; hsize_t dimsext[2] = {7, 3}; // extend dimensions int dataext[7][3] = { {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4}, - {2, 3, 4} }; + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4}, + {2, 3, 4} }; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); - - // Create a new file using the default property lists. - H5File file(FILE_NAME, H5F_ACC_TRUNC); - - // Create the data space for the dataset. Note the use of pointer - // for the instance 'dataspace'. It can be deleted and used again - // later for another dataspace. An HDF5 identifier can be closed - // by the destructor or the method 'close()'. - DataSpace *dataspace = new DataSpace (2, dims, maxdims); - - // Modify dataset creation property to enable chunking - DSetCreatPropList prop; - prop.setChunk(2, chunk_dims); - - // Create the chunked dataset. Note the use of pointer. - DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, - PredType::STD_I32BE, *dataspace, prop) ); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // Create a new file using the default property lists. + H5File file(FILE_NAME, H5F_ACC_TRUNC); + + // Create the data space for the dataset. Note the use of pointer + // for the instance 'dataspace'. It can be deleted and used again + // later for another dataspace. An HDF5 identifier can be closed + // by the destructor or the method 'close()'. + DataSpace *dataspace = new DataSpace (2, dims, maxdims); + + // Modify dataset creation property to enable chunking + DSetCreatPropList prop; + prop.setChunk(2, chunk_dims); + + // Create the chunked dataset. Note the use of pointer. + DataSet *dataset = new DataSet(file.createDataSet( DATASETNAME, + PredType::STD_I32BE, *dataspace, prop) ); - // Write data to dataset. - dataset->write(data, PredType::NATIVE_INT); - - // Extend the dataset. Dataset becomes 10 x 3. - size[0] = dims[0] + dimsext[0]; - size[1] = dims[1]; - dataset->extend(size); - - // Select a hyperslab in extended portion of the dataset. - DataSpace *filespace = new DataSpace(dataset->getSpace ()); - offset[0] = 3; - offset[1] = 0; - filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); - - // Define memory space. - DataSpace *memspace = new DataSpace(2, dimsext, NULL); - - // Write data to the extended portion of the dataset. - dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); - - // Close all objects and file. - prop.close(); - delete filespace; - delete memspace; - delete dataspace; - delete dataset; - file.close(); - - // --------------------------------------- - // Re-open the file and read the data back - // --------------------------------------- - - int rdata[10][3]; - int i,j, rank, rank_chunk; - hsize_t chunk_dimsr[2], dimsr[2]; - - // Open the file and dataset. - file.openFile(FILE_NAME, H5F_ACC_RDONLY); - dataset = new DataSet(file.openDataSet( DATASETNAME)); - - // Get the dataset's dataspace and creation property list. - filespace = new DataSpace(dataset->getSpace()); - prop = dataset->getCreatePlist(); - - // Get information to obtain memory dataspace. - rank = filespace->getSimpleExtentNdims(); - herr_t status_n = filespace->getSimpleExtentDims(dimsr); - - if (H5D_CHUNKED == prop.getLayout()) - rank_chunk = prop.getChunk(rank, chunk_dimsr); - cout << "rank chunk = " << rank_chunk << endl;; - - memspace = new DataSpace(rank, dimsr, NULL); - dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); + // Write data to dataset. + dataset->write(data, PredType::NATIVE_INT); + + // Extend the dataset. Dataset becomes 10 x 3. + size[0] = dims[0] + dimsext[0]; + size[1] = dims[1]; + dataset->extend(size); + + // Select a hyperslab in extended portion of the dataset. + DataSpace *filespace = new DataSpace(dataset->getSpace ()); + offset[0] = 3; + offset[1] = 0; + filespace->selectHyperslab(H5S_SELECT_SET, dimsext, offset); + + // Define memory space. + DataSpace *memspace = new DataSpace(2, dimsext, NULL); + + // Write data to the extended portion of the dataset. + dataset->write(dataext, PredType::NATIVE_INT, *memspace, *filespace); + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataspace; + delete dataset; + file.close(); + + // --------------------------------------- + // Re-open the file and read the data back + // --------------------------------------- + + int rdata[10][3]; + int i,j, rank, rank_chunk; + hsize_t chunk_dimsr[2], dimsr[2]; + + // Open the file and dataset. + file.openFile(FILE_NAME, H5F_ACC_RDONLY); + dataset = new DataSet(file.openDataSet( DATASETNAME)); + + // Get the dataset's dataspace and creation property list. + filespace = new DataSpace(dataset->getSpace()); + prop = dataset->getCreatePlist(); + + // Get information to obtain memory dataspace. + rank = filespace->getSimpleExtentNdims(); + herr_t status_n = filespace->getSimpleExtentDims(dimsr); + + if (H5D_CHUNKED == prop.getLayout()) + rank_chunk = prop.getChunk(rank, chunk_dimsr); + cout << "rank chunk = " << rank_chunk << endl;; + + memspace = new DataSpace(rank, dimsr, NULL); + dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); - cout << endl; - for (j = 0; j < dimsr[0]; j++) { - for (i = 0; i < dimsr[1]; i++) - cout << " " << rdata[j][i]; - cout << endl; - } - - // Close all objects and file. - prop.close(); - delete filespace; - delete memspace; - delete dataset; - file.close(); + cout << endl; + for (j = 0; j < dimsr[0]; j++) { + for (i = 0; i < dimsr[1]; i++) + cout << " " << rdata[j][i]; + cout << endl; + } + + // Close all objects and file. + prop.close(); + delete filespace; + delete memspace; + delete dataset; + file.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_rdwt.cpp b/c++/examples/h5tutr_rdwt.cpp index 4c9d49e..f17e6a5 100644 --- a/c++/examples/h5tutr_rdwt.cpp +++ b/c++/examples/h5tutr_rdwt.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -21,10 +21,10 @@ #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_dset.h5"); -const H5std_string DATASET_NAME("dset"); -const int DIM0 = 4; // dataset dimensions -const int DIM1 = 6; +const H5std_string FILE_NAME("h5tutr_dset.h5"); +const H5std_string DATASET_NAME("dset"); +const int DIM0 = 4; // dataset dimensions +const int DIM1 = 6; int main (void) { @@ -32,41 +32,41 @@ int main (void) // Data initialization. int i, j; - int data[DIM0][DIM1]; // buffer for data to write + int data[DIM0][DIM1]; // buffer for data to write for (j = 0; j < DIM0; j++) - for (i = 0; i < DIM1; i++) - data[j][i] = i * 6 + j + 1; + for (i = 0; i < DIM1; i++) + data[j][i] = i * 6 + j + 1; // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); - // Open an existing file and dataset. - H5File file(FILE_NAME, H5F_ACC_RDWR); - DataSet dataset = file.openDataSet(DATASET_NAME); + // Open an existing file and dataset. + H5File file(FILE_NAME, H5F_ACC_RDWR); + DataSet dataset = file.openDataSet(DATASET_NAME); - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - dataset.write(data, PredType::NATIVE_INT); + // Write the data to the dataset using default memory space, file + // space, and transfer properties. + dataset.write(data, PredType::NATIVE_INT); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/h5tutr_subset.cpp b/c++/examples/h5tutr_subset.cpp index 14a9ced..0747880 100644 --- a/c++/examples/h5tutr_subset.cpp +++ b/c++/examples/h5tutr_subset.cpp @@ -1,8 +1,8 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * * the COPYING file, which can be found at the root of the source code * @@ -24,13 +24,13 @@ using std::endl; #include "H5Cpp.h" using namespace H5; -const H5std_string FILE_NAME("h5tutr_subset.h5"); -const H5std_string DATASET_NAME("IntArray"); +const H5std_string FILE_NAME("h5tutr_subset.h5"); +const H5std_string DATASET_NAME("IntArray"); const int RANK = 2; -const int DIM0_SUB = 3; // subset dimensions +const int DIM0_SUB = 3; // subset dimensions const int DIM1_SUB = 4; -const int DIM0 = 8; // size of dataset +const int DIM0 = 8; // size of dataset const int DIM1 = 10; int main (void) @@ -41,134 +41,134 @@ int main (void) // Try block to detect exceptions raised by any of the calls inside it try { - // Turn off the auto-printing when failure occurs so that we can - // handle the errors appropriately - Exception::dontPrint(); - - // --------------------------------------------------- - // Create a new file using the default property lists. - // Then create a dataset and write data to it. - // Close the file and dataset. - // --------------------------------------------------- + // Turn off the auto-printing when failure occurs so that we can + // handle the errors appropriately + Exception::dontPrint(); + + // --------------------------------------------------- + // Create a new file using the default property lists. + // Then create a dataset and write data to it. + // Close the file and dataset. + // --------------------------------------------------- - H5File file(FILE_NAME, H5F_ACC_TRUNC); + H5File file(FILE_NAME, H5F_ACC_TRUNC); - hsize_t dims[2]; - dims[0] = DIM0; - dims[1] = DIM1; - DataSpace dataspace = DataSpace (RANK, dims); + hsize_t dims[2]; + dims[0] = DIM0; + dims[1] = DIM1; + DataSpace dataspace = DataSpace (RANK, dims); - DataSet dataset(file.createDataSet( DATASET_NAME, - PredType::STD_I32BE, dataspace) ); + DataSet dataset(file.createDataSet( DATASET_NAME, + PredType::STD_I32BE, dataspace) ); - for (j = 0; j < DIM0; j++) { - for (i = 0; i < DIM1; i++) - if (i< (DIM1/2)) - data[j][i] = 1; - else - data[j][i] = 2; - } + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + if (i< (DIM1/2)) + data[j][i] = 1; + else + data[j][i] = 2; + } - dataset.write(data, PredType::NATIVE_INT); + dataset.write(data, PredType::NATIVE_INT); - cout << endl << "Data Written to File:" << endl; - for (j = 0; j < DIM0; j++) { - for (i = 0; i < DIM1; i++) - cout << " " << data[j][i]; - cout << endl; - } + cout << endl << "Data Written to File:" << endl; + for (j = 0; j < DIM0; j++) { + for (i = 0; i < DIM1; i++) + cout << " " << data[j][i]; + cout << endl; + } - dataspace.close(); - dataset.close(); - file.close(); + dataspace.close(); + dataset.close(); + file.close(); - // --------------------------------------------------- - // Reopen the file and dataset and write a subset of - // values to the dataset. - // --------------------------------------------------- + // --------------------------------------------------- + // Reopen the file and dataset and write a subset of + // values to the dataset. + // --------------------------------------------------- - hsize_t offset[2], count[2], stride[2], block[2]; - hsize_t dimsm[2]; + hsize_t offset[2], count[2], stride[2], block[2]; + hsize_t dimsm[2]; - file.openFile(FILE_NAME, H5F_ACC_RDWR); - dataset = file.openDataSet(DATASET_NAME); + file.openFile(FILE_NAME, H5F_ACC_RDWR); + dataset = file.openDataSet(DATASET_NAME); - // Specify size and shape of subset to write. + // Specify size and shape of subset to write. - offset[0] = 1; - offset[1] = 2; + offset[0] = 1; + offset[1] = 2; - count[0] = DIM0_SUB; - count[1] = DIM1_SUB; + count[0] = DIM0_SUB; + count[1] = DIM1_SUB; - stride[0] = 1; - stride[1] = 1; + stride[0] = 1; + stride[1] = 1; - block[0] = 1; - block[1] = 1; + block[0] = 1; + block[1] = 1; - // Define Memory Dataspace. Get file dataspace and select - // a subset from the file dataspace. + // Define Memory Dataspace. Get file dataspace and select + // a subset from the file dataspace. - dimsm[0] = DIM0_SUB; - dimsm[1] = DIM1_SUB; + dimsm[0] = DIM0_SUB; + dimsm[1] = DIM1_SUB; - DataSpace memspace(RANK, dimsm, NULL); + DataSpace memspace(RANK, dimsm, NULL); - dataspace = dataset.getSpace(); - dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); + dataspace = dataset.getSpace(); + dataspace.selectHyperslab(H5S_SELECT_SET, count, offset, stride, block); - // Write a subset of data to the dataset, then read the - // entire dataset back from the file. + // Write a subset of data to the dataset, then read the + // entire dataset back from the file. - cout << endl << "Write subset to file specifying: " << endl; - cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; - for (j = 0; j < DIM0_SUB; j++) { - for (i = 0; i < DIM1_SUB; i++) - sdata[j][i] = 5; - } - - dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); - dataset.read(rdata, PredType::NATIVE_INT); + cout << endl << "Write subset to file specifying: " << endl; + cout << " offset=1x2 stride=1x1 count=3x4 block=1x1" << endl; + for (j = 0; j < DIM0_SUB; j++) { + for (i = 0; i < DIM1_SUB; i++) + sdata[j][i] = 5; + } + + dataset.write(sdata, PredType::NATIVE_INT, memspace, dataspace); + dataset.read(rdata, PredType::NATIVE_INT); - cout << endl << "Data in File after Subset is Written:" << endl; - for (i = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) - cout << " " << rdata[i][j]; - cout << endl; - } - cout << endl; - - // It is not necessary to close these objects because close() will - // be called when the object instances are going out of scope. - dataspace.close(); - memspace.close(); - dataset.close(); - file.close(); + cout << endl << "Data in File after Subset is Written:" << endl; + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) + cout << " " << rdata[i][j]; + cout << endl; + } + cout << endl; + + // It is not necessary to close these objects because close() will + // be called when the object instances are going out of scope. + dataspace.close(); + memspace.close(); + dataset.close(); + file.close(); } // end of try block // catch failure caused by the H5File operations catch(FileIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch(DataSetIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch(DataSpaceIException error) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; // successfully terminated diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 5a2f3bc..3df8191 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -31,9 +31,9 @@ using namespace H5; const H5std_string FILE_NAME( "SDS.h5" ); const H5std_string DATASET_NAME( "IntArray" ); -const int NX_SUB = 3; // hyperslab dimensions +const int NX_SUB = 3; // hyperslab dimensions const int NY_SUB = 4; -const int NX = 7; // output buffer dimensions +const int NX = 7; // output buffer dimensions const int NY = 7; const int NZ = 3; const int RANK_OUT = 3; @@ -49,8 +49,8 @@ int main (void) { for (i = 0; i < NY; i++) { - for (k = 0; k < NZ ; k++) - data_out[j][i][k] = 0; + for (k = 0; k < NZ ; k++) + data_out[j][i][k] = 0; } } @@ -81,19 +81,19 @@ int main (void) */ if( type_class == H5T_INTEGER ) { - cout << "Data set has INTEGER type" << endl; + cout << "Data set has INTEGER type" << endl; /* - * Get the integer datatype + * Get the integer datatype */ - IntType intype = dataset.getIntType(); + IntType intype = dataset.getIntType(); /* * Get order of datatype and print message if it's a little endian. */ - H5std_string order_string; + H5std_string order_string; H5T_order_t order = intype.getOrder( order_string ); - cout << order_string << endl; + cout << order_string << endl; /* * Get size of the data element stored in file and print it. @@ -119,15 +119,15 @@ int main (void) hsize_t dims_out[2]; int ndims = dataspace.getSimpleExtentDims( dims_out, NULL); cout << "rank " << rank << ", dimensions " << - (unsigned long)(dims_out[0]) << " x " << - (unsigned long)(dims_out[1]) << endl; + (unsigned long)(dims_out[0]) << " x " << + (unsigned long)(dims_out[1]) << endl; /* * Define hyperslab in the dataset; implicitly giving strike and * block NULL. */ - hsize_t offset[2]; // hyperslab offset in the file - hsize_t count[2]; // size of the hyperslab in the file + hsize_t offset[2]; // hyperslab offset in the file + hsize_t count[2]; // size of the hyperslab in the file offset[0] = 1; offset[1] = 2; count[0] = NX_SUB; @@ -146,8 +146,8 @@ int main (void) /* * Define memory hyperslab. */ - hsize_t offset_out[3]; // hyperslab offset in memory - hsize_t count_out[3]; // size of the hyperslab in memory + hsize_t offset_out[3]; // hyperslab offset in memory + hsize_t count_out[3]; // size of the hyperslab in memory offset_out[0] = 3; offset_out[1] = 0; offset_out[2] = 0; @@ -164,9 +164,9 @@ int main (void) for (j = 0; j < NX; j++) { - for (i = 0; i < NY; i++) - cout << data_out[j][i][0] << " "; - cout << endl; + for (i = 0; i < NY; i++) + cout << data_out[j][i][0] << " "; + cout << endl; } /* * 0 0 0 0 0 0 0 diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index f5c06cf..eada2ed 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -34,19 +34,19 @@ using namespace H5; const H5std_string FILE_NAME( "Select.h5" ); const H5std_string DATASET_NAME( "Matrix in file" ); -const int MSPACE1_RANK = 1; // Rank of the first dataset in memory +const int MSPACE1_RANK = 1; // Rank of the first dataset in memory const int MSPACE1_DIM = 50; // Dataset size in memory -const int MSPACE2_RANK = 1; // Rank of the second dataset in memory -const int MSPACE2_DIM = 4; // Dataset size in memory -const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file -const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is -const int FSPACE_DIM2 = 12; // stored in the file -const int MSPACE_RANK = 2; // Rank of the first dataset in memory -const int MSPACE_DIM1 = 8; // We will read dataset back from the file -const int MSPACE_DIM2 = 9; // to the dataset in memory with these - // dataspace parameters -const int NPOINTS = 4; // Number of points that will be selected - // and overwritten +const int MSPACE2_RANK = 1; // Rank of the second dataset in memory +const int MSPACE2_DIM = 4; // Dataset size in memory +const int FSPACE_RANK = 2; // Dataset rank as it is stored in the file +const int FSPACE_DIM1 = 8; // Dimension sizes of the dataset as it is +const int FSPACE_DIM2 = 12; // stored in the file +const int MSPACE_RANK = 2; // Rank of the first dataset in memory +const int MSPACE_DIM1 = 8; // We will read dataset back from the file +const int MSPACE_DIM2 = 9; // to the dataset in memory with these + // dataspace parameters +const int NPOINTS = 4; // Number of points that will be selected + // and overwritten int main (void) { @@ -57,271 +57,271 @@ int main (void) */ try { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - Exception::dontPrint(); - - /* - * Create a file. - */ - H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); - - /* - * Create property list for a dataset and set up fill values. - */ - int fillvalue = 0; /* Fill value for the dataset */ - DSetCreatPropList plist; - plist.setFillValue(PredType::NATIVE_INT, &fillvalue); - - /* - * Create dataspace for the dataset in the file. - */ - hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk) - DataSpace fspace( FSPACE_RANK, fdim ); - - /* - * Create dataset and write it into the file. - */ - DataSet* dataset = new DataSet(file->createDataSet( - DATASET_NAME, PredType::NATIVE_INT, fspace, plist)); - - /* - * Select hyperslab for the dataset in the file, using 3x2 blocks, - * (4,3) stride and (2,4) count starting at the position (0,1). - */ - hsize_t start[2]; // Start of hyperslab - hsize_t stride[2]; // Stride of hyperslab - hsize_t count[2]; // Block count - hsize_t block[2]; // Block sizes - start[0] = 0; start[1] = 1; - stride[0] = 4; stride[1] = 3; - count[0] = 2; count[1] = 4; - block[0] = 3; block[1] = 2; - fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); - - /* - * Create dataspace for the first dataset. - */ - hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset - (in memory) */ - DataSpace mspace1( MSPACE1_RANK, dim1 ); - - /* - * Select hyperslab. - * We will use 48 elements of the vector buffer starting at the - * second element. Selected elements are 1 2 3 . . . 48 - */ - start[0] = 1; - stride[0] = 1; - count[0] = 48; - block[0] = 1; - mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); - - /* - * Write selection from the vector buffer to the dataset in the file. - * - * File dataset should look like this: - * 0 1 2 0 3 4 0 5 6 0 7 8 - * 0 9 10 0 11 12 0 13 14 0 15 16 - * 0 17 18 0 19 20 0 21 22 0 23 24 - * 0 0 0 0 0 0 0 0 0 0 0 0 - * 0 25 26 0 27 28 0 29 30 0 31 32 - * 0 33 34 0 35 36 0 37 38 0 39 40 - * 0 41 42 0 43 44 0 45 46 0 47 48 - * 0 0 0 0 0 0 0 0 0 0 0 0 - */ - int vector[MSPACE1_DIM]; // vector buffer for dset - - /* - * Buffer initialization. - */ - vector[0] = vector[MSPACE1_DIM - 1] = -1; - for (i = 1; i < MSPACE1_DIM - 1; i++) - vector[i] = i; - - dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace ); - - /* - * Reset the selection for the file dataspace fid. - */ - fspace.selectNone(); - - /* - * Create dataspace for the second dataset. - */ - hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset - (in memory */ - DataSpace mspace2( MSPACE2_RANK, dim2 ); - - /* - * Select sequence of NPOINTS points in the file dataspace. - */ - hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points - from the file dataspace */ - coord[0][0] = 0; coord[0][1] = 0; - coord[1][0] = 3; coord[1][1] = 3; - coord[2][0] = 3; coord[2][1] = 5; - coord[3][0] = 5; coord[3][1] = 6; - - fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord); - - /* - * Write new selection of points to the dataset. - */ - int values[] = {53, 59, 61, 67}; /* New values to be written */ - dataset->write( values, PredType::NATIVE_INT, mspace2, fspace ); - - /* - * File dataset should look like this: - * 53 1 2 0 3 4 0 5 6 0 7 8 - * 0 9 10 0 11 12 0 13 14 0 15 16 - * 0 17 18 0 19 20 0 21 22 0 23 24 - * 0 0 0 59 0 61 0 0 0 0 0 0 - * 0 25 26 0 27 28 0 29 30 0 31 32 - * 0 33 34 0 35 36 67 37 38 0 39 40 - * 0 41 42 0 43 44 0 45 46 0 47 48 - * 0 0 0 0 0 0 0 0 0 0 0 0 - * - */ - - /* - * Close the dataset and the file. - */ - delete dataset; - delete file; - - /* - * Open the file. - */ - file = new H5File( FILE_NAME, H5F_ACC_RDONLY ); - - /* - * Open the dataset. - */ - dataset = new DataSet( file->openDataSet( DATASET_NAME )); - - /* - * Get dataspace of the dataset. - */ - fspace = dataset->getSpace(); - - /* - * Select first hyperslab for the dataset in the file. The following - * elements are selected: - * 10 0 11 12 - * 18 0 19 20 - * 0 59 0 61 - * - */ - start[0] = 1; start[1] = 2; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 3; count[1] = 4; - fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - - /* - * Add second selected hyperslab to the selection. - * The following elements are selected: - * 19 20 0 21 22 - * 0 61 0 0 0 - * 27 28 0 29 30 - * 35 36 67 37 38 - * 43 44 0 45 46 - * 0 0 0 0 0 - * Note that two hyperslabs overlap. Common elements are: - * 19 20 - * 0 61 - */ - start[0] = 2; start[1] = 4; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 6; count[1] = 5; - fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); - - /* - * Create memory dataspace. - */ - hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the + /* + * Turn off the auto-printing when failure occurs so that we can + * handle the errors appropriately + */ + Exception::dontPrint(); + + /* + * Create a file. + */ + H5File* file = new H5File( FILE_NAME, H5F_ACC_TRUNC ); + + /* + * Create property list for a dataset and set up fill values. + */ + int fillvalue = 0; /* Fill value for the dataset */ + DSetCreatPropList plist; + plist.setFillValue(PredType::NATIVE_INT, &fillvalue); + + /* + * Create dataspace for the dataset in the file. + */ + hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; // dim sizes of ds (on disk) + DataSpace fspace( FSPACE_RANK, fdim ); + + /* + * Create dataset and write it into the file. + */ + DataSet* dataset = new DataSet(file->createDataSet( + DATASET_NAME, PredType::NATIVE_INT, fspace, plist)); + + /* + * Select hyperslab for the dataset in the file, using 3x2 blocks, + * (4,3) stride and (2,4) count starting at the position (0,1). + */ + hsize_t start[2]; // Start of hyperslab + hsize_t stride[2]; // Stride of hyperslab + hsize_t count[2]; // Block count + hsize_t block[2]; // Block sizes + start[0] = 0; start[1] = 1; + stride[0] = 4; stride[1] = 3; + count[0] = 2; count[1] = 4; + block[0] = 3; block[1] = 2; + fspace.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); + + /* + * Create dataspace for the first dataset. + */ + hsize_t dim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset + (in memory) */ + DataSpace mspace1( MSPACE1_RANK, dim1 ); + + /* + * Select hyperslab. + * We will use 48 elements of the vector buffer starting at the + * second element. Selected elements are 1 2 3 . . . 48 + */ + start[0] = 1; + stride[0] = 1; + count[0] = 48; + block[0] = 1; + mspace1.selectHyperslab( H5S_SELECT_SET, count, start, stride, block); + + /* + * Write selection from the vector buffer to the dataset in the file. + * + * File dataset should look like this: + * 0 1 2 0 3 4 0 5 6 0 7 8 + * 0 9 10 0 11 12 0 13 14 0 15 16 + * 0 17 18 0 19 20 0 21 22 0 23 24 + * 0 0 0 0 0 0 0 0 0 0 0 0 + * 0 25 26 0 27 28 0 29 30 0 31 32 + * 0 33 34 0 35 36 0 37 38 0 39 40 + * 0 41 42 0 43 44 0 45 46 0 47 48 + * 0 0 0 0 0 0 0 0 0 0 0 0 + */ + int vector[MSPACE1_DIM]; // vector buffer for dset + + /* + * Buffer initialization. + */ + vector[0] = vector[MSPACE1_DIM - 1] = -1; + for (i = 1; i < MSPACE1_DIM - 1; i++) + vector[i] = i; + + dataset->write( vector, PredType::NATIVE_INT, mspace1, fspace ); + + /* + * Reset the selection for the file dataspace fid. + */ + fspace.selectNone(); + + /* + * Create dataspace for the second dataset. + */ + hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset + (in memory */ + DataSpace mspace2( MSPACE2_RANK, dim2 ); + + /* + * Select sequence of NPOINTS points in the file dataspace. + */ + hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points + from the file dataspace */ + coord[0][0] = 0; coord[0][1] = 0; + coord[1][0] = 3; coord[1][1] = 3; + coord[2][0] = 3; coord[2][1] = 5; + coord[3][0] = 5; coord[3][1] = 6; + + fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t *)coord); + + /* + * Write new selection of points to the dataset. + */ + int values[] = {53, 59, 61, 67}; /* New values to be written */ + dataset->write( values, PredType::NATIVE_INT, mspace2, fspace ); + + /* + * File dataset should look like this: + * 53 1 2 0 3 4 0 5 6 0 7 8 + * 0 9 10 0 11 12 0 13 14 0 15 16 + * 0 17 18 0 19 20 0 21 22 0 23 24 + * 0 0 0 59 0 61 0 0 0 0 0 0 + * 0 25 26 0 27 28 0 29 30 0 31 32 + * 0 33 34 0 35 36 67 37 38 0 39 40 + * 0 41 42 0 43 44 0 45 46 0 47 48 + * 0 0 0 0 0 0 0 0 0 0 0 0 + * + */ + + /* + * Close the dataset and the file. + */ + delete dataset; + delete file; + + /* + * Open the file. + */ + file = new H5File( FILE_NAME, H5F_ACC_RDONLY ); + + /* + * Open the dataset. + */ + dataset = new DataSet( file->openDataSet( DATASET_NAME )); + + /* + * Get dataspace of the dataset. + */ + fspace = dataset->getSpace(); + + /* + * Select first hyperslab for the dataset in the file. The following + * elements are selected: + * 10 0 11 12 + * 18 0 19 20 + * 0 59 0 61 + * + */ + start[0] = 1; start[1] = 2; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 3; count[1] = 4; + fspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + + /* + * Add second selected hyperslab to the selection. + * The following elements are selected: + * 19 20 0 21 22 + * 0 61 0 0 0 + * 27 28 0 29 30 + * 35 36 67 37 38 + * 43 44 0 45 46 + * 0 0 0 0 0 + * Note that two hyperslabs overlap. Common elements are: + * 19 20 + * 0 61 + */ + start[0] = 2; start[1] = 4; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 6; count[1] = 5; + fspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); + + /* + * Create memory dataspace. + */ + hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the dataset in memory when we read selection from the dataset on the disk */ - DataSpace mspace(MSPACE_RANK, mdim); - - /* - * Select two hyperslabs in memory. Hyperslabs has the same - * size and shape as the selected hyperslabs for the file dataspace. - */ - start[0] = 0; start[1] = 0; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 3; count[1] = 4; - mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); - start[0] = 1; start[1] = 2; - block[0] = 1; block[1] = 1; - stride[0] = 1; stride[1] = 1; - count[0] = 6; count[1] = 5; - mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); - - /* - * Initialize data buffer. - */ - int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; - for (i = 0; i < MSPACE_DIM1; i++) - for (j = 0; j < MSPACE_DIM2; j++) - matrix_out[i][j] = 0; - - /* - * Read data back to the buffer matrix. - */ - dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace); - - /* - * Display the result. Memory dataset is: - * - * 10 0 11 12 0 0 0 0 0 - * 18 0 19 20 0 21 22 0 0 - * 0 59 0 61 0 0 0 0 0 - * 0 0 27 28 0 29 30 0 0 - * 0 0 35 36 67 37 38 0 0 - * 0 0 43 44 0 45 46 0 0 - * 0 0 0 0 0 0 0 0 0 - * 0 0 0 0 0 0 0 0 0 - */ - for (i=0; i < MSPACE_DIM1; i++) - { - for(j=0; j < MSPACE_DIM2; j++) - cout << matrix_out[i][j] << " "; - cout << endl; - } - - /* - * Close the dataset and the file. - */ - delete dataset; - delete file; + DataSpace mspace(MSPACE_RANK, mdim); + + /* + * Select two hyperslabs in memory. Hyperslabs has the same + * size and shape as the selected hyperslabs for the file dataspace. + */ + start[0] = 0; start[1] = 0; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 3; count[1] = 4; + mspace.selectHyperslab(H5S_SELECT_SET, count, start, stride, block); + start[0] = 1; start[1] = 2; + block[0] = 1; block[1] = 1; + stride[0] = 1; stride[1] = 1; + count[0] = 6; count[1] = 5; + mspace.selectHyperslab(H5S_SELECT_OR, count, start, stride, block); + + /* + * Initialize data buffer. + */ + int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; + for (i = 0; i < MSPACE_DIM1; i++) + for (j = 0; j < MSPACE_DIM2; j++) + matrix_out[i][j] = 0; + + /* + * Read data back to the buffer matrix. + */ + dataset->read(matrix_out, PredType::NATIVE_INT, mspace, fspace); + + /* + * Display the result. Memory dataset is: + * + * 10 0 11 12 0 0 0 0 0 + * 18 0 19 20 0 21 22 0 0 + * 0 59 0 61 0 0 0 0 0 + * 0 0 27 28 0 29 30 0 0 + * 0 0 35 36 67 37 38 0 0 + * 0 0 43 44 0 45 46 0 0 + * 0 0 0 0 0 0 0 0 0 + * 0 0 0 0 0 0 0 0 0 + */ + for (i=0; i < MSPACE_DIM1; i++) + { + for(j=0; j < MSPACE_DIM2; j++) + cout << matrix_out[i][j] << " "; + cout << endl; + } + + /* + * Close the dataset and the file. + */ + delete dataset; + delete file; } // end of try block // catch failure caused by the H5File operations catch( FileIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSet operations catch( DataSetIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } // catch failure caused by the DataSpace operations catch( DataSpaceIException error ) { - error.printErrorStack(); - return -1; + error.printErrorStack(); + return -1; } return 0; -- cgit v0.12 From 911b1ca67fdf7c2f3a32dd42c591e4e9b2fa1950 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 18 Sep 2019 13:25:02 -0700 Subject: Fix for H5EA debug package when built in release mode. --- src/H5EAtest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/H5EAtest.c b/src/H5EAtest.c index b7064de..f7731eb 100644 --- a/src/H5EAtest.c +++ b/src/H5EAtest.c @@ -292,7 +292,9 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx)) HDassert(raw); HDassert(elmt); HDassert(nelmts); +#ifdef H5EA_DEBUG HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); +#endif /* H5EA_DEBUG */ /* Decode raw elements into native elements */ while(nelmts) { -- cgit v0.12 From 8cddc96f73e8f90f67792405f5142b419e9061d7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2019 13:42:46 -0500 Subject: Change unused variable to generic form --- java/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt index 528b24f..56e1695 100644 --- a/java/CMakeLists.txt +++ b/java/CMakeLists.txt @@ -16,7 +16,7 @@ message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") if (WIN32) - set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre8") + set (HDF_JRE_DIRECTORY "C:/Program Files/Java/jre") else () set (HDF_JRE_DIRECTORY "/usr/lib/jvm/jre") endif () -- cgit v0.12 From a6930a2bcfd37ea3610baafb608faec883286315 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 19 Sep 2019 13:50:49 -0700 Subject: Renamed get/set_time() calls in the tools library to avoid name clash when building static parallel HDF5 w/ static linking to OpenMPI. --- tools/lib/io_timer.c | 13 ++++++++----- tools/lib/io_timer.h | 4 ++-- tools/test/perform/pio_engine.c | 40 ++++++++++++++++++++-------------------- tools/test/perform/pio_perf.c | 24 ++++++++++++------------ tools/test/perform/sio_engine.c | 24 ++++++++++++------------ tools/test/perform/sio_perf.c | 16 ++++++++-------- 6 files changed, 62 insertions(+), 59 deletions(-) diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index a6885df..cb89019 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -123,17 +123,17 @@ get_timer_type(io_time_t *pt) #endif /* - * Function: set_time + * Function: io_time_set * Purpose: Set the time in a ``io_time_t'' object. * Return: Pointer to the passed in ``io_time_t'' object if SUCCEED; Null otherwise. * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ io_time_t * -set_time(io_time_t *pt, timer_type t, int start_stop) +io_time_set(io_time_t *pt, timer_type t, int start_stop) { /* sanity check */ - assert(pt); + HDassert(pt); switch(pt->type){ #ifdef H5_HAVE_PARALLEL @@ -207,15 +207,18 @@ set_time(io_time_t *pt, timer_type t, int start_stop) } /* - * Function: get_time + * Function: io_time_get * Purpose: Get the time from a ``io_time_t'' object. * Return: The number of seconds as a DOUBLE. * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ H5_ATTR_PURE double -get_time(io_time_t *pt, timer_type t) +io_time_get(io_time_t *pt, timer_type t) { + /* sanity check */ + HDassert(pt); + return pt->total_time[t]; } diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 48b6c87..78bf676 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -72,8 +72,8 @@ extern "C" { #endif /* __cplusplus */ H5TOOLS_DLL io_time_t *io_time_new(clock_type t); H5TOOLS_DLL void io_time_destroy(io_time_t *pt); -H5TOOLS_DLL io_time_t *set_time(io_time_t *pt, timer_type t, int start_stop); -H5TOOLS_DLL double get_time(io_time_t *pt, timer_type t); +H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop); +H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t); #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c index 798e32e..77c04ab 100644 --- a/tools/test/perform/pio_engine.c +++ b/tools/test/perform/pio_engine.c @@ -311,21 +311,21 @@ do_pio(parameters param) /* Need barrier to make sure everyone starts at the same time */ MPI_Barrier(pio_comm_g); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_CREATE | PIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -339,20 +339,20 @@ do_pio(parameters param) MPI_Barrier(pio_comm_g); /* Open file for read */ - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, PIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(&res, &fd, ¶m, ndsets, nbytes, buf_size, buffer); - set_time(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + io_time_set(res.timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -958,7 +958,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Write */ @@ -1389,7 +1389,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -1889,7 +1889,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end else */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); while (nbytes_xfer < bytes_count){ /* Read */ @@ -2344,7 +2344,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, } /* end while */ /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ @@ -2639,9 +2639,9 @@ int MPI_File_read_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, TSTART); + io_time_set(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, TSTOP); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -2650,9 +2650,9 @@ int MPI_File_read_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_READ, TSTART); + io_time_set(timer_g, HDF5_MPI_READ, TSTART); err=PMPI_File_read_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_READ, TSTOP); + io_time_set(timer_g, HDF5_MPI_READ, TSTOP); return err; } @@ -2660,9 +2660,9 @@ int MPI_File_write_at(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, TSTART); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, TSTOP); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } @@ -2670,9 +2670,9 @@ int MPI_File_write_at_all(MPI_File fh, MPI_Offset offset, void *buf, int count, MPI_Datatype datatype, MPI_Status *status) { int err; - set_time(timer_g, HDF5_MPI_WRITE, TSTART); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTART); err=PMPI_File_write_at_all(fh, offset, buf, count, datatype, status); - set_time(timer_g, HDF5_MPI_WRITE, TSTOP); + io_time_set(timer_g, HDF5_MPI_WRITE, TSTOP); return err; } diff --git a/tools/test/perform/pio_perf.c b/tools/test/perform/pio_perf.c index 93741c4..9f4d116 100644 --- a/tools/test/perform/pio_perf.c +++ b/tools/test/perform/pio_perf.c @@ -587,74 +587,74 @@ run_test(iotype iot, parameters parms, struct options *opts) res = do_pio(parms); /* gather all of the "mpi write" times */ - t = get_time(res.timers, HDF5_MPI_WRITE); + t = io_time_get(res.timers, HDF5_MPI_WRITE); get_minmax(&write_mpi_mm, t); write_mpi_mm_table[i] = write_mpi_mm; /* gather all of the "write" times */ - t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); get_minmax(&write_mm, t); write_mm_table[i] = write_mm; /* gather all of the "write" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); get_minmax(&write_gross_mm, t); write_gross_mm_table[i] = write_gross_mm; /* gather all of the raw "write" times */ - t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); get_minmax(&write_raw_mm, t); write_raw_mm_table[i] = write_raw_mm; /* gather all of the file open times (time from open to first write) */ - t = get_time(res.timers, HDF5_FILE_WRITE_OPEN); + t = io_time_get(res.timers, HDF5_FILE_WRITE_OPEN); get_minmax(&write_open_mm, t); write_open_mm_table[i] = write_open_mm; /* gather all of the file close times (time from last write to close) */ - t = get_time(res.timers, HDF5_FILE_WRITE_CLOSE); + t = io_time_get(res.timers, HDF5_FILE_WRITE_CLOSE); get_minmax(&write_close_mm, t); write_close_mm_table[i] = write_close_mm; if (!parms.h5_write_only) { /* gather all of the "mpi read" times */ - t = get_time(res.timers, HDF5_MPI_READ); + t = io_time_get(res.timers, HDF5_MPI_READ); get_minmax(&read_mpi_mm, t); read_mpi_mm_table[i] = read_mpi_mm; /* gather all of the "read" times */ - t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); get_minmax(&read_mm, t); read_mm_table[i] = read_mm; /* gather all of the "read" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); get_minmax(&read_gross_mm, t); read_gross_mm_table[i] = read_gross_mm; /* gather all of the raw "read" times */ - t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); get_minmax(&read_raw_mm, t); read_raw_mm_table[i] = read_raw_mm; /* gather all of the file open times (time from open to first read) */ - t = get_time(res.timers, HDF5_FILE_READ_OPEN); + t = io_time_get(res.timers, HDF5_FILE_READ_OPEN); get_minmax(&read_open_mm, t); read_open_mm_table[i] = read_open_mm; /* gather all of the file close times (time from last read to close) */ - t = get_time(res.timers, HDF5_FILE_READ_CLOSE); + t = io_time_get(res.timers, HDF5_FILE_READ_CLOSE); get_minmax(&read_close_mm, t); read_close_mm_table[i] = read_close_mm; diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 488f575..07a39cb 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -212,18 +212,18 @@ do_sio(parameters param, results *res) HDfprintf(output, "data filename=%s\n", fname); - set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_CREATE | SIO_WRITE); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART); hrc = do_write(res, &fd, ¶m, buffer); - set_time(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_write failed"); /* Close file for write */ hrc = do_fclose(iot, &fd); - set_time(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_GROSS_WRITE_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); if (!param.h5_write_only) { @@ -232,19 +232,19 @@ do_sio(parameters param, results *res) */ /* Open file for read */ - set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTART); hrc = do_fopen(¶m, fname, &fd, SIO_READ); VRFY((hrc == SUCCESS), "do_fopen failed"); - set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTART); hrc = do_read(res, &fd, ¶m, buffer); - set_time(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_FINE_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_read failed"); /* Close file for read */ hrc = do_fclose(iot, &fd); - set_time(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_GROSS_READ_FIXED_DIMS, TSTOP); VRFY((hrc == SUCCESS), "do_fclose failed"); } @@ -550,7 +550,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Start "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTART); /* Perform write */ hrc = dset_write(rank-1, fd, parms, buffer); @@ -562,7 +562,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer) /* Stop "raw data" write timer */ - set_time(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_WRITE_FIXED_DIMS, TSTOP); /* Calculate write time */ @@ -872,7 +872,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* end switch */ /* Start "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTART); hrc = dset_read(rank-1, fd, parms, buffer, buffer2); if (hrc < 0) { @@ -881,7 +881,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) } /* Stop "raw data" read timer */ - set_time(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); + io_time_set(res->timers, HDF5_RAW_READ_FIXED_DIMS, TSTOP); /* Calculate read time */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index ff9e2b4..cbb9049 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -498,50 +498,50 @@ run_test(iotype iot, parameters parms, struct options *opts) do_sio(parms, &res); /* gather all of the "sys write" times */ - t = get_time(res.timers, HDF5_MPI_WRITE); + t = io_time_get(res.timers, HDF5_MPI_WRITE); get_minmax(&write_sys_mm, t); write_sys_mm_table[i] = write_sys_mm; /* gather all of the "write" times */ - t = get_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_WRITE_FIXED_DIMS); get_minmax(&write_mm, t); write_mm_table[i] = write_mm; /* gather all of the "write" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS); get_minmax(&write_gross_mm, t); write_gross_mm_table[i] = write_gross_mm; /* gather all of the raw "write" times */ - t = get_time(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_WRITE_FIXED_DIMS); get_minmax(&write_raw_mm, t); write_raw_mm_table[i] = write_raw_mm; if (!parms.h5_write_only) { /* gather all of the "mpi read" times */ - t = get_time(res.timers, HDF5_MPI_READ); + t = io_time_get(res.timers, HDF5_MPI_READ); get_minmax(&read_sys_mm, t); read_sys_mm_table[i] = read_sys_mm; /* gather all of the "read" times */ - t = get_time(res.timers, HDF5_FINE_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_FINE_READ_FIXED_DIMS); get_minmax(&read_mm, t); read_mm_table[i] = read_mm; /* gather all of the "read" times from open to close */ - t = get_time(res.timers, HDF5_GROSS_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_GROSS_READ_FIXED_DIMS); get_minmax(&read_gross_mm, t); read_gross_mm_table[i] = read_gross_mm; /* gather all of the raw "read" times */ - t = get_time(res.timers, HDF5_RAW_READ_FIXED_DIMS); + t = io_time_get(res.timers, HDF5_RAW_READ_FIXED_DIMS); get_minmax(&read_raw_mm, t); read_raw_mm_table[i] = read_gross_mm; -- cgit v0.12 From aa8c7b31d7cd91ce313268c53c3340db167ab5b0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 19 Sep 2019 16:32:40 -0500 Subject: small syntax changes --- java/examples/datasets/CMakeLists.txt | 4 +++- java/examples/datatypes/CMakeLists.txt | 4 +++- java/examples/groups/CMakeLists.txt | 15 +++++++++++---- java/examples/intro/CMakeLists.txt | 16 +++------------- java/test/TestH5.java | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index c64e02e..8849524 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -112,6 +112,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=datasets/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_datasets-${example} PROPERTIES DEPENDS JAVA_datasets-${example}-copy-objects) + set_tests_properties (JAVA_datasets-${example} PROPERTIES + DEPENDS JAVA_datasets-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 70648e4..b83da0e 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -87,6 +87,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=datatypes/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_datatypes-${example} PROPERTIES DEPENDS JAVA_datatypes-${example}-copy-objects) + set_tests_properties (JAVA_datatypes-${example} PROPERTIES + DEPENDS JAVA_datatypes-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index e1ad108..9e43087 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -63,17 +63,22 @@ if (BUILD_TESTING) if (NOT example STREQUAL "H5Ex_G_Iterate" AND NOT example STREQUAL "H5Ex_G_Visit") if (example STREQUAL "H5Ex_G_Compact") add_test ( - NAME JAVA_groups-${example}-clear-h5s + NAME JAVA_groups-${example}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 ) else () add_test ( - NAME JAVA_groups-${example}-clear-h5s + NAME JAVA_groups-${example}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 ) endif () + else () + add_test ( + NAME JAVA_groups-${example}-clear-objects + COMMAND ${CMAKE_COMMAND} -E echo "${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 exists" + ) endif () add_test ( @@ -82,7 +87,7 @@ if (BUILD_TESTING) ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt ) - set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-h5s) + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS JAVA_groups-${example}-clear-objects) add_test ( NAME JAVA_groups-${example} COMMAND "${CMAKE_COMMAND}" @@ -97,6 +102,8 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=groups/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_groups-${example} PROPERTIES DEPENDS JAVA_groups-${example}-copy-objects) + set_tests_properties (JAVA_groups-${example} PROPERTIES + DEPENDS JAVA_groups-${example}-copy-objects + ) endforeach () endif () diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index e60af88..b56e3ad 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -45,18 +45,6 @@ foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") endforeach () -foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) - file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt - "Main-Class: examples.intro.${example} -" - ) - add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) - get_target_property (${example}_JAR_FILE ${example} JAR_FILE) -# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) - get_target_property (${example}_CLASSPATH ${example} CLASSDIR) - add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) -endforeach () - if (BUILD_TESTING) get_property (target_name TARGET ${HDF5_JAVA_JNI_LIB_TARGET} PROPERTY OUTPUT_NAME) set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=${target_name}$<$:${CMAKE_DEBUG_POSTFIX}>;") @@ -89,7 +77,9 @@ if (BUILD_TESTING) -D "TEST_REFERENCE=intro/${example}.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) - set_tests_properties (JAVA_intro-${example} PROPERTIES DEPENDS JAVA_intro-${example}-copy-objects) + set_tests_properties (JAVA_intro-${example} PROPERTIES + DEPENDS JAVA_intro-${example}-copy-objects + ) endforeach () endif () diff --git a/java/test/TestH5.java b/java/test/TestH5.java index d63ef01..10c7c8f 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -81,7 +81,7 @@ public class TestH5 { int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5F_ACC_EXCL, H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_DEBUG, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, -- cgit v0.12 From cf9eff93e05c9e68d82ebb1fc1e02319e428af35 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 20 Sep 2019 09:30:36 -0500 Subject: Remove obsolete symbol --- java/test/TestH5.java | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 10c7c8f..1dbcce3 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -54,8 +54,8 @@ public class TestH5 { /** * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. * NOTE: - * H5F_ACC_DEBUG no longer prints any special debug info. The symbol is - * being retained and will be listed as deprecated in HDF5 1.10.0. + * H5F_ACC_DEBUG no longer prints any special debug info. Even though the symbol is + * being retained hdf java does not access the symbol. */ @Test public void testJ2C() { @@ -63,7 +63,6 @@ public class TestH5 { int H5F_ACC_RDWR = 0x0001; int H5F_ACC_TRUNC = 0x0002; int H5F_ACC_EXCL = 0x0004; - int H5F_ACC_DEBUG = 0x0000; // HDFFV-1074 was 0x0008; int H5F_ACC_CREAT = 0x0010; int H5F_OBJ_FILE = 0x0001; int H5F_OBJ_DATASET = 0x0002; @@ -75,13 +74,13 @@ public class TestH5 { int H5F_OBJ_LOCAL = 0x0020; int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, - H5F_ACC_EXCL, H5F_ACC_DEBUG, H5F_ACC_CREAT, H5F_OBJ_FILE, + H5F_ACC_EXCL, H5F_ACC_CREAT, H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, H5F_OBJ_ALL, H5F_OBJ_LOCAL }; int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, @@ -177,7 +176,7 @@ public class TestH5 { for (int i = 0; i < 2; i++) assertFalse(libversion[i] == 0); } - + /** * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])} * to ensure a null libversion parameter causes the function to @@ -185,14 +184,14 @@ public class TestH5 { */ @Test public void testH5get_libversion_null_param() { - try { - H5.H5get_libversion(null); - } - catch (Throwable err) { - return; - } - - fail("H5.H5get_libversion: succeeded with a null libversion parameter!"); + try { + H5.H5get_libversion(null); + } + catch (Throwable err) { + return; + } + + fail("H5.H5get_libversion: succeeded with a null libversion parameter!"); } /** -- cgit v0.12